From 194ae0f4206d0de00dea44553ac8a679cd771ea4 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 13 Jun 2020 10:50:44 +1200 Subject: [PATCH] PropertyBag - add cardNumber to getters As https://github.com/civicrm/civicrm-core/pull/17594 demonstrates, existing processors require this parameter --- Civi/Payment/PropertyBag.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Civi/Payment/PropertyBag.php b/Civi/Payment/PropertyBag.php index a97c8d113f..fe1f239da6 100644 --- a/Civi/Payment/PropertyBag.php +++ b/Civi/Payment/PropertyBag.php @@ -38,12 +38,14 @@ class PropertyBag implements \ArrayAccess { 'billingPostalCode' => TRUE, 'billingCounty' => TRUE, 'billingCountry' => TRUE, + 'cardNumber' => TRUE, 'contactID' => TRUE, 'contact_id' => 'contactID', 'contributionID' => TRUE, 'contribution_id' => 'contributionID', 'contributionRecurID' => TRUE, 'contribution_recur_id' => 'contributionRecurID', + 'credit_card_number' => 'cardNumber', 'currency' => TRUE, 'currencyID' => 'currency', 'description' => TRUE, @@ -555,6 +557,29 @@ class PropertyBag implements \ArrayAccess { } /** + * Get the (generally credit) card number. + * + * @param string $label + * + * @return string + */ + public function getCardNumber($label = 'default'): string { + return $this->get('cardNumber', $label); + } + + /** + * @param string $cardNumber + * @param string $label + * + * @return \Civi\Payment\PropertyBag + */ + public function setCardNumber($cardNumber, $label = 'default'): PropertyBag { + return $this->set('cardNumber', $label, (string) $cardNumber); + } + + /** + * @param string $label + * * @return int */ public function getContactID($label = 'default'): int { @@ -564,6 +589,8 @@ class PropertyBag implements \ArrayAccess { /** * @param int $contactID * @param string $label + * + * @return \Civi\Payment\PropertyBag */ public function setContactID($contactID, $label = 'default') { // We don't use this because it counts zero as positive: CRM_Utils_Type::validate($contactID, 'Positive'); -- 2.25.1