Skip to content
Snippets Groups Projects
Commit d4ba89f7 authored by mattwire's avatar mattwire
Browse files

Comments and function renames for clarity

parent c658ad43
Branches
Tags
No related merge requests found
......@@ -335,13 +335,14 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
}
/**
* Implementation of hook_civicrm_buildForm().
*
* @param $form - reference to the form object
* Set default values when loading the (payment) form
*
* @param \CRM_Core_Form $form
*/
public function buildForm(&$form) {
// Set default values
$paymentProcessorId = CRM_Utils_Array::value('id', $form->_paymentProcessor);
$publishableKey = self::stripe_get_key($paymentProcessorId);
$publishableKey = CRM_Core_Payment_Stripe::getPublishableKey($paymentProcessorId);
$defaults = [
'stripe_id' => $paymentProcessorId,
'stripe_pub_key' => $publishableKey,
......@@ -349,14 +350,14 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$form->setDefaults($defaults);
}
/**
/**
* Given a payment processor id, return the publishable key (password field)
*
* @param $paymentProcessorId
*
* @return string
*/
public function stripe_get_key($paymentProcessorId) {
public static function getPublishableKey($paymentProcessorId) {
try {
$publishableKey = (string) civicrm_api3('PaymentProcessor', 'getvalue', array(
'return' => "password",
......@@ -922,5 +923,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$ipnClass = new CRM_Core_Payment_StripeIPN($data);
$ipnClass->main();
}
}
......@@ -233,8 +233,9 @@ function stripe_civicrm_alterContent( &$content, $context, $tplName, &$object )
/**
* Add stripe.js to forms, to generate stripe token
* hook_civicrm_alterContent is not called for all forms (eg. CRM_Contribute_Form_Contribution on backend)
* @param $formName
* @param $form
*
* @param string $formName
* @param CRM_Core_Form $form
*/
function stripe_civicrm_buildForm($formName, &$form) {
global $_stripe_scripts_added;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment