Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions examples/three-step-tutorial.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
->setClientPaymentId(uniqid('psdk-'))
->setCurrency('USD')
->setAmount('50.25')
->setNotes("Payment")
->setPurpose('OTHER');
try {
$payment = $hyperwallet->createPayment($payment);
Expand Down
31 changes: 27 additions & 4 deletions src/Hyperwallet/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
24 changes: 24 additions & 0 deletions tests/Hyperwallet/Tests/Model/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
Loading