Skip to content

Commit

Permalink
Add amount to UpdatePaymentDetailsResponse
Browse files Browse the repository at this point in the history
CS-6098
  • Loading branch information
MarijaIv committed Nov 19, 2024
1 parent fd53fc7 commit 023c9b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/BusinessLogic/AdyenAPI/Checkout/Payments/Http/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Adyen\Core\BusinessLogic\AdyenAPI\Checkout\Payments\Requests\PayPalUpdateOrderHttpRequest;
use Adyen\Core\BusinessLogic\AdyenAPI\Checkout\Payments\Requests\UpdatePaymentDetailsHttpRequest;
use Adyen\Core\BusinessLogic\AdyenAPI\Http\Authorized\AuthorizedProxy;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Exceptions\InvalidCurrencyCode;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Models\Amount\Amount;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Models\Amount\Currency;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Models\AvailablePaymentMethodsResponse;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Models\PaymentMethodCode;
use Adyen\Core\BusinessLogic\Domain\Checkout\PaymentRequest\Models\PaymentMethodResponse;
Expand Down Expand Up @@ -55,6 +58,7 @@ public function startPaymentTransaction(PaymentRequest $request): StartTransacti
* @return UpdatePaymentDetailsResult
*
* @throws HttpRequestException
* @throws InvalidCurrencyCode
*/
public function updatePaymentDetails(UpdatePaymentDetailsRequest $request): UpdatePaymentDetailsResult
{
Expand All @@ -65,7 +69,10 @@ public function updatePaymentDetails(UpdatePaymentDetailsRequest $request): Upda
$response['pspReference'] ?? null,
$response['donationToken'] ?? '',
$response['merchantReference'] ?? '',
$response['paymentMethod']['type'] ?? ''
$response['paymentMethod']['type'] ?? '',
isset($response['amount']) ?
Amount::fromInt($response['amount']['value'], Currency::fromIsoCode($response['amount']['currency'])) :
null
);
}

Expand Down Expand Up @@ -113,7 +120,7 @@ public function paypalUpdateOrder(PayPalUpdateOrderRequest $request): PayPalUpda
*/
private function transformPaymentMethodsResponse(array $response): array
{
return array_map(static function(array $method) {
return array_map(static function (array $method) {
$type = $method['type'] ?? '';
$brand = $method['brand'] ?? '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __construct(
$this->donationToken = $donationToken;
$this->merchantReference = $merchantReference;
$this->paymentMethod = $paymentMethod;
$this->amount = $amount;
}

/**
Expand Down

0 comments on commit 023c9b9

Please sign in to comment.