| @@ 5-61 (lines=57) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait CurrenciesTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var Currency[] |
|
| 9 | */ |
|
| 10 | protected $currencies; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return Currency[] |
|
| 14 | */ |
|
| 15 | public function getCurrencies(): array |
|
| 16 | { |
|
| 17 | $this->initializeCurrencies(); |
|
| 18 | ||
| 19 | return $this->currencies; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $currencies |
|
| 24 | */ |
|
| 25 | public function setCurrencies(array $currencies) |
|
| 26 | { |
|
| 27 | $this->currencies = $currencies; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Currency $currency |
|
| 32 | */ |
|
| 33 | public function addCurrency(Currency $currency) |
|
| 34 | { |
|
| 35 | $this->initializeCurrencies(); |
|
| 36 | ||
| 37 | $this->currencies[] = $currency; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydrateCurrencies(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->Currencies) || !isset($xml->Currencies->Currency) || empty($xml->Currencies->Currency)) { |
|
| 43 | return; |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->initializeCurrencies(); |
|
| 47 | ||
| 48 | foreach ($xml->Currencies->Currency as $currencyXml) { |
|
| 49 | $currency = new Currency(); |
|
| 50 | $currency->hydrateXml($currencyXml); |
|
| 51 | $this->currencies[] = $currency; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | private function initializeCurrencies() |
|
| 56 | { |
|
| 57 | if (is_null($this->currencies)) { |
|
| 58 | $this->currencies = []; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 5-61 (lines=57) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait NaturesTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var Nature[] |
|
| 9 | */ |
|
| 10 | protected $natures; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return Nature[] |
|
| 14 | */ |
|
| 15 | public function getNatures(): array |
|
| 16 | { |
|
| 17 | $this->initializeNatures(); |
|
| 18 | ||
| 19 | return $this->natures; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $natures |
|
| 24 | */ |
|
| 25 | public function setNatures(array $natures) |
|
| 26 | { |
|
| 27 | $this->natures = $natures; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Nature $nature |
|
| 32 | */ |
|
| 33 | public function addNature(Nature $nature) |
|
| 34 | { |
|
| 35 | $this->initializeNatures(); |
|
| 36 | ||
| 37 | $this->natures[] = $nature; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydrateNatures(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->Natures) || !isset($xml->Natures->Nature) || empty($xml->Natures->Nature)) { |
|
| 43 | return; |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->initializeNatures(); |
|
| 47 | ||
| 48 | foreach ($xml->Natures->Nature as $currencyXml) { |
|
| 49 | $nature = new Nature(); |
|
| 50 | $nature->hydrateXml($currencyXml); |
|
| 51 | $this->natures[] = $nature; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | private function initializeNatures() |
|
| 56 | { |
|
| 57 | if (is_null($this->natures)) { |
|
| 58 | $this->natures = []; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 5-61 (lines=57) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait PaymentInfosTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var PaymentInfo[] |
|
| 9 | */ |
|
| 10 | protected $paymentInfos; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return PaymentInfo[] |
|
| 14 | */ |
|
| 15 | public function getPaymentInfos(): array |
|
| 16 | { |
|
| 17 | $this->initializePaymentInfos(); |
|
| 18 | ||
| 19 | return $this->paymentInfos; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $paymentInfos |
|
| 24 | */ |
|
| 25 | public function setPaymentInfos(array $paymentInfos) |
|
| 26 | { |
|
| 27 | $this->paymentInfos = $paymentInfos; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param PaymentInfo $paymentInfo |
|
| 32 | */ |
|
| 33 | public function addPaymentInfo(PaymentInfo $paymentInfo) |
|
| 34 | { |
|
| 35 | $this->initializePaymentInfos(); |
|
| 36 | ||
| 37 | $this->paymentInfos[] = $paymentInfo; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydratePaymentInfos(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->PaymentInfos) || !isset($xml->PaymentInfos->PaymentInfo) || empty($xml->PaymentInfos->PaymentInfo)) { |
|
| 43 | return; |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->initializePaymentInfos(); |
|
| 47 | ||
| 48 | foreach ($xml->PaymentInfos->PaymentInfo as $paymentInfoXml) { |
|
| 49 | $paymentInfo = new PaymentInfo(); |
|
| 50 | $paymentInfo->hydrateXml($paymentInfoXml); |
|
| 51 | $this->paymentInfos[] = $paymentInfo; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | private function initializePaymentInfos() |
|
| 56 | { |
|
| 57 | if (is_null($this->paymentInfos)) { |
|
| 58 | $this->paymentInfos = []; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 5-62 (lines=58) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait ReconciliationIdentifiersTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var ReconciliationIdentifier[] |
|
| 9 | */ |
|
| 10 | protected $reconciliationIdentifiers; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return ReconciliationIdentifier[] |
|
| 14 | */ |
|
| 15 | public function getReconciliationIdentifiers(): array |
|
| 16 | { |
|
| 17 | $this->initializeReconciliationIdentifiers(); |
|
| 18 | ||
| 19 | return $this->reconciliationIdentifiers; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $reconciliationIdentifiers |
|
| 24 | */ |
|
| 25 | public function setReconciliationIdentifiers(array $reconciliationIdentifiers) |
|
| 26 | { |
|
| 27 | $this->reconciliationIdentifiers = $reconciliationIdentifiers; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param ReconciliationIdentifier $reconciliationIdentifier |
|
| 32 | */ |
|
| 33 | public function addReconciliationIdentifier(ReconciliationIdentifier $reconciliationIdentifier) |
|
| 34 | { |
|
| 35 | $this->initializeReconciliationIdentifiers(); |
|
| 36 | ||
| 37 | $this->reconciliationIdentifiers[] = $reconciliationIdentifier; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydrateReconciliationIdentifiers(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->ReconciliationIdentifiers) || !isset($xml->ReconciliationIdentifiers->ReconciliationIdentifier) |
|
| 43 | || empty($xml->ReconciliationIdentifiers->ReconciliationIdentifier)) { |
|
| 44 | return; |
|
| 45 | } |
|
| 46 | ||
| 47 | $this->initializeReconciliationIdentifiers(); |
|
| 48 | ||
| 49 | foreach ($xml->ReconciliationIdentifiers->ReconciliationIdentifier as $reconciliationIdentifierXml) { |
|
| 50 | $reconciliationIdentifier = new ReconciliationIdentifier(); |
|
| 51 | $reconciliationIdentifier->hydrateXml($reconciliationIdentifierXml); |
|
| 52 | $this->reconciliationIdentifiers[] = $reconciliationIdentifier; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| 56 | private function initializeReconciliationIdentifiers() |
|
| 57 | { |
|
| 58 | if (is_null($this->reconciliationIdentifiers)) { |
|
| 59 | $this->reconciliationIdentifiers = []; |
|
| 60 | } |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 5-61 (lines=57) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait TerminalsTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var Terminal[] |
|
| 9 | */ |
|
| 10 | protected $terminals; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return Terminal[] |
|
| 14 | */ |
|
| 15 | public function getTerminals(): array |
|
| 16 | { |
|
| 17 | $this->initializeTerminals(); |
|
| 18 | ||
| 19 | return $this->terminals; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $terminals |
|
| 24 | */ |
|
| 25 | public function setTerminals(array $terminals) |
|
| 26 | { |
|
| 27 | $this->terminals = $terminals; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Terminal $terminal |
|
| 32 | */ |
|
| 33 | public function addTerminal(Terminal $terminal) |
|
| 34 | { |
|
| 35 | $this->initializeTerminals(); |
|
| 36 | ||
| 37 | $this->terminals[] = $terminal; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydrateTerminals(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->Terminals) || !isset($xml->Terminals->Terminal) || empty($xml->Terminals->Terminal)) { |
|
| 43 | return; |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->initializeTerminals(); |
|
| 47 | ||
| 48 | foreach ($xml->Terminals->Terminal as $terminalXml) { |
|
| 49 | $terminal = new Terminal(); |
|
| 50 | $terminal->hydrateXml($terminalXml); |
|
| 51 | $this->terminals[] = $terminal; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | private function initializeTerminals() |
|
| 56 | { |
|
| 57 | if (is_null($this->terminals)) { |
|
| 58 | $this->terminals = []; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 5-61 (lines=57) @@ | ||
| 2 | ||
| 3 | namespace Loevgaard\AltaPay\Entity; |
|
| 4 | ||
| 5 | trait TransactionsTrait |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var Transaction[] |
|
| 9 | */ |
|
| 10 | protected $transactions; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @return Transaction[] |
|
| 14 | */ |
|
| 15 | public function getTransactions(): array |
|
| 16 | { |
|
| 17 | $this->initializeTransactions(); |
|
| 18 | ||
| 19 | return $this->transactions; |
|
| 20 | } |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @param array $transactions |
|
| 24 | */ |
|
| 25 | public function setTransactions(array $transactions) |
|
| 26 | { |
|
| 27 | $this->transactions = $transactions; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Transaction $transaction |
|
| 32 | */ |
|
| 33 | public function addTerminal(Transaction $transaction) |
|
| 34 | { |
|
| 35 | $this->initializeTransactions(); |
|
| 36 | ||
| 37 | $this->transactions[] = $transaction; |
|
| 38 | } |
|
| 39 | ||
| 40 | public function hydrateTransactions(\SimpleXMLElement $xml) |
|
| 41 | { |
|
| 42 | if (!isset($xml->Transactions) || !isset($xml->Transactions->Transaction) || empty($xml->Transactions->Transaction)) { |
|
| 43 | return; |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->initializeTransactions(); |
|
| 47 | ||
| 48 | foreach ($xml->Transactions->Transaction as $transactionXml) { |
|
| 49 | $transaction = new Transaction(); |
|
| 50 | $transaction->hydrateXml($transactionXml); |
|
| 51 | $this->transactions[] = $transaction; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | private function initializeTransactions() |
|
| 56 | { |
|
| 57 | if (is_null($this->transactions)) { |
|
| 58 | $this->transactions = []; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||