-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transaction allocations to credit memo (#571)
* Add transaction allocations to credit memo * Remove getCreditMemoId * Remove useless getters and setters * Update changelog * Add factory methods for creating instances * Check if item is already an object * Remove incorrect typehint
- Loading branch information
Boyd Bueno de Mesquita
committed
Oct 10, 2022
1 parent
6cd1f9b
commit f3265ed
Showing
5 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* This source file is proprietary and part of Rebilly. | ||
* | ||
* (c) Rebilly SRL | ||
* Rebilly Ltd. | ||
* Rebilly Inc. | ||
* | ||
* @see https://www.rebilly.com | ||
*/ | ||
|
||
namespace Rebilly\Entities; | ||
|
||
use Rebilly\Rest\Entity; | ||
|
||
/** | ||
* Class AllocationCollection. | ||
*/ | ||
final class AllocationCollection extends Entity | ||
{ | ||
/** | ||
* @param array $data | ||
* | ||
* @return AllocationCollection | ||
*/ | ||
public static function createFromData(array $data) | ||
{ | ||
return new self($data); | ||
} | ||
|
||
/** | ||
* @return TransactionAllocation[] | ||
*/ | ||
public function getTransactions() | ||
{ | ||
return $this->getAttribute('transactions'); | ||
} | ||
|
||
/** | ||
* @param TransactionAllocation[] $value | ||
* | ||
* @return $this | ||
*/ | ||
public function setTransactions($value) | ||
{ | ||
return $this->setAttribute('transactions', $value); | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return array|TransactionAllocation[] | ||
*/ | ||
public function createTransactions(array $data) | ||
{ | ||
return array_map(function ($item) { | ||
if ($item instanceof TransactionAllocation) { | ||
return $item; | ||
} | ||
|
||
return new TransactionAllocation($item); | ||
}, $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* This source file is proprietary and part of Rebilly. | ||
* | ||
* (c) Rebilly SRL | ||
* Rebilly Ltd. | ||
* Rebilly Inc. | ||
* | ||
* @see https://www.rebilly.com | ||
*/ | ||
|
||
namespace Rebilly\Entities; | ||
|
||
use Rebilly\Rest\Entity; | ||
|
||
/** | ||
* Class TransactionAllocation. | ||
*/ | ||
final class TransactionAllocation extends Entity | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getTransactionId() | ||
{ | ||
return $this->getAttribute('transactionId'); | ||
} | ||
|
||
/** | ||
* @param string | ||
* | ||
* @return $this | ||
*/ | ||
public function setTransactionId($value) | ||
{ | ||
return $this->setAttribute('transactionId', $value); | ||
} | ||
|
||
/** | ||
* @return float | ||
*/ | ||
public function getAmount() | ||
{ | ||
return $this->getAttribute('amount'); | ||
} | ||
|
||
/** | ||
* @param float $value | ||
* | ||
* @return $this | ||
*/ | ||
public function setAmount($value) | ||
{ | ||
return $this->setAttribute('amount', $value); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCurrency() | ||
{ | ||
return $this->getAttribute('currency'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCreatedTime() | ||
{ | ||
return $this->getAttribute('createdTime'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUpdatedTime() | ||
{ | ||
return $this->getAttribute('updatedTime'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters