From d4dc95945825a59119357fec9c21e44cc39c2e3a Mon Sep 17 00:00:00 2001 From: Matt75 <5262628+Matt75@users.noreply.github.com> Date: Fri, 24 Jan 2025 09:20:09 +0100 Subject: [PATCH] WIP PAYSHIP-3135 --- composer.json | 7 +- composer.lock | 4 +- config/command-handlers.yml | 1 + .../CapturePayPalOrderCommandHandler.php | 48 +- .../CapturePayPalOrderCommandHandlerTest.php | 2303 +++++++++++++++++ 5 files changed, 2342 insertions(+), 21 deletions(-) create mode 100644 tests/Unit/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandlerTest.php diff --git a/composer.json b/composer.json index e74f979ec..d0c195976 100755 --- a/composer.json +++ b/composer.json @@ -36,15 +36,16 @@ "webmozart/assert": "^1.0" }, "require-dev": { + "guzzlehttp/guzzle": "~5.0", + "monolog/monolog": "1.25.3", "phpunit/phpunit": "~5.7", "prestashop/php-dev-tools": "~3.0", + "psr/simple-cache": "^1.0", "symfony/cache": "^3.4", "symfony/config": "^3.4", "symfony/dependency-injection": "^3.4", "symfony/finder": "^3.4", - "symfony/options-resolver": "^3.4", - "guzzlehttp/guzzle": "~5.0", - "monolog/monolog": "1.25.3" + "symfony/options-resolver": "^3.4" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index e3282d4a1..952f12fe8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6fbc5eb6ef1880b1652834dd037d2034", + "content-hash": "fb91f5233f2a78212d73647e43cd347d", "packages": [ { "name": "clue/stream-filter", @@ -5390,5 +5390,5 @@ "platform-overrides": { "php": "5.6.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.2.0" } diff --git a/config/command-handlers.yml b/config/command-handlers.yml index e1c3d4c8c..d0d80acf0 100644 --- a/config/command-handlers.yml +++ b/config/command-handlers.yml @@ -61,6 +61,7 @@ services: - '@PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext' - '@PrestaShop\Module\PrestashopCheckout\Repository\PayPalCustomerRepository' - '@PrestaShop\Module\PrestashopCheckout\Repository\PayPalOrderRepository' + - '@PrestaShop\Module\PrestashopCheckout\PayPal\PayPalConfiguration' PrestaShop\Module\PrestashopCheckout\Checkout\CommandHandler\SaveCheckoutCommandHandler: class: 'PrestaShop\Module\PrestashopCheckout\Checkout\CommandHandler\SaveCheckoutCommandHandler' diff --git a/src/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandler.php b/src/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandler.php index b3fade10a..686cf4b0f 100644 --- a/src/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandler.php +++ b/src/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandler.php @@ -21,7 +21,6 @@ namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\CommandHandler; -use Configuration; use PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext; use PrestaShop\Module\PrestashopCheckout\Customer\ValueObject\CustomerId; use PrestaShop\Module\PrestashopCheckout\Event\EventDispatcherInterface; @@ -37,6 +36,7 @@ use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\Event\PayPalCapturePendingEvent; use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\PayPalCaptureStatus; use PrestaShop\Module\PrestashopCheckout\PayPal\PaymentToken\Event\PaymentTokenCreatedEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\PayPalConfiguration; use PrestaShop\Module\PrestashopCheckout\PayPalProcessorResponse; use PrestaShop\Module\PrestashopCheckout\Repository\PayPalCustomerRepository; use PrestaShop\Module\PrestashopCheckout\Repository\PayPalOrderRepository; @@ -70,6 +70,10 @@ class CapturePayPalOrderCommandHandler * @var PayPalOrderRepository */ private $payPalOrderRepository; + /** + * @var PayPalConfiguration + */ + private $payPalConfiguration; public function __construct( MaaslandHttpClient $maaslandHttpClient, @@ -77,7 +81,8 @@ public function __construct( CacheInterface $orderPayPalCache, PrestaShopContext $prestaShopContext, PayPalCustomerRepository $payPalCustomerRepository, - PayPalOrderRepository $payPalOrderRepository + PayPalOrderRepository $payPalOrderRepository, + PayPalConfiguration $payPalConfiguration ) { $this->maaslandHttpClient = $maaslandHttpClient; $this->eventDispatcher = $eventDispatcher; @@ -85,23 +90,12 @@ public function __construct( $this->prestaShopContext = $prestaShopContext; $this->payPalCustomerRepository = $payPalCustomerRepository; $this->payPalOrderRepository = $payPalOrderRepository; + $this->payPalConfiguration = $payPalConfiguration; } public function handle(CapturePayPalOrderCommand $capturePayPalOrderCommand) { - $merchantId = Configuration::get('PS_CHECKOUT_PAYPAL_ID_MERCHANT', null, null, $this->prestaShopContext->getShopId()); - - $payload = [ - 'mode' => $capturePayPalOrderCommand->getFundingSource(), - 'orderId' => $capturePayPalOrderCommand->getOrderId()->getValue(), - 'payee' => ['merchant_id' => $merchantId], - ]; - - $order = $this->payPalOrderRepository->getPayPalOrderById($capturePayPalOrderCommand->getOrderId()); - - if ($order->checkCustomerIntent(PayPalOrder::CUSTOMER_INTENT_USES_VAULTING)) { - $payload['vault'] = true; - } + $payload = $this->createCapturePayload($capturePayPalOrderCommand); $response = $this->maaslandHttpClient->captureOrder($payload); @@ -136,7 +130,7 @@ public function handle(CapturePayPalOrderCommand $capturePayPalOrderCommand) $this->eventDispatcher->dispatch(new PaymentTokenCreatedEvent( $resource, - $merchantId + $this->payPalConfiguration->getMerchantId() )); } } @@ -175,4 +169,26 @@ public function handle(CapturePayPalOrderCommand $capturePayPalOrderCommand) throw new PsCheckoutException('PayPal declined the capture', PsCheckoutException::PAYPAL_PAYMENT_CAPTURE_DECLINED); } } + + /** + * @param CapturePayPalOrderCommand $capturePayPalOrderCommand + * + * @return array + */ + private function createCapturePayload(CapturePayPalOrderCommand $capturePayPalOrderCommand) + { + $payload = [ + 'mode' => $capturePayPalOrderCommand->getFundingSource(), + 'orderId' => $capturePayPalOrderCommand->getOrderId()->getValue(), + 'payee' => ['merchant_id' => $this->payPalConfiguration->getMerchantId()], + ]; + + $order = $this->payPalOrderRepository->getPayPalOrderById($capturePayPalOrderCommand->getOrderId()); + + if ($order->checkCustomerIntent(PayPalOrder::CUSTOMER_INTENT_USES_VAULTING)) { + $payload['vault'] = true; + } + + return $payload; + } } diff --git a/tests/Unit/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandlerTest.php b/tests/Unit/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandlerTest.php new file mode 100644 index 000000000..155277e45 --- /dev/null +++ b/tests/Unit/PayPal/Order/CommandHandler/CapturePayPalOrderCommandHandlerTest.php @@ -0,0 +1,2303 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +namespace Tests\Unit\PayPal\Order\CommandHandler; + +use PHPUnit\Framework\TestCase; +use PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext; +use PrestaShop\Module\PrestashopCheckout\Event\EventDispatcherInterface; +use PrestaShop\Module\PrestashopCheckout\Exception\PsCheckoutException; +use PrestaShop\Module\PrestashopCheckout\Http\MaaslandHttpClient; +use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Command\CapturePayPalOrderCommand; +use PrestaShop\Module\PrestashopCheckout\PayPal\Order\CommandHandler\CapturePayPalOrderCommandHandler; +use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Entity\PayPalOrder; +use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Event\PayPalOrderCompletedEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject\PayPalOrderId; +use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\Event\PayPalCaptureCompletedEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\Event\PayPalCaptureDeclinedEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\Event\PayPalCapturePendingEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\Payment\Capture\PayPalCaptureStatus; +use PrestaShop\Module\PrestashopCheckout\PayPal\PaymentToken\Event\PaymentTokenCreatedEvent; +use PrestaShop\Module\PrestashopCheckout\PayPal\PayPalConfiguration; +use PrestaShop\Module\PrestashopCheckout\Repository\PayPalCustomerRepository; +use PrestaShop\Module\PrestashopCheckout\Repository\PayPalOrderRepository; +use Psr\Http\Message\ResponseInterface; +use Psr\SimpleCache\CacheInterface; + +class CapturePayPalOrderCommandHandlerTest extends TestCase +{ + /** + * @dataProvider completedPayPalOrderProvider + */ + public function testCapturePayPalOrder(array $order) + { + $fundingSource = isset($order['payment_source']) ? key($order['payment_source']) : null; + $customerId = 1; + $customerIdPayPal = isset($order['payment_source'][$fundingSource]['attributes']['vault']['customer']['id']) ? $order['payment_source'][$fundingSource]['attributes']['vault']['customer']['id'] : null; + $merchantId = isset($order['purchase_units'][0]['payee']['merchant_id']) ? $order['purchase_units'][0]['payee']['merchant_id'] : null; + $capture = isset($order['purchase_units'][0]['payments']['captures'][0]) ? $order['purchase_units'][0]['payments']['captures'][0] : null; + + $response = $this->createMock(ResponseInterface::class); + $response->method('getBody')->willReturn(json_encode($order)); + + $maaslandHttpClient = $this->createMock(MaaslandHttpClient::class); + $maaslandHttpClient->method('captureOrder')->willReturn($response); + + $orderPayPalCache = $this->createMock(CacheInterface::class); + $orderPayPalCache->method('get')->willReturn($order); + + $prestaShopContext = $this->createMock(PrestaShopContext::class); + $payPalCustomerRepository = $this->createMock(PayPalCustomerRepository::class); + if (isset($order['payment_source'][$fundingSource]['attributes']['vault'])) { + $prestaShopContext->method('getCustomerId')->willReturn($customerId); + $payPalCustomerRepository->expects($this->once())->method('save')->with($customerId, $customerIdPayPal); + } + + $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $expectedEvents = []; + + if (isset($order['payment_source'][$fundingSource]['attributes']['vault']['id'])) { + $resource = $order['payment_source'][$fundingSource]['attributes']['vault']; + $resource['metadata'] = [ + 'order_id' => $order['id'], + ]; + $paymentSource = $order['payment_source']; + unset($paymentSource[$fundingSource]['attributes']['vault']); + $resource['payment_source'] = $paymentSource; + $resource['payment_source'][$fundingSource]['verification_status'] = $resource['status']; + $expectedEvents[] = [new PaymentTokenCreatedEvent($resource, $merchantId)]; + } + + switch ($order['status']) { + case 'COMPLETED': + $expectedEvents[] = [new PayPalOrderCompletedEvent($order['id'], $order)]; + break; + } + + if (isset($capture['status'])) { + switch ($capture['status']) { + case 'COMPLETED': + $expectedEvents[] = [new PayPalCaptureCompletedEvent($capture['id'], $order['id'], $capture)]; + break; + case 'FAILED': + case 'DECLINED': + $expectedEvents[] = [new PayPalCaptureDeclinedEvent($capture['id'], $order['id'], $capture)]; + break; + case 'PENDING': + $expectedEvents[] = [new PayPalCapturePendingEvent($capture['id'], $order['id'], $capture)]; + break; + } + } + + $eventDispatcher->expects($this->exactly(count($expectedEvents))) + ->method('dispatch') + ->withConsecutive(...$expectedEvents); + + $paypalOrder = $this->createMock(PayPalOrder::class); + $paypalOrder->method('checkCustomerIntent')->willReturn(true); + $payPalOrderRepository = $this->createMock(PayPalOrderRepository::class); + $payPalOrderRepository->expects($this->once())->method('getPayPalOrderById')->with(new PayPalOrderId($order['id']))->willReturn($paypalOrder); + + $payPalConfiguration = $this->createMock(PayPalConfiguration::class); + $payPalConfiguration->method('getMerchantId')->willReturn($merchantId); + + if ( + PayPalCaptureStatus::DECLINED === $capture['status'] + && false === empty($order['payment_source']) + && false === empty($order['payment_source']['card']) + && false === empty($order['processor_response']) + ) { + $this->expectException(PsCheckoutException::class); + $this->expectExceptionCode(PsCheckoutException::PAYPAL_PAYMENT_CARD_ERROR); + } elseif (PayPalCaptureStatus::DECLINED === $capture['status'] || PayPalCaptureStatus::FAILED === $capture['status']) { + $this->expectException(PsCheckoutException::class); + $this->expectExceptionCode(PsCheckoutException::PAYPAL_PAYMENT_CAPTURE_DECLINED); + } + + $commandHandler = new CapturePayPalOrderCommandHandler( + $maaslandHttpClient, + $eventDispatcher, + $orderPayPalCache, + $prestaShopContext, + $payPalCustomerRepository, + $payPalOrderRepository, + $payPalConfiguration + ); + $commandHandler->handle(new CapturePayPalOrderCommand($order['id'], 'paypal')); + } + + public function completedPayPalOrderProvider() + { + return [ + [[ + 'id' => '55P13698XR4360722', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'paypal' => + [ + 'email_address' => 'sb-26qa712980505@personal.example.com', + 'account_id' => 'VRT593XYPLRRJ', + 'account_status' => 'VERIFIED', + 'name' => + [ + 'given_name' => 'John', + 'surname' => 'Doe', + ], + 'address' => + [ + 'address_line_1' => '2211 N First Street', + 'address_line_2' => '17.3.160', + 'admin_area_2' => 'San Jose', + 'admin_area_1' => 'CA', + 'postal_code' => '95131', + 'country_code' => 'US', + ], + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + 'name' => + [ + 'full_name' => 'John Doe', + ], + 'address' => + [ + 'address_line_1' => 'calle Vilamar� 76993- 17469', + 'admin_area_2' => 'Albacete', + 'admin_area_1' => 'Albacete', + 'postal_code' => '02001', + 'country_code' => 'ES', + ], + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '5A6137018G665835P', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/5A6137018G665835P', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/5A6137018G665835P/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/55P13698XR4360722', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:00:17Z', + 'update_time' => '2025-01-23T14:00:17Z', + ], + ], + ], + ], + ], + 'payer' => + [ + 'name' => + [ + 'given_name' => 'John', + 'surname' => 'Doe', + ], + 'email_address' => 'sb-26qa712980505@personal.example.com', + 'payer_id' => 'VRT593XYPLRRJ', + 'address' => + [ + 'address_line_1' => '2211 N First Street', + 'address_line_2' => '17.3.160', + 'admin_area_2' => 'San Jose', + 'admin_area_1' => 'CA', + 'postal_code' => '95131', + 'country_code' => 'US', + ], + ], + 'create_time' => '2025-01-23T08:00:59Z', + 'update_time' => '2025-01-23T14:00:17Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/55P13698XR4360722', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '36T380043W338264T', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'card' => + [ + 'name' => 'aaa vvv', + 'last_digits' => '4424', + 'expiry' => '2025-01', + 'brand' => 'VISA', + 'available_networks' => + [ + 0 => 'VISA', + ], + 'type' => 'DEBIT', + 'authentication_result' => + [ + 'liability_shift' => 'POSSIBLE', + 'three_d_secure' => + [ + 'enrollment_status' => 'Y', + 'authentication_status' => 'Y', + ], + ], + 'attributes' => + [ + 'vault' => + [ + 'id' => '3bk80394dr764533j', + 'status' => 'VAULTED', + 'customer' => + [ + 'id' => 'WTEiJKlLIl', + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v3/vault/payment-tokens/3bk80394dr764533j', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v3/vault/payment-tokens/3bk80394dr764533j', + 'rel' => 'delete', + 'method' => 'DELETE', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/3RJ30031VD593541J', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + ], + ], + 'bin_details' => + [ + 'bin' => '41470443', + 'bin_country_code' => 'FR', + ], + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => '1', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '43.20', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '29.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '8.40', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'tax_total' => + [ + 'currency_code' => 'EUR', + 'value' => '5.80', + ], + ], + ], + 'payee' => + [ + 'merchant_id' => 'U5XK34UWT2AFA', + 'display_data' => + [ + 'brand_name' => 'PrestaShop', + ], + ], + 'payment_instruction' => + [ + 'disbursement_mode' => 'INSTANT', + ], + 'description' => 'Checking out with your cart #21 from PrestaShop', + 'custom_id' => '7b89b49a-fde3-4bdc-a5c2-5549f109a416@1737622652934', + 'invoice_id' => '', + 'soft_descriptor' => 'JOHNDOESTES', + 'items' => + [ + 0 => + [ + 'name' => 'Affiche encadrée The best is yet to come', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '29.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '5.80', + ], + 'quantity' => '1', + 'description' => 'Dimension : 40x60cm', + 'sku' => 'demo_6', + 'category' => 'PHYSICAL_GOODS', + ], + ], + 'shipping' => + [ + 'name' => '***', + 'address' => + [ + 'address_line_1' => '***', + 'address_line_2' => '***', + 'admin_area_2' => 'Paris ', + 'postal_code' => '75002', + 'country_code' => 'FR', + ], + ], + 'supplementary_data' => + [ + 'card' => + [ + 'level_2' => + [ + 'tax_total' => + [ + 'currency_code' => 'EUR', + 'value' => '5.8', + ], + ], + 'level_3' => + [ + 'shipping_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '8.4', + ], + 'duty_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '43.2', + ], + 'discount_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.0', + ], + 'shipping_address' => + [ + 'address_line_1' => '16, Main street', + 'address_line_2' => '2nd floor', + 'admin_area_2' => 'Paris ', + 'postal_code' => '75002', + 'country_code' => 'FR', + ], + 'line_items' => + [ + 0 => + [ + 'name' => 'Affiche encadrée The best is yet to come', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '29.0', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '5.8', + ], + 'quantity' => '1', + 'description' => 'Dimension : 40x60cm', + ], + ], + ], + ], + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '3C96669316429034D', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '43.20', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'NOT_ELIGIBLE', + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '43.20', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '43.20', + ], + ], + 'custom_id' => '7b89b49a-fde3-4bdc-a5c2-5549f109a416@1737622652934', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/3C96669316429034D', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/3C96669316429034D/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/36T380043W338264T', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T08:57:45Z', + 'update_time' => '2025-01-23T08:57:45Z', + 'network_transaction_reference' => + [ + 'id' => '133455343573488', + 'network' => 'VISA', + ], + 'processor_response' => + [ + 'avs_code' => 'Y', + 'cvv_code' => 'S', + 'response_code' => '0000', + ], + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:57:33Z', + 'update_time' => '2025-01-23T08:57:45Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/36T380043W338264T', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '2PT567357H024701J', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'bancontact' => + [ + 'name' => 'John Doe', + 'country_code' => 'BE', + 'bic' => 'ABNANL2A', + 'iban_last_chars' => '9344', + ], + ], + 'processing_instruction' => 'ORDER_COMPLETE_ON_PAYMENT_APPROVAL', + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '34F772786F853570N', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/34F772786F853570N', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/34F772786F853570N/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2PT567357H024701J', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T08:06:45Z', + 'update_time' => '2025-01-23T08:06:45Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:06:20Z', + 'update_time' => '2025-01-23T08:06:45Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2PT567357H024701J', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '4XH97325YE9580105', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'blik' => + [ + 'name' => 'John Doe', + 'country_code' => 'PL', + 'email' => 'buyer@example.com', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'PLN', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'PLN', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'PLN', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'PLN', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'PLN', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '8N0189488V5987948', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'PLN', + 'value' => '6.88', + ], + 'net_amount' => + [ + 'currency_code' => 'PLN', + 'value' => '93.12', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/8N0189488V5987948', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/8N0189488V5987948/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4XH97325YE9580105', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:06:01Z', + 'update_time' => '2025-01-23T14:06:01Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:12:31Z', + 'update_time' => '2025-01-23T14:06:01Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4XH97325YE9580105', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '2RS70921X6989840S', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'eps' => + [ + 'name' => 'John Doe', + 'country_code' => 'AT', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '78954334YX5974519', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/78954334YX5974519', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/78954334YX5974519/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2RS70921X6989840S', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:06:51Z', + 'update_time' => '2025-01-23T14:06:51Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:13:44Z', + 'update_time' => '2025-01-23T14:06:51Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2RS70921X6989840S', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '29L95026GT2940426', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'ideal' => + [ + 'name' => 'John Doe', + 'country_code' => 'NL', + 'bic' => 'INGBNL2A', + 'iban_last_chars' => '9874', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '55U675180K6907839', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/55U675180K6907839', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/55U675180K6907839/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/29L95026GT2940426', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:07:52Z', + 'update_time' => '2025-01-23T14:07:52Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:14:50Z', + 'update_time' => '2025-01-23T14:07:52Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/29L95026GT2940426', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '4T58422450971401N', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'mybank' => + [ + 'name' => 'John Doe', + 'country_code' => 'IT', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '3VU305076K330470D', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/3VU305076K330470D', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/3VU305076K330470D/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4T58422450971401N', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:12:06Z', + 'update_time' => '2025-01-23T14:12:06Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:15:39Z', + 'update_time' => '2025-01-23T14:12:06Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4T58422450971401N', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]], + [[ + 'id' => '2XB29141AM710800Y', + 'intent' => 'CAPTURE', + 'status' => 'COMPLETED', + 'payment_source' => + [ + 'p24' => + [ + 'name' => 'John Doe', + 'email' => 'john.doe@example.com', + 'country_code' => 'PL', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'shipping' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'handling' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'insurance' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'shipping_discount' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'description' => 'T-Shirt', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'tax' => + [ + 'currency_code' => 'EUR', + 'value' => '0.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + ], + 'payments' => + [ + 'captures' => + [ + 0 => + [ + 'id' => '2CR16480LT4151742', + 'status' => 'COMPLETED', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'final_capture' => true, + 'disbursement_mode' => 'INSTANT', + 'seller_protection' => + [ + 'status' => 'ELIGIBLE', + 'dispute_categories' => + [ + 0 => 'ITEM_NOT_RECEIVED', + 1 => 'UNAUTHORIZED_TRANSACTION', + ], + ], + 'seller_receivable_breakdown' => + [ + 'gross_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'paypal_fee' => + [ + 'currency_code' => 'EUR', + 'value' => '5.38', + ], + 'net_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '94.62', + ], + ], + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/2CR16480LT4151742', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/payments/captures/2CR16480LT4151742/refund', + 'rel' => 'refund', + 'method' => 'POST', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2XB29141AM710800Y', + 'rel' => 'up', + 'method' => 'GET', + ], + ], + 'create_time' => '2025-01-23T14:13:14Z', + 'update_time' => '2025-01-23T14:13:14Z', + ], + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:16:24Z', + 'update_time' => '2025-01-23T14:13:14Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2XB29141AM710800Y', + 'rel' => 'self', + 'method' => 'GET', + ], + ], + ]] + ]; + } + + public function approvedPayPalOrderProvider() + { + return [ + '55P13698XR4360722' => [ + 'id' => '55P13698XR4360722', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'paypal' => + [ + 'email_address' => 'sb-26qa712980505@personal.example.com', + 'account_id' => 'VRT593XYPLRRJ', + 'account_status' => 'VERIFIED', + 'name' => + [ + 'given_name' => 'John', + 'surname' => 'Doe', + ], + 'address' => + [ + 'address_line_1' => '2211 N First Street', + 'address_line_2' => '17.3.160', + 'admin_area_2' => 'San Jose', + 'admin_area_1' => 'CA', + 'postal_code' => '95131', + 'country_code' => 'US', + ], + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + 'name' => + [ + 'full_name' => 'John Doe', + ], + 'address' => + [ + 'address_line_1' => 'calle Vilamar� 76993- 17469', + 'admin_area_2' => 'Albacete', + 'admin_area_1' => 'Albacete', + 'postal_code' => '02001', + 'country_code' => 'ES', + ], + ], + ], + ], + 'payer' => + [ + 'name' => + [ + 'given_name' => 'John', + 'surname' => 'Doe', + ], + 'email_address' => 'sb-26qa712980505@personal.example.com', + 'payer_id' => 'VRT593XYPLRRJ', + 'address' => + [ + 'address_line_1' => '2211 N First Street', + 'address_line_2' => '17.3.160', + 'admin_area_2' => 'San Jose', + 'admin_area_1' => 'CA', + 'postal_code' => '95131', + 'country_code' => 'US', + ], + ], + 'create_time' => '2025-01-23T08:00:59Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/55P13698XR4360722', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/55P13698XR4360722', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/55P13698XR4360722/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '36T380043W338264T' => [ + 'id' => '36T380043W338264T', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'card' => + [ + 'name' => 'John Doe', + 'last_digits' => '4424', + 'expiry' => '2025-01', + 'brand' => 'VISA', + 'available_networks' => + [ + 0 => 'VISA', + ], + 'type' => 'DEBIT', + 'authentication_result' => + [ + 'liability_shift' => 'POSSIBLE', + 'three_d_secure' => + [ + 'enrollment_status' => 'Y', + 'authentication_status' => 'Y', + ], + ], + 'bin_details' => + [ + 'bin' => '41470443', + 'bin_country_code' => 'FR', + ], + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + 'shipping' => + [ + 'name' => + [ + 'full_name' => 'John Doe', + ], + 'address' => + [ + 'address_line_1' => 'calle Vilamar� 76993- 17469', + 'admin_area_2' => 'Albacete', + 'admin_area_1' => 'Albacete', + 'postal_code' => '02001', + 'country_code' => 'ES', + ], + ], + ], + ], + 'payer' => + [ + 'name' => + [ + 'given_name' => 'John', + 'surname' => 'Doe', + ], + 'email_address' => 'sb-26qa712980505@personal.example.com', + 'payer_id' => 'VRT593XYPLRRJ', + 'address' => + [ + 'address_line_1' => '2211 N First Street', + 'address_line_2' => '17.3.160', + 'admin_area_2' => 'San Jose', + 'admin_area_1' => 'CA', + 'postal_code' => '95131', + 'country_code' => 'US', + ], + ], + 'create_time' => '2025-01-23T08:02:36Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/36T380043W338264T', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/36T380043W338264T', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/36T380043W338264T/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '2PT567357H024701J' => [ + 'id' => '2PT567357H024701J', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'bancontact' => + [ + 'name' => 'John Doe', + 'country_code' => 'BE', + 'bic' => 'ABNANL2A', + 'iban_last_chars' => '9344', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:06:20Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2PT567357H024701J', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2PT567357H024701J', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2PT567357H024701J/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '4XH97325YE9580105' => [ + 'id' => '4XH97325YE9580105', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'blik' => + [ + 'name' => 'John Doe', + 'country_code' => 'PL', + 'email' => 'buyer@example.com', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'PLN', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:12:31Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4XH97325YE9580105', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4XH97325YE9580105', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4XH97325YE9580105/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '2RS70921X6989840S' => [ + 'id' => '2RS70921X6989840S', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'eps' => + [ + 'name' => 'John Doe', + 'country_code' => 'AT', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:13:44Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2RS70921X6989840S', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2RS70921X6989840S', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2RS70921X6989840S/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '29L95026GT2940426' => [ + 'id' => '29L95026GT2940426', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'ideal' => + [ + 'name' => 'John Doe', + 'country_code' => 'NL', + 'bic' => 'INGBNL2A', + 'iban_last_chars' => '9874', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:14:50Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/29L95026GT2940426', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/29L95026GT2940426', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/29L95026GT2940426/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '4T58422450971401N' => [ + 'id' => '4T58422450971401N', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'mybank' => + [ + 'name' => 'John Doe', + 'country_code' => 'IT', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:15:39Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4T58422450971401N', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4T58422450971401N', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/4T58422450971401N/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ], + '2XB29141AM710800Y' => [ + 'id' => '2XB29141AM710800Y', + 'intent' => 'CAPTURE', + 'status' => 'APPROVED', + 'payment_source' => + [ + 'p24' => + [ + 'name' => 'John Doe', + 'email' => 'john.doe@example.com', + 'country_code' => 'PL', + ], + ], + 'purchase_units' => + [ + 0 => + [ + 'reference_id' => 'default', + 'amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + 'breakdown' => + [ + 'item_total' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + ], + ], + 'payee' => + [ + 'email_address' => 'sb-vshwm21975461@business.example.com', + 'merchant_id' => 'F36Z4TNY9ZQE6', + ], + 'soft_descriptor' => 'TEST STORE', + 'items' => + [ + 0 => + [ + 'name' => 'T-Shirt', + 'unit_amount' => + [ + 'currency_code' => 'EUR', + 'value' => '100.00', + ], + 'quantity' => '1', + 'description' => 'Green XL', + ], + ], + ], + ], + 'create_time' => '2025-01-23T08:16:24Z', + 'links' => + [ + 0 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2XB29141AM710800Y', + 'rel' => 'self', + 'method' => 'GET', + ], + 1 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2XB29141AM710800Y', + 'rel' => 'update', + 'method' => 'PATCH', + ], + 2 => + [ + 'href' => 'https://api.sandbox.paypal.com/v2/checkout/orders/2XB29141AM710800Y/capture', + 'rel' => 'capture', + 'method' => 'POST', + ], + ], + ] + ]; + } +}