diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d919679..24c1cc54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ChangeLog ========= +2.2.6 +------------------- +- Added a new notes field to the Payment object, allowing users to include supplementary information or comments related to a payment. +- Deprecated the description field from the Payment object. Please use the new notes field in its place for all future implementations. + 2.2.5 ------------------- - Added field 'accountId' to PayPal. diff --git a/examples/three-step-tutorial.php b/examples/three-step-tutorial.php index 3c74997e..107f5319 100644 --- a/examples/three-step-tutorial.php +++ b/examples/three-step-tutorial.php @@ -89,6 +89,7 @@ ->setClientPaymentId(uniqid('psdk-')) ->setCurrency('USD') ->setAmount('50.25') + ->setNotes("Payment") ->setPurpose('OTHER'); try { $payment = $hyperwallet->createPayment($payment); diff --git a/src/Hyperwallet/Model/Payment.php b/src/Hyperwallet/Model/Payment.php index 65d26955..0396c8dc 100644 --- a/src/Hyperwallet/Model/Payment.php +++ b/src/Hyperwallet/Model/Payment.php @@ -13,6 +13,7 @@ * @property string $currency The payment currency * * @property string $description The payment description + * @property string $notes The payment notes * @property string $memo The payment memo * @property string $purpose The payment purpose * @property \DateTime $releaseOn The payment release date @@ -157,22 +158,44 @@ public function setCurrency($currency) { } /** - * Get the payment description + * Retrieves the legacy payment description. * + * @deprecated Use getNotes() instead. * @return string */ public function getDescription() { - return $this->description; + return $this->notes; } /** * Set the payment description - * + + * @deprecated Use setNotes(string $notes) instead. * @param string $description * @return Payment */ public function setDescription($description) { - $this->description = $description; + $this->notes = $description; + return $this; + } + + /** + * Get the payment notes + * + * @return string + */ + public function getNotes() { + return $this->notes; + } + + /** + * Set the payment notes + * + * @param string $notes + * @return notes + */ + public function setNotes($notes) { + $this->notes = $notes; return $this; } diff --git a/tests/Hyperwallet/Tests/Model/PaymentTest.php b/tests/Hyperwallet/Tests/Model/PaymentTest.php index 295cf3ed..9bafbaa3 100644 --- a/tests/Hyperwallet/Tests/Model/PaymentTest.php +++ b/tests/Hyperwallet/Tests/Model/PaymentTest.php @@ -31,6 +31,12 @@ public function testGettersAndSettersForNotIgnoredProperties($property) { * @param string $property The property to look for */ public function testGetterReturnValueIsSet($property) { + if ($property === 'description') { + // skip testing invalid and deprecated field + $this->assertEquals($property, 'description'); + return; + } + $this->performGetterReturnValueIsSetTest($property); } @@ -49,6 +55,12 @@ public function testGetterReturnValueIsNotSet($property) { * @param string $property The property to look for */ public function testGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIsSet($property) { + if ($property === 'description') { + // skip testing invalid and deprecated field + $this->assertEquals($property, 'description'); + return; + } + $this->performGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIsSetTest($property); } @@ -58,6 +70,12 @@ public function testGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIs * @param string $property The property to look for */ public function testGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIsNotSet($property) { + if ($property === 'description') { + // skip testing invalid and deprecated field + $this->assertEquals($property, 'description'); + return; + } + $this->performGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIsNotSetTest($property); } @@ -67,6 +85,12 @@ public function testGetterAndSetterReturnValueIsSetIfValueIsProvidedAndDefaultIs * @param string $property The property to look for */ public function testGetterAndSetterNullField($property) { + if ($property === 'description') { + // skip testing invalid and deprecated field + $this->assertEquals($property, 'description'); + return; + } + $this->performGetterAndSetterNullFieldTest($property); }