CRM-19372 allow payment processors to define an array of accepted credit card types
[civicrm-core.git] / CRM / Core / Payment.php
index b58740242cc130b8f87a8ad58b977ef8fa5051fa..745bf1131e130f8896c66f03b2fdc8485a7a5180 100644 (file)
@@ -47,6 +47,33 @@ abstract class CRM_Core_Payment {
    */
   protected $_component;
 
+  /**
+   * Parameters to append to the notify url.
+   *
+   * The notify url is passed to the payment processor and the processor uses it for return ping backs or redirection.
+   *
+   * @var array
+   */
+  protected $notifyUrlParameters = array();
+
+  /**
+   * Get notify url parameters.
+   *
+   * @return array
+   */
+  public function getNotifyUrlParameters() {
+    return $this->notifyUrlParameters;
+  }
+
+  /**
+   * Set notify url parameters.
+   *
+   * @param array $notifyUrlParameters
+   */
+  public function setNotifyUrlParameters($notifyUrlParameters) {
+    $this->notifyUrlParameters = $notifyUrlParameters;
+  }
+
   /**
    * How are we getting billing information.
    *
@@ -857,10 +884,10 @@ abstract class CRM_Core_Payment {
   }
 
   /**
-   * Get url to return to after cancelled or failed transaction
+   * Get url to return to after cancelled or failed transaction.
    *
-   * @param $qfKey
-   * @param $participantID
+   * @param string $qfKey
+   * @param int $participantID
    *
    * @return string cancel url
    */
@@ -966,8 +993,10 @@ abstract class CRM_Core_Payment {
   protected function getNotifyUrl() {
     $url = CRM_Utils_System::url(
       'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
-      array(),
-      TRUE
+      $this->getNotifyUrlParameters(),
+      TRUE,
+      NULL,
+      FALSE
     );
     return (stristr($url, '.')) ? $url : '';
   }