adding extractCustomPropertiesForDoPayment() method proof of concept
authorRich Lott / Artful Robot <forums@artfulrobot.uk>
Tue, 26 Nov 2019 13:01:22 +0000 (13:01 +0000)
committerRich Lott / Artful Robot <forums@artfulrobot.uk>
Tue, 26 Nov 2019 13:01:22 +0000 (13:01 +0000)
CRM/Core/Payment.php

index 57fa1830aaab65598edae96dd4d3d31f598b2850..5ae135f13d37eea3261ba8195636c53b1ccc48f6 100644 (file)
@@ -1236,6 +1236,23 @@ abstract class CRM_Core_Payment {
     return $params;
   }
 
+  /**
+   * Processors may need to inspect, validate, cast and copy data that is
+   * specific to this Payment Processor from the input array to custom fields
+   * on the PropertyBag.
+   *
+   * @param Civi\Payment\PropertyBag $propertyBag
+   * @param array $params
+   * @param string $component
+   *
+   * @throws \Civi\Payment\Exception\PaymentProcessorException
+   */
+  public function extractCustomPropertiesForDoPayment(PropertyBag $propertyBag, array $params, $component = 'contribute') {
+    // example
+    // (validation and casting goes first)
+    // $propertyBag->setCustomProperty('myprocessor_customPropertyName', $value);
+  }
+
   /**
    * Process payment - this function wraps around both doTransferCheckout and doDirectPayment.
    * Any processor that still implements the deprecated doTransferCheckout() or doDirectPayment() should be updated to use doPayment().