From 8df97a29cac82fab3020ae72603c720962bfe855 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:31:44 +0200 Subject: [PATCH 01/12] chore: remove unused SumUp ecommerce SDK --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 577affa..266e51b 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,7 @@ }, "require": { "php": ">=7.4", - "ext-json": "*", - "sumup/sumup-ecom-php-sdk": "^1.2.0" + "ext-json": "*" }, "config": { "platform": { From 05d1e2c6d04cac7aad778c7d318d3688442ada02 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:32:51 +0200 Subject: [PATCH 02/12] build: add prefixed SumUp PHP SDK --- composer.json | 118 ++-- php-scoper/composer.json | 15 + php-scoper/scoper.inc.php | 15 + tools/generate-prefixed-sumup-autoload.php | 71 +++ vendor_prefixed/sumup-sdk-autoload.php | 27 + vendor_prefixed/sumup-sdk/ApiVersion.php | 10 + .../sumup-sdk/Checkouts/Checkouts.php | 428 +++++++++++++++ .../sumup-sdk/Customers/Customers.php | 245 +++++++++ .../sumup-sdk/Exception/ApiException.php | 42 ++ .../sumup-sdk/Exception/ArgumentException.php | 12 + .../Exception/ConfigurationException.php | 12 + .../Exception/ConnectionException.php | 12 + .../sumup-sdk/Exception/ErrorEnvelope.php | 67 +++ .../sumup-sdk/Exception/SDKException.php | 63 +++ .../Exception/UnexpectedApiException.php | 84 +++ .../sumup-sdk/ExceptionMessages.php | 23 + .../sumup-sdk/HttpClient/CurlClient.php | 293 ++++++++++ .../sumup-sdk/HttpClient/GuzzleClient.php | 181 +++++++ .../HttpClient/HttpClientInterface.php | 22 + .../sumup-sdk/HttpClient/RequestHeaders.php | 36 ++ .../sumup-sdk/HttpClient/RequestOptions.php | 61 +++ .../sumup-sdk/HttpClient/Response.php | 101 ++++ vendor_prefixed/sumup-sdk/Hydrator.php | 329 ++++++++++++ vendor_prefixed/sumup-sdk/Members/Members.php | 505 ++++++++++++++++++ .../sumup-sdk/Memberships/Memberships.php | 210 ++++++++ .../sumup-sdk/Merchants/Merchants.php | 211 ++++++++ vendor_prefixed/sumup-sdk/Payouts/Payouts.php | 147 +++++ vendor_prefixed/sumup-sdk/Readers/Readers.php | 450 ++++++++++++++++ .../sumup-sdk/Receipts/Receipts.php | 114 ++++ vendor_prefixed/sumup-sdk/RequestEncoder.php | 82 +++ vendor_prefixed/sumup-sdk/ResponseDecoder.php | 258 +++++++++ vendor_prefixed/sumup-sdk/Roles/Roles.php | 348 ++++++++++++ vendor_prefixed/sumup-sdk/SdkInfo.php | 100 ++++ .../sumup-sdk/Services/SumUpService.php | 12 + vendor_prefixed/sumup-sdk/Shared/Shared.php | 445 +++++++++++++++ vendor_prefixed/sumup-sdk/SumUp.php | 281 ++++++++++ .../sumup-sdk/Transactions/Transactions.php | 419 +++++++++++++++ vendor_prefixed/sumup-sdk/Types/Address.php | 131 +++++ .../sumup-sdk/Types/AddressLegacy.php | 54 ++ .../sumup-sdk/Types/BadRequest.php | 18 + .../sumup-sdk/Types/BadRequestErrors.php | 23 + .../sumup-sdk/Types/BadRequestErrorsType.php | 16 + .../sumup-sdk/Types/BasePerson.php | 126 +++++ vendor_prefixed/sumup-sdk/Types/Branding.php | 68 +++ .../sumup-sdk/Types/BusinessProfile.php | 64 +++ vendor_prefixed/sumup-sdk/Types/Card.php | 61 +++ .../sumup-sdk/Types/CardExpiryMonth.php | 24 + .../sumup-sdk/Types/CardResponse.php | 26 + .../sumup-sdk/Types/CardResponseType.php | 36 ++ vendor_prefixed/sumup-sdk/Types/CardType.php | 36 ++ vendor_prefixed/sumup-sdk/Types/Checkout.php | 110 ++++ .../sumup-sdk/Types/CheckoutAccepted.php | 19 + .../Types/CheckoutAcceptedNextStep.php | 47 ++ .../sumup-sdk/Types/CheckoutCreateRequest.php | 165 ++++++ .../Types/CheckoutCreateRequestCurrency.php | 28 + .../Types/CheckoutCreateRequestPurpose.php | 14 + .../sumup-sdk/Types/CheckoutCurrency.php | 28 + .../sumup-sdk/Types/CheckoutStatus.php | 16 + .../sumup-sdk/Types/CheckoutSuccess.php | 145 +++++ .../CheckoutSuccessPaymentInstrument.php | 19 + .../Types/ClassicMerchantIdentifiers.php | 16 + vendor_prefixed/sumup-sdk/Types/Company.php | 78 +++ .../sumup-sdk/Types/CompanyIdentifier.php | 23 + .../Types/CreateReaderCheckoutError.php | 18 + .../Types/CreateReaderCheckoutErrorErrors.php | 23 + .../Types/CreateReaderCheckoutRequest.php | 157 ++++++ .../Types/CreateReaderCheckoutRequestAade.php | 35 ++ .../CreateReaderCheckoutRequestAffiliate.php | 47 ++ .../CreateReaderCheckoutRequestCardType.php | 16 + ...CreateReaderCheckoutRequestTotalAmount.php | 39 ++ .../Types/CreateReaderCheckoutResponse.php | 15 + .../CreateReaderCheckoutResponseData.php | 17 + ...reateReaderCheckoutUnprocessableEntity.php | 18 + .../Types/CreateReaderTerminateError.php | 18 + .../CreateReaderTerminateErrorErrors.php | 23 + ...eateReaderTerminateUnprocessableEntity.php | 18 + vendor_prefixed/sumup-sdk/Types/Customer.php | 72 +++ .../sumup-sdk/Types/DetailsError.php | 40 ++ vendor_prefixed/sumup-sdk/Types/Device.php | 47 ++ .../sumup-sdk/Types/ElvCardAccount.php | 40 ++ vendor_prefixed/sumup-sdk/Types/Error.php | 26 + .../sumup-sdk/Types/ErrorExtended.php | 33 ++ .../sumup-sdk/Types/ErrorForbidden.php | 33 ++ vendor_prefixed/sumup-sdk/Types/Event.php | 90 ++++ .../sumup-sdk/Types/EventStatus.php | 29 + vendor_prefixed/sumup-sdk/Types/EventType.php | 16 + .../sumup-sdk/Types/FinancialPayout.php | 79 +++ .../sumup-sdk/Types/FinancialPayoutStatus.php | 14 + .../sumup-sdk/Types/FinancialPayoutType.php | 17 + .../sumup-sdk/Types/HostedCheckout.php | 19 + vendor_prefixed/sumup-sdk/Types/Invite.php | 25 + vendor_prefixed/sumup-sdk/Types/Link.php | 47 ++ .../Types/ListPersonsResponseBody.php | 15 + .../sumup-sdk/Types/MandatePayload.php | 33 ++ .../sumup-sdk/Types/MandatePayloadType.php | 13 + .../sumup-sdk/Types/MandateResponse.php | 33 ++ .../sumup-sdk/Types/MandateResponseStatus.php | 14 + vendor_prefixed/sumup-sdk/Types/Member.php | 82 +++ .../sumup-sdk/Types/MemberStatus.php | 17 + .../sumup-sdk/Types/Membership.php | 99 ++++ .../sumup-sdk/Types/MembershipResource.php | 64 +++ .../sumup-sdk/Types/MembershipStatus.php | 17 + .../sumup-sdk/Types/MembershipUser.php | 75 +++ .../sumup-sdk/Types/MembershipUserClassic.php | 18 + vendor_prefixed/sumup-sdk/Types/Merchant.php | 135 +++++ vendor_prefixed/sumup-sdk/Types/NotFound.php | 18 + .../sumup-sdk/Types/NotFoundErrors.php | 16 + vendor_prefixed/sumup-sdk/Types/Ownership.php | 16 + .../Types/PaymentInstrumentResponse.php | 54 ++ .../Types/PaymentInstrumentResponseCard.php | 26 + .../PaymentInstrumentResponseCardType.php | 36 ++ .../Types/PaymentInstrumentResponseType.php | 13 + vendor_prefixed/sumup-sdk/Types/Person.php | 122 +++++ .../sumup-sdk/Types/PersonalDetails.php | 61 +++ .../sumup-sdk/Types/PersonalIdentifier.php | 23 + vendor_prefixed/sumup-sdk/Types/Problem.php | 49 ++ .../sumup-sdk/Types/ProcessCheckout.php | 142 +++++ .../Types/ProcessCheckoutPaymentType.php | 19 + vendor_prefixed/sumup-sdk/Types/Product.php | 82 +++ vendor_prefixed/sumup-sdk/Types/Reader.php | 76 +++ .../sumup-sdk/Types/ReaderDevice.php | 26 + .../sumup-sdk/Types/ReaderDeviceModel.php | 14 + .../sumup-sdk/Types/ReaderStatus.php | 23 + vendor_prefixed/sumup-sdk/Types/Receipt.php | 40 ++ .../sumup-sdk/Types/ReceiptAcquirerData.php | 36 ++ .../sumup-sdk/Types/ReceiptCard.php | 26 + .../sumup-sdk/Types/ReceiptEvent.php | 69 +++ .../sumup-sdk/Types/ReceiptEventStatus.php | 29 + .../sumup-sdk/Types/ReceiptEventType.php | 16 + .../sumup-sdk/Types/ReceiptMerchantData.php | 26 + .../ReceiptMerchantDataMerchantProfile.php | 60 +++ ...eiptMerchantDataMerchantProfileAddress.php | 63 +++ .../sumup-sdk/Types/ReceiptReader.php | 26 + .../sumup-sdk/Types/ReceiptTransaction.php | 152 ++++++ .../Types/ReceiptTransactionProcessAs.php | 14 + vendor_prefixed/sumup-sdk/Types/Role.php | 68 +++ .../sumup-sdk/Types/StatusResponse.php | 18 + .../sumup-sdk/Types/StatusResponseData.php | 58 ++ .../StatusResponseDataConnectionType.php | 19 + .../Types/StatusResponseDataState.php | 18 + .../Types/StatusResponseDataStatus.php | 14 + .../sumup-sdk/Types/Timestamps.php | 23 + .../sumup-sdk/Types/TransactionBase.php | 68 +++ .../Types/TransactionBaseCurrency.php | 28 + .../Types/TransactionBasePaymentType.php | 23 + .../sumup-sdk/Types/TransactionBaseStatus.php | 16 + .../Types/TransactionCheckoutInfo.php | 47 ++ .../TransactionCheckoutInfoEntryMode.php | 39 ++ .../sumup-sdk/Types/TransactionEvent.php | 76 +++ .../Types/TransactionEventEventType.php | 16 + .../Types/TransactionEventStatus.php | 29 + .../sumup-sdk/Types/TransactionFull.php | 316 +++++++++++ .../Types/TransactionFullLocation.php | 33 ++ .../Types/TransactionFullPayoutType.php | 14 + .../Types/TransactionFullProcessAs.php | 14 + .../TransactionFullSimplePaymentType.php | 26 + .../Types/TransactionFullSimpleStatus.php | 33 ++ .../TransactionFullVerificationMethod.php | 18 + .../sumup-sdk/Types/TransactionHistory.php | 152 ++++++ .../Types/TransactionHistoryCardType.php | 36 ++ .../Types/TransactionHistoryPayoutType.php | 14 + .../Types/TransactionHistoryType.php | 15 + .../Types/TransactionMixinHistory.php | 40 ++ .../TransactionMixinHistoryPayoutPlan.php | 15 + .../Types/TransactionsHistoryLink.php | 26 + .../sumup-sdk/Types/Unauthorized.php | 18 + .../sumup-sdk/Types/UnauthorizedErrors.php | 23 + .../Types/UnauthorizedErrorsType.php | 14 + vendor_prefixed/sumup-sdk/Version.php | 10 + 169 files changed, 11617 insertions(+), 59 deletions(-) create mode 100644 php-scoper/composer.json create mode 100644 php-scoper/scoper.inc.php create mode 100644 tools/generate-prefixed-sumup-autoload.php create mode 100644 vendor_prefixed/sumup-sdk-autoload.php create mode 100644 vendor_prefixed/sumup-sdk/ApiVersion.php create mode 100644 vendor_prefixed/sumup-sdk/Checkouts/Checkouts.php create mode 100644 vendor_prefixed/sumup-sdk/Customers/Customers.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/ApiException.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/ArgumentException.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/ConfigurationException.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/ConnectionException.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/ErrorEnvelope.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/SDKException.php create mode 100644 vendor_prefixed/sumup-sdk/Exception/UnexpectedApiException.php create mode 100644 vendor_prefixed/sumup-sdk/ExceptionMessages.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/CurlClient.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/GuzzleClient.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/HttpClientInterface.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/RequestHeaders.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/RequestOptions.php create mode 100644 vendor_prefixed/sumup-sdk/HttpClient/Response.php create mode 100644 vendor_prefixed/sumup-sdk/Hydrator.php create mode 100644 vendor_prefixed/sumup-sdk/Members/Members.php create mode 100644 vendor_prefixed/sumup-sdk/Memberships/Memberships.php create mode 100644 vendor_prefixed/sumup-sdk/Merchants/Merchants.php create mode 100644 vendor_prefixed/sumup-sdk/Payouts/Payouts.php create mode 100644 vendor_prefixed/sumup-sdk/Readers/Readers.php create mode 100644 vendor_prefixed/sumup-sdk/Receipts/Receipts.php create mode 100644 vendor_prefixed/sumup-sdk/RequestEncoder.php create mode 100644 vendor_prefixed/sumup-sdk/ResponseDecoder.php create mode 100644 vendor_prefixed/sumup-sdk/Roles/Roles.php create mode 100644 vendor_prefixed/sumup-sdk/SdkInfo.php create mode 100644 vendor_prefixed/sumup-sdk/Services/SumUpService.php create mode 100644 vendor_prefixed/sumup-sdk/Shared/Shared.php create mode 100644 vendor_prefixed/sumup-sdk/SumUp.php create mode 100644 vendor_prefixed/sumup-sdk/Transactions/Transactions.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Address.php create mode 100644 vendor_prefixed/sumup-sdk/Types/AddressLegacy.php create mode 100644 vendor_prefixed/sumup-sdk/Types/BadRequest.php create mode 100644 vendor_prefixed/sumup-sdk/Types/BadRequestErrors.php create mode 100644 vendor_prefixed/sumup-sdk/Types/BadRequestErrorsType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/BasePerson.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Branding.php create mode 100644 vendor_prefixed/sumup-sdk/Types/BusinessProfile.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Card.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CardExpiryMonth.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CardResponse.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CardResponseType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CardType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Checkout.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutAccepted.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutAcceptedNextStep.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestPurpose.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutCurrency.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutSuccess.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CheckoutSuccessPaymentInstrument.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ClassicMerchantIdentifiers.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Company.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutError.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutErrorErrors.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequest.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAffiliate.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestTotalAmount.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponse.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponseData.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutUnprocessableEntity.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateErrorErrors.php create mode 100644 vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateUnprocessableEntity.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Customer.php create mode 100644 vendor_prefixed/sumup-sdk/Types/DetailsError.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Device.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ElvCardAccount.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Error.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ErrorExtended.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ErrorForbidden.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Event.php create mode 100644 vendor_prefixed/sumup-sdk/Types/EventStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/EventType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/FinancialPayout.php create mode 100644 vendor_prefixed/sumup-sdk/Types/FinancialPayoutStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/FinancialPayoutType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/HostedCheckout.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Invite.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Link.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ListPersonsResponseBody.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MandatePayload.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MandatePayloadType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MandateResponse.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MandateResponseStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Member.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MemberStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Membership.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MembershipResource.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MembershipStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MembershipUser.php create mode 100644 vendor_prefixed/sumup-sdk/Types/MembershipUserClassic.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Merchant.php create mode 100644 vendor_prefixed/sumup-sdk/Types/NotFound.php create mode 100644 vendor_prefixed/sumup-sdk/Types/NotFoundErrors.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Ownership.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponse.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCard.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCardType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Person.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PersonalDetails.php create mode 100644 vendor_prefixed/sumup-sdk/Types/PersonalIdentifier.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Problem.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ProcessCheckout.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Product.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Reader.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReaderDevice.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReaderDeviceModel.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReaderStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Receipt.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptCard.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptEvent.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptEventStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptEventType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptMerchantData.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfile.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfileAddress.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptReader.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptTransaction.php create mode 100644 vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Role.php create mode 100644 vendor_prefixed/sumup-sdk/Types/StatusResponse.php create mode 100644 vendor_prefixed/sumup-sdk/Types/StatusResponseData.php create mode 100644 vendor_prefixed/sumup-sdk/Types/StatusResponseDataConnectionType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/StatusResponseDataState.php create mode 100644 vendor_prefixed/sumup-sdk/Types/StatusResponseDataStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Timestamps.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionBase.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionBaseCurrency.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionBasePaymentType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionBaseStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfo.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfoEntryMode.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionEvent.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionEventEventType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionEventStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFull.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullPayoutType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullProcessAs.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullSimplePaymentType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullSimpleStatus.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionFullVerificationMethod.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionHistory.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionHistoryCardType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionHistoryPayoutType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionHistoryType.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionMixinHistory.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionMixinHistoryPayoutPlan.php create mode 100644 vendor_prefixed/sumup-sdk/Types/TransactionsHistoryLink.php create mode 100644 vendor_prefixed/sumup-sdk/Types/Unauthorized.php create mode 100644 vendor_prefixed/sumup-sdk/Types/UnauthorizedErrors.php create mode 100644 vendor_prefixed/sumup-sdk/Types/UnauthorizedErrorsType.php create mode 100644 vendor_prefixed/sumup-sdk/Version.php diff --git a/composer.json b/composer.json index 266e51b..d31c1fa 100644 --- a/composer.json +++ b/composer.json @@ -1,63 +1,63 @@ { - "name": "wcpos/sumup-terminal-for-woocommerce", - "description": "SumUp Terminal integration for WooCommerce POS.", - "type": "wordpress-plugin", - "license": "GPL-3.0+", - "authors": [ - { - "name": "kilbot", - "email": "paul@kilbot.com" - } - ], - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "friendsofphp/php-cs-fixer": "^3.0", - "php-stubs/woocommerce-stubs": "^10.5", - "phpcompatibility/phpcompatibility-wp": "^2.0", - "sirbrillig/phpcs-variable-analysis": "^2.0", - "squizlabs/php_codesniffer": "^3.0", - "woocommerce/woocommerce-sniffs": "^1.0", - "wp-coding-standards/wpcs": "^3.0", - "wp-phpunit/wp-phpunit": "^7.0", - "yoast/phpunit-polyfills": "^4.0" - }, - "require": { - "php": ">=7.4", - "ext-json": "*" - }, - "config": { - "platform": { - "php": "7.4" + "name": "wcpos/sumup-terminal-for-woocommerce", + "description": "SumUp Terminal integration for WooCommerce POS.", + "type": "wordpress-plugin", + "license": "GPL-3.0+", + "authors": [ + { + "name": "kilbot", + "email": "paul@kilbot.com" + } + ], + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "friendsofphp/php-cs-fixer": "^3.0", + "php-stubs/woocommerce-stubs": "^10.5", + "phpcompatibility/phpcompatibility-wp": "^2.0", + "sirbrillig/phpcs-variable-analysis": "^2.0", + "squizlabs/php_codesniffer": "^3.0", + "woocommerce/woocommerce-sniffs": "^1.0", + "wp-coding-standards/wpcs": "^3.0", + "wp-phpunit/wp-phpunit": "^7.0", + "yoast/phpunit-polyfills": "^4.0" }, - "platform-check": false, - "process-timeout": 0, - "optimize-autoloader": true, - "vendor-dir": "vendor", - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } - }, - "scripts": { - "format": "phpcbf --standard=./.phpcs.xml.dist --report-summary --report-source", - "lint": "phpcs --standard=./.phpcs.xml.dist", - "lint-report": "phpcs --standard=./.phpcs.xml.dist --report=checkstyle", - "fix": "php-cs-fixer fix .", - "prefix-dependencies": [ - "composer --working-dir=php-scoper install", - "cd php-scoper && vendor/bin/php-scoper add-prefix --output-dir=../vendor_prefixed --force && cd ..", - "composer dump-autoload -o", - "php generate_autoload.php" - ] - }, - "autoload": { - "psr-4": { - "WCPOS\\WooCommercePOS\\SumUpTerminal\\": "includes/" - } - }, - "autoload-dev": { - "psr-4": { - "WCPOS\\WooCommercePOS\\SumUpTerminal\\Tests\\": "tests/includes/" + "require": { + "php": ">=7.4", + "ext-json": "*" + }, + "config": { + "platform": { + "php": "7.4" + }, + "platform-check": false, + "process-timeout": 0, + "optimize-autoloader": true, + "vendor-dir": "vendor", + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "scripts": { + "format": "phpcbf --standard=./.phpcs.xml.dist --report-summary --report-source", + "lint": "phpcs --standard=./.phpcs.xml.dist", + "lint-report": "phpcs --standard=./.phpcs.xml.dist --report=checkstyle", + "fix": "php-cs-fixer fix .", + "prefix-dependencies": [ + "composer --working-dir=php-scoper install --no-dev --optimize-autoloader", + "php php-scoper/vendor/bin/php-scoper add-prefix --config=php-scoper/scoper.inc.php --output-dir=vendor_prefixed/sumup-sdk --force", + "php tools/generate-prefixed-sumup-autoload.php", + "composer dump-autoload -o" + ] + }, + "autoload": { + "psr-4": { + "WCPOS\\WooCommercePOS\\SumUpTerminal\\": "includes/" + } + }, + "autoload-dev": { + "psr-4": { + "WCPOS\\WooCommercePOS\\SumUpTerminal\\Tests\\": "tests/includes/" + } } - } } diff --git a/php-scoper/composer.json b/php-scoper/composer.json new file mode 100644 index 0000000..a69ced8 --- /dev/null +++ b/php-scoper/composer.json @@ -0,0 +1,15 @@ +{ + "name": "wcpos/sumup-terminal-for-woocommerce-scoper", + "private": true, + "type": "project", + "require": { + "humbug/php-scoper": "^0.18", + "sumup/sumup-php": "0.1.4" + }, + "config": { + "platform": { + "php": "8.2.0" + }, + "allow-plugins": {} + } +} diff --git a/php-scoper/scoper.inc.php b/php-scoper/scoper.inc.php new file mode 100644 index 0000000..c2901a7 --- /dev/null +++ b/php-scoper/scoper.inc.php @@ -0,0 +1,15 @@ + 'WCPOS\\WooCommercePOS\\SumUpTerminal\\Vendor\\SumUpSdk', + 'finders' => [ + Finder::create() + ->files() + ->in(__DIR__ . '/vendor/sumup/sumup-php/src'), + ], + 'patchers' => [], +]; diff --git a/tools/generate-prefixed-sumup-autoload.php b/tools/generate-prefixed-sumup-autoload.php new file mode 100644 index 0000000..df2421c --- /dev/null +++ b/tools/generate-prefixed-sumup-autoload.php @@ -0,0 +1,71 @@ + $context, + 'target' => $target, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'context' => 'context', + 'target' => 'target', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} + +class CheckoutsListAvailablePaymentMethodsResponse +{ + /** + * + * @var CheckoutsListAvailablePaymentMethodsResponseItem[]|null + */ + public ?array $availablePaymentMethods = null; + +} + +class CheckoutsListAvailablePaymentMethodsResponseItem +{ + /** + * The ID of the payment method. + * + * @var string + */ + public string $id; + +} + +/** + * Query parameters for CheckoutsListParams. + * + * @package SumUp\Services + */ +class CheckoutsListParams +{ + /** + * Filters the list of checkout resources by the unique ID of the checkout. + * + * @var string|null + */ + public ?string $checkoutReference = null; + +} + +/** + * Query parameters for CheckoutsListAvailablePaymentMethodsParams. + * + * @package SumUp\Services + */ +class CheckoutsListAvailablePaymentMethodsParams +{ + /** + * The amount for which the payment methods should be eligible, in major units. + * + * @var float|null + */ + public ?float $amount = null; + + /** + * The currency for which the payment methods should be eligible. + * + * @var string|null + */ + public ?string $currency = null; + +} + +/** + * Class Checkouts + * + * Checkouts represent online payment sessions that you create before attempting to charge a payer. A checkout captures the payment intent, such as the amount, currency, merchant, and optional customer or redirect settings, and then moves through its lifecycle as you process it. + * + * Use this tag to: + * - create a checkout before collecting or confirming payment details + * - process the checkout with a card, saved card, wallet, or supported alternative payment method + * - retrieve or list checkouts to inspect their current state and associated payment attempts + * - deactivate a checkout that should no longer be used + * + * Typical workflow: + * - create a checkout with the order amount, currency, and merchant information + * - process the checkout through SumUp client tools such as the [Payment Widget and Swift Checkout SDK](https://developer.sumup.com/online-payments/checkouts) + * - retrieve the checkout or use the Transactions endpoints to inspect the resulting payment record + * + * Checkouts are used to initiate and orchestrate online payments. Transactions remain the authoritative record of the resulting payment outcome. + * + * @package SumUp\Services + */ +class Checkouts implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Checkouts constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Create a checkout + * + * @param \SumUp\Types\CheckoutCreateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Checkout + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function create(\SumUp\Types\CheckoutCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Checkout + { + $path = '/v0.1/checkouts'; + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = \SumUp\Types\CheckoutCreateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\Checkout::class], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\ErrorExtended::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'POST', $path); + } + + /** + * Create an Apple Pay session + * + * @param string $id Unique ID of the checkout resource. + * @param CheckoutsCreateApplePaySessionRequest|array|null $body Optional request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return array + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function createApplePaySession(string $id, CheckoutsCreateApplePaySessionRequest|array|null $body = null, ?RequestOptions $requestOptions = null): array + { + $path = sprintf('/v0.2/checkouts/%s/apple-pay-session', rawurlencode((string) $id)); + $payload = []; + if ($body !== null) { + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = CheckoutsCreateApplePaySessionRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + } + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'object'], + ], [ + '400' => ['type' => 'mixed'], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'PUT', $path); + } + + /** + * Deactivate a checkout + * + * @param string $id Unique ID of the checkout resource. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Checkout + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function deactivate(string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\Checkout + { + $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Checkout::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'DELETE', $path); + } + + /** + * Retrieve a checkout + * + * @param string $id Unique ID of the checkout resource. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\CheckoutSuccess + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\CheckoutSuccess + { + $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\CheckoutSuccess::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'GET', $path); + } + + /** + * List checkouts + * + * @param CheckoutsListParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\CheckoutSuccess[] + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(?CheckoutsListParams $queryParams = null, ?RequestOptions $requestOptions = null): array + { + $path = '/v0.1/checkouts'; + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->checkoutReference)) { + $queryParamsData['checkout_reference'] = $queryParams->checkoutReference; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutSuccess::class]], + ], [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Get available payment methods + * + * @param string $merchantCode The SumUp merchant code. + * @param CheckoutsListAvailablePaymentMethodsParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsListAvailablePaymentMethodsParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse + { + $path = sprintf('/v0.1/merchants/%s/payment-methods', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->amount)) { + $queryParamsData['amount'] = $queryParams->amount; + } + if (isset($queryParams->currency)) { + $queryParamsData['currency'] = $queryParams->currency; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\DetailsError::class], + ], 'GET', $path); + } + + /** + * Process a checkout + * + * @param string $id Unique ID of the checkout resource. + * @param \SumUp\Types\ProcessCheckout|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\CheckoutSuccess|\SumUp\Types\CheckoutAccepted + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function process(string $id, \SumUp\Types\ProcessCheckout|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\CheckoutSuccess|\SumUp\Types\CheckoutAccepted + { + $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = \SumUp\Types\ProcessCheckout::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutSuccess::class], + '202' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutAccepted::class], + ], [ + '400' => ['type' => 'mixed'], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'PUT', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Customers/Customers.php b/vendor_prefixed/sumup-sdk/Customers/Customers.php new file mode 100644 index 0000000..981d5dd --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Customers/Customers.php @@ -0,0 +1,245 @@ + $personalDetails, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + +} + +/** + * Class Customers + * + * Allow your regular customers to save their information with the Customers model. + * + * This will prevent re-entering payment instrument information for recurring payments on your platform. + * + * Depending on the needs you can allow, creating, listing or deactivating payment instruments & creating, retrieving and updating customers. + * + * @package SumUp\Services + */ +class Customers implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Customers constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Create a customer + * + * @param \SumUp\Types\Customer|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Customer + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function create(\SumUp\Types\Customer|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + { + $path = '/v0.1/customers'; + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = \SumUp\Types\Customer::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\Customer::class], + ], [ + '400' => ['type' => 'mixed'], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'POST', $path); + } + + /** + * Deactivate a payment instrument + * + * @param string $customerId Unique ID of the saved customer resource. + * @param string $token Unique token identifying the card saved as a payment instrument resource. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function deactivatePaymentInstrument(string $customerId, string $token, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v0.1/customers/%s/payment-instruments/%s', rawurlencode((string) $customerId), rawurlencode((string) $token)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '204' => ['type' => 'void'], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'DELETE', $path); + } + + /** + * Retrieve a customer + * + * @param string $customerId Unique ID of the saved customer resource. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Customer + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $customerId, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + { + $path = sprintf('/v0.1/customers/%s', rawurlencode((string) $customerId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Customer::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'GET', $path); + } + + /** + * List payment instruments + * + * @param string $customerId Unique ID of the saved customer resource. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\PaymentInstrumentResponse[] + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function listPaymentInstruments(string $customerId, ?RequestOptions $requestOptions = null): array + { + $path = sprintf('/v0.1/customers/%s/payment-instruments', rawurlencode((string) $customerId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\PaymentInstrumentResponse::class]], + ], [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'GET', $path); + } + + /** + * Update a customer + * + * @param string $customerId Unique ID of the saved customer resource. + * @param CustomersUpdateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Customer + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function update(string $customerId, CustomersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + { + $path = sprintf('/v0.1/customers/%s', rawurlencode((string) $customerId)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = CustomersUpdateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Customer::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'PUT', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Exception/ApiException.php b/vendor_prefixed/sumup-sdk/Exception/ApiException.php new file mode 100644 index 0000000..7babef8 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Exception/ApiException.php @@ -0,0 +1,42 @@ +httpMethod = $httpMethod; + $this->path = $path; + } + + public function getHttpMethod(): ?string + { + return $this->httpMethod; + } + + public function getPath(): ?string + { + return $this->path; + } +} diff --git a/vendor_prefixed/sumup-sdk/Exception/ArgumentException.php b/vendor_prefixed/sumup-sdk/Exception/ArgumentException.php new file mode 100644 index 0000000..33ecbff --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Exception/ArgumentException.php @@ -0,0 +1,12 @@ +> + */ + private array $headers; + + /** + * @param array> $headers + */ + public function __construct(int $status, string $message, mixed $raw = null, array $headers = []) + { + $this->status = $status; + $this->message = $message; + $this->raw = $raw; + $this->headers = $headers; + } + + public function getStatus(): int + { + return $this->status; + } + + public function getMessage(): string + { + return $this->message; + } + + public function getRaw(): mixed + { + return $this->raw; + } + + /** + * @return array> + */ + public function getHeaders(): array + { + return $this->headers; + } + + /** + * @return array>|mixed> + */ + public function toArray(): array + { + return [ + 'status' => $this->status, + 'message' => $this->message, + 'raw' => $this->raw, + 'headers' => $this->headers, + ]; + } +} diff --git a/vendor_prefixed/sumup-sdk/Exception/SDKException.php b/vendor_prefixed/sumup-sdk/Exception/SDKException.php new file mode 100644 index 0000000..d04bd09 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Exception/SDKException.php @@ -0,0 +1,63 @@ +statusCode = $statusCode; + $this->responseBody = $responseBody; + } + + /** + * Returns the HTTP status code provided by the API, or 0 when absent. + * + * @return int + */ + public function getStatusCode(): int + { + return $this->statusCode; + } + + /** + * Returns the decoded response body or the raw string payload. + * + * @return mixed + */ + public function getResponseBody(): mixed + { + return $this->responseBody; + } +} diff --git a/vendor_prefixed/sumup-sdk/Exception/UnexpectedApiException.php b/vendor_prefixed/sumup-sdk/Exception/UnexpectedApiException.php new file mode 100644 index 0000000..c5b9cad --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Exception/UnexpectedApiException.php @@ -0,0 +1,84 @@ +|null $headers + */ + public function __construct( + string $message = '', + int $statusCode = 0, + mixed $responseBody = null, + ?string $httpMethod = null, + ?string $path = null, + ?array $headers = null, + ?string $rawResponseBody = null, + ?\Throwable $previous = null + ) { + parent::__construct($message, $statusCode, $responseBody, $httpMethod, $path, $previous); + $this->rawResponseBody = $rawResponseBody; + $this->errorEnvelope = new ErrorEnvelope( + $statusCode, + $message, + $rawResponseBody ?? $responseBody, + self::normalizeHeaders($headers) + ); + } + + public function getErrorEnvelope(): ErrorEnvelope + { + return $this->errorEnvelope; + } + + public function getRawResponseBody(): ?string + { + return $this->rawResponseBody; + } + + /** + * @param array|null $headers + * + * @return array> + */ + private static function normalizeHeaders(?array $headers): array + { + if ($headers === null) { + return []; + } + + $normalized = []; + foreach ($headers as $name => $value) { + if ($name == '') { + continue; + } + + if (is_array($value)) { + $items = []; + foreach ($value as $item) { + if (is_scalar($item) || (is_object($item) && method_exists($item, '__toString'))) { + $items[] = (string) $item; + } + } + if (!empty($items)) { + $normalized[$name] = $items; + } + continue; + } + + if (is_scalar($value) || (is_object($value) && method_exists($value, '__toString'))) { + $normalized[$name] = [(string) $value]; + } + } + + return $normalized; + } +} diff --git a/vendor_prefixed/sumup-sdk/ExceptionMessages.php b/vendor_prefixed/sumup-sdk/ExceptionMessages.php new file mode 100644 index 0000000..d9e09e9 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/ExceptionMessages.php @@ -0,0 +1,23 @@ + + */ + private array $customHeaders; + + /** + * The CA bundle path used to verify HTTPS calls. + * + * @var string|null + */ + private $caBundlePath; + + /** + * CurlClient constructor. + * + * @param string $baseUrl + * @param array $customHeaders + * @param string|null $caBundlePath + */ + public function __construct(string $baseUrl, array $customHeaders = [], ?string $caBundlePath = null) + { + $this->baseUrl = $baseUrl; + $this->customHeaders = $customHeaders; + $this->caBundlePath = $this->normalizeCABundlePath($caBundlePath); + if ($this->caBundlePath === null) { + $this->caBundlePath = $this->getDefaultCABundlePath(); + } + } + + /** + * @param string $method The request method. + * @param string $url The endpoint to send the request to. + * @param array $body The body of the request. + * @param array $headers The headers of the request. + * @param RequestOptions|null $options Optional typed request options. + * + * @return Response + * + * @throws ConnectionException + * @throws SDKException + */ + public function send(string $method, string $url, array $body, array $headers = [], ?RequestOptions $options = null): Response + { + if ($method === '') { + throw new SDKException('Request method cannot be empty.'); + } + + $requestUrl = $this->baseUrl . $url; + if ($requestUrl === '') { + throw new SDKException('Request URL cannot be empty.'); + } + + $reqHeaders = array_merge($headers, $this->customHeaders); + $retries = $options !== null ? ($options->retries ?? 0) : 0; + $backoffMs = $options !== null ? ($options->retryBackoffMs ?? 0) : 0; + + $attempt = 0; + do { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + curl_setopt($ch, CURLOPT_URL, $requestUrl); + curl_setopt($ch, CURLOPT_HTTPHEADER, $this->formatHeaders($reqHeaders)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, true); + if (!empty($body)) { + $payload = json_encode($body); + if (!is_string($payload)) { + throw new SDKException('Failed to encode request body to JSON.'); + } + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + } + + if (!empty($this->caBundlePath)) { + curl_setopt($ch, CURLOPT_CAINFO, $this->caBundlePath); + } + + if ($options?->timeout !== null) { + curl_setopt($ch, CURLOPT_TIMEOUT, $options->timeout); + } + + if ($options?->connectTimeout !== null) { + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $options->connectTimeout); + } + + $response = curl_exec($ch); + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + $error = curl_error($ch); + if ($error) { + $this->closeHandle($ch); + if ($attempt < $retries) { + $this->sleepBackoff($backoffMs, $attempt); + $attempt++; + continue; + } + throw new ConnectionException($error, $code); + } + + $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + + $this->closeHandle($ch); + if ($code >= 500 && $attempt < $retries) { + $this->sleepBackoff($backoffMs, $attempt); + $attempt++; + continue; + } + + if (!is_string($response)) { + throw new ConnectionException('Unexpected empty response body from cURL request.', $code); + } + + $rawHeaders = ''; + $rawBody = $response; + if ($headerSize > 0) { + $parsedHeaders = substr($response, 0, $headerSize); + $parsedBody = substr($response, $headerSize); + $rawHeaders = $parsedHeaders; + $rawBody = $parsedBody; + } + + return new Response( + $code, + $this->parseBody($rawBody), + $this->parseHeaders($rawHeaders), + $rawBody + ); + } while (true); + } + + /** + * Format the headers to be compatible with cURL. + * + * @param array|null $headers + * + * @return array + */ + private function formatHeaders(?array $headers = null): array + { + if (empty($headers)) { + return []; + } + + $keys = array_keys($headers); + $formattedHeaders = []; + foreach ($keys as $key) { + $formattedHeaders[] = $key . ': ' . $headers[$key]; + } + return $formattedHeaders; + } + + /** + * Returns JSON encoded the response's body if it is of JSON type. + * + * @param $response + * + * @return mixed + */ + private function parseBody(string $response) + { + $jsonBody = json_decode($response, true); + if (isset($jsonBody)) { + return $jsonBody; + } + return $response; + } + + /** + * Parse raw HTTP header text into normalized header map. + * + * @param string $rawHeaders + * + * @return array> + */ + private function parseHeaders(string $rawHeaders): array + { + if ($rawHeaders === '') { + return []; + } + + $headers = []; + $lines = preg_split("/\r\n|\n|\r/", $rawHeaders); + if (!is_array($lines)) { + return []; + } + + foreach ($lines as $line) { + if ($line === '' || strpos($line, ':') === false) { + continue; + } + + $parts = explode(':', $line, 2); + if (count($parts) !== 2) { + continue; + } + + $name = trim($parts[0]); + $value = trim($parts[1]); + if ($name === '' || $value === '') { + continue; + } + + if (!isset($headers[$name])) { + $headers[$name] = []; + } + $headers[$name][] = $value; + } + + return $headers; + } + + /** + * Close the cURL handle. + */ + private function closeHandle(\CurlHandle $handle): void + { + curl_close($handle); + } + + /** + * @param int $backoffMs + * @param int $attempt + */ + private function sleepBackoff(int $backoffMs, int $attempt): void + { + if ($backoffMs <= 0) { + return; + } + + $delay = $backoffMs * (int) pow(2, $attempt); + usleep($delay * 1000); + } + + /** + * Normalize and validate the CA bundle path. + * + * @param string|null $caBundlePath + * + * @return string|null + * + * @throws ConfigurationException + */ + private function normalizeCABundlePath(?string $caBundlePath): ?string + { + if ($caBundlePath === null || $caBundlePath === '') { + return null; + } + + if (!is_readable($caBundlePath)) { + throw new ConfigurationException(sprintf('The provided ca_bundle_path "%s" is not readable.', $caBundlePath)); + } + + return $caBundlePath; + } + + /** + * Returns the path to the CA bundle shipped with the SDK, if present. + * + * @return string|null + */ + private function getDefaultCABundlePath(): ?string + { + $path = realpath(__DIR__ . '/../../resources/ca-bundle.crt'); + if ($path && is_readable($path)) { + return $path; + } + + return null; + } +} diff --git a/vendor_prefixed/sumup-sdk/HttpClient/GuzzleClient.php b/vendor_prefixed/sumup-sdk/HttpClient/GuzzleClient.php new file mode 100644 index 0000000..10a3a2a --- /dev/null +++ b/vendor_prefixed/sumup-sdk/HttpClient/GuzzleClient.php @@ -0,0 +1,181 @@ + + */ + private array $customHeaders; + + /** + * @var string|null + */ + private $caBundlePath; + + /** + * GuzzleClient constructor. + * + * @param string $baseUrl + * @param array $customHeaders + * @param string|null $caBundlePath + * + * @throws ConfigurationException + */ + public function __construct(string $baseUrl, array $customHeaders = [], ?string $caBundlePath = null) + { + $this->ensureGuzzleInstalled(); + + $this->baseUrl = $baseUrl; + $this->customHeaders = $customHeaders; + $this->caBundlePath = $caBundlePath; + } + + /** + * @param string $method The request method. + * @param string $url The endpoint to send the request to. + * @param array $body The body of the request. + * @param array $headers The headers of the request. + * @param RequestOptions|null $options Optional typed request options. + * + * @return Response + * + * @throws ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function send(string $method, string $url, array $body, array $headers, ?RequestOptions $options = null): Response + { + $this->ensureGuzzleInstalled(); + + $reqHeaders = array_merge($headers, $this->customHeaders); + $retries = $options !== null ? ($options->retries ?? 0) : 0; + $backoffMs = $options !== null ? ($options->retryBackoffMs ?? 0) : 0; + + $handler = \GuzzleHttp\HandlerStack::create(); + if ($retries > 0) { + $handler->push(\GuzzleHttp\Middleware::retry( + function ($retry, $request, $response = null, $exception = null) use ($retries) { + if ($retry >= $retries) { + return false; + } + if ($exception !== null) { + return true; + } + if ($response && $response->getStatusCode() >= 500) { + return true; + } + return false; + }, + function ($retry) use ($backoffMs) { + if ($backoffMs <= 0) { + return 0; + } + return (int) ($backoffMs * pow(2, $retry)); + } + )); + } + + $client = new \GuzzleHttp\Client([ + 'base_uri' => $this->baseUrl, + 'handler' => $handler, + 'http_errors' => false, + 'verify' => $this->caBundlePath ?: true, + ]); + + $requestParams = ['headers' => $reqHeaders]; + + if (!empty($body)) { + $requestParams['json'] = $body; + } + + if ($options?->timeout !== null) { + $requestParams['timeout'] = $options->timeout; + } + + if ($options?->connectTimeout !== null) { + $requestParams['connect_timeout'] = $options->connectTimeout; + } + + try { + $response = $client->request($method, $url, $requestParams); + } catch (\GuzzleHttp\Exception\RequestException $exception) { + if ($exception->hasResponse()) { + $response = $exception->getResponse(); + } else { + throw new ConnectionException($exception->getMessage(), $exception->getCode()); + } + } + + $statusCode = $response->getStatusCode(); + $responseBody = (string) $response->getBody(); + $parsedBody = $this->parseBody($responseBody); + $headers = $this->normalizeHeaders($response->getHeaders()); + + return new Response($statusCode, $parsedBody, $headers, $responseBody); + } + + /** + * @param string $response + * + * @return mixed + */ + private function parseBody(string $response) + { + $jsonBody = json_decode($response, true); + if (isset($jsonBody)) { + return $jsonBody; + } + return $response; + } + + /** + * @param array> $headers + * + * @return array> + */ + private function normalizeHeaders(array $headers): array + { + $normalized = []; + foreach ($headers as $name => $values) { + if ($name === '') { + continue; + } + + $items = []; + foreach ($values as $value) { + if ($value !== '') { + $items[] = $value; + } + } + if (!empty($items)) { + $normalized[$name] = $items; + } + } + + return $normalized; + } + + /** + * @throws ConfigurationException + */ + private function ensureGuzzleInstalled(): void + { + if (!class_exists('\\GuzzleHttp\\Client')) { + throw new ConfigurationException( + 'Guzzle is not installed. Run `composer require guzzlehttp/guzzle` to use SumUp\\HttpClient\\GuzzleClient.' + ); + } + } +} diff --git a/vendor_prefixed/sumup-sdk/HttpClient/HttpClientInterface.php b/vendor_prefixed/sumup-sdk/HttpClient/HttpClientInterface.php new file mode 100644 index 0000000..d766ea7 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/HttpClient/HttpClientInterface.php @@ -0,0 +1,22 @@ + $body The body of the request. + * @param array $headers The headers of the request. + * @param RequestOptions|null $options Optional typed request options. + * + * @return Response + */ + public function send(string $method, string $url, array $body, array $headers, ?RequestOptions $options = null): Response; +} diff --git a/vendor_prefixed/sumup-sdk/HttpClient/RequestHeaders.php b/vendor_prefixed/sumup-sdk/HttpClient/RequestHeaders.php new file mode 100644 index 0000000..90be1c3 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/HttpClient/RequestHeaders.php @@ -0,0 +1,36 @@ + $headers + * + * @return array + */ + public static function build(?string $accessToken = null, ?RequestOptions $options = null, array $headers = []): array + { + $requestHeaders = array_merge([ + 'Content-Type' => 'application/json', + 'User-Agent' => SdkInfo::getUserAgent(), + ], SdkInfo::getRuntimeHeaders(), $headers); + + if (!empty($accessToken)) { + $requestHeaders['Authorization'] = 'Bearer ' . $accessToken; + } + + if ($options !== null && !empty($options->headers)) { + $requestHeaders = array_merge($requestHeaders, $options->headers); + } + + return $requestHeaders; + } +} diff --git a/vendor_prefixed/sumup-sdk/HttpClient/RequestOptions.php b/vendor_prefixed/sumup-sdk/HttpClient/RequestOptions.php new file mode 100644 index 0000000..91e7025 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/HttpClient/RequestOptions.php @@ -0,0 +1,61 @@ + + */ + public array $headers = []; + + /** + * Total request timeout in seconds. + * + * @var int|null + */ + public ?int $timeout = null; + + /** + * Connection timeout in seconds. + * + * @var int|null + */ + public ?int $connectTimeout = null; + + /** + * Number of retry attempts for transient failures. + * + * @var int|null + */ + public ?int $retries = null; + + /** + * Base retry backoff in milliseconds. + * + * @var int|null + */ + public ?int $retryBackoffMs = null; + + /** + * @param array $headers + */ + public function __construct( + ?int $timeout = null, + ?int $connectTimeout = null, + ?int $retries = null, + ?int $retryBackoffMs = null, + array $headers = [] + ) { + $this->timeout = $timeout; + $this->connectTimeout = $connectTimeout; + $this->retries = $retries; + $this->retryBackoffMs = $retryBackoffMs; + $this->headers = $headers; + } +} diff --git a/vendor_prefixed/sumup-sdk/HttpClient/Response.php b/vendor_prefixed/sumup-sdk/HttpClient/Response.php new file mode 100644 index 0000000..d05521c --- /dev/null +++ b/vendor_prefixed/sumup-sdk/HttpClient/Response.php @@ -0,0 +1,101 @@ +> + */ + protected array $headers; + + /** + * Raw response body before parsing, when available. + * + * @var string|null + */ + protected ?string $rawBody; + + /** + * Response constructor. + * + * @param int $httpResponseCode + * @param mixed $body + * @param array> $headers + * @param string|null $rawBody + * + */ + public function __construct( + int $httpResponseCode, + mixed $body, + array $headers = [], + ?string $rawBody = null + ) { + $this->httpResponseCode = $httpResponseCode; + $this->body = $body; + $this->headers = $headers; + $this->rawBody = $rawBody; + } + + /** + * Get HTTP response code. + * + * @return int + */ + public function getHttpResponseCode(): int + { + return $this->httpResponseCode; + } + + /** + * Get the response body. + * + * @return array|mixed + */ + public function getBody(): mixed + { + return $this->body; + } + + /** + * Get normalized response headers. + * + * @return array> + */ + public function getHeaders(): array + { + return $this->headers; + } + + /** + * Get raw response body before JSON decoding, when available. + * + * @return string|null + */ + public function getRawBody(): ?string + { + return $this->rawBody; + } + +} diff --git a/vendor_prefixed/sumup-sdk/Hydrator.php b/vendor_prefixed/sumup-sdk/Hydrator.php new file mode 100644 index 0000000..b30b9a3 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Hydrator.php @@ -0,0 +1,329 @@ +> + */ + private static $propertyCache = []; + + /** + * Hydrate the provided payload into the given class. + * + * @param mixed $payload + * @param string $className + * @param object|null $target Existing instance to hydrate. + * + * @return mixed + */ + public static function hydrate($payload, $className, $target = null) + { + if ($payload === null || $className === '' || !class_exists($className)) { + return $payload; + } + + if ($payload instanceof $className) { + return $payload; + } + + if (!is_array($payload)) { + return $payload; + } + + $object = ($target instanceof $className) + ? $target + : (new ReflectionClass($className))->newInstanceWithoutConstructor(); + $properties = self::getClassProperties($className); + + foreach ($payload as $key => $value) { + $propertyName = self::normalizePropertyName($key); + if (!isset($properties[$propertyName])) { + continue; + } + + $property = $properties[$propertyName]; + $property->setValue($object, self::castValue($value, $property)); + } + + return $object; + } + + /** + * @param string $className + * + * @return array + */ + private static function getClassProperties($className) + { + if (isset(self::$propertyCache[$className])) { + return self::$propertyCache[$className]; + } + + if (!class_exists($className)) { + return []; + } + + $refClass = new ReflectionClass($className); + $properties = []; + foreach ($refClass->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + $properties[$property->getName()] = $property; + } + + self::$propertyCache[$className] = $properties; + + return $properties; + } + + /** + * @param mixed $value + * @param ReflectionProperty $property + * + * @return mixed + */ + private static function castValue($value, ReflectionProperty $property) + { + if ($value === null) { + return null; + } + + $type = $property->getType(); + if (!$type instanceof ReflectionNamedType) { + return $value; + } + + $typeName = $type->getName(); + if ($type->isBuiltin()) { + switch ($typeName) { + case 'int': + return (int) $value; + case 'float': + return (float) $value; + case 'bool': + return (bool) $value; + case 'string': + return (string) $value; + case 'array': + return self::castArrayValue($value, $property); + default: + return $value; + } + } + + if (enum_exists($typeName)) { + return self::castEnumValue($value, $typeName); + } + + return self::hydrate($value, $typeName); + } + + /** + * @param mixed $value + * @param string $enumClass + * + * @return mixed + */ + private static function castEnumValue($value, $enumClass) + { + if ($value instanceof $enumClass) { + return $value; + } + + if (method_exists($enumClass, 'tryFrom')) { + $enum = $enumClass::tryFrom($value); + if ($enum !== null) { + return $enum; + } + } + + if (method_exists($enumClass, 'from')) { + return $enumClass::from($value); + } + + return $value; + } + + /** + * @param mixed $value + * @param ReflectionProperty $property + * + * @return array + */ + private static function castArrayValue($value, ReflectionProperty $property) + { + if (!is_array($value)) { + return []; + } + + $itemType = self::extractArrayItemType($property); + if ($itemType === null) { + return $value; + } + + $result = []; + foreach ($value as $key => $item) { + $result[$key] = self::castArrayItem($item, $itemType, $property); + } + + return $result; + } + + /** + * @param ReflectionProperty $property + * + * @return string|null + */ + private static function extractArrayItemType(ReflectionProperty $property) + { + $docComment = $property->getDocComment(); + if ($docComment === false) { + return null; + } + + if (!preg_match('/@var\s+([^\s]+)/', $docComment, $matches)) { + return null; + } + + $types = explode('|', $matches[1]); + foreach ($types as $type) { + $type = trim($type); + if ($type === '' || $type === 'null') { + continue; + } + if (substr($type, -2) === '[]') { + return substr($type, 0, -2); + } + } + + return null; + } + + /** + * @param mixed $item + * @param string $itemType + * @param ReflectionProperty $property + * + * @return mixed + */ + private static function castArrayItem($item, $itemType, ReflectionProperty $property) + { + $normalizedType = ltrim($itemType, '\\'); + switch ($normalizedType) { + case 'string': + return (string) $item; + case 'int': + return (int) $item; + case 'float': + return (float) $item; + case 'bool': + return (bool) $item; + case 'array': + return is_array($item) ? $item : []; + case 'mixed': + return $item; + } + + $className = $itemType; + if ($itemType[0] !== '\\') { + $namespace = $property->getDeclaringClass()->getNamespaceName(); + if (!empty($namespace)) { + $className = $namespace . '\\' . $itemType; + } else { + $className = $itemType; + } + } else { + $className = ltrim($itemType, '\\'); + } + + if (!class_exists($className)) { + return $item; + } + + return self::hydrate($item, $className); + } + + /** + * Normalize serialized property names into PHP property names. + * + * @param string $name + * + * @return string + */ + private static function normalizePropertyName($name) + { + $value = trim((string) $name); + $value = str_replace('[]', 'List', $value); + $value = str_replace(['.', '-', ' '], '_', $value); + if ($value === '') { + $value = 'field'; + } + + $value = self::toLowerCamel($value); + if (self::isReservedWord($value)) { + $value .= 'Value'; + } + + return $value; + } + + /** + * Convert strings to lower camelCase. + * + * @param string $value + * + * @return string + */ + private static function toLowerCamel($value) + { + $value = str_replace('_', ' ', $value); + $value = ucwords($value); + $value = str_replace(' ', '', $value); + + return lcfirst($value); + } + + /** + * @param string $word + * + * @return bool + */ + private static function isReservedWord($word) + { + static $reserved = [ + 'abstract' => true, + 'array' => true, + 'callable' => true, + 'class' => true, + 'const' => true, + 'default' => true, + 'function' => true, + 'global' => true, + 'interface' => true, + 'new' => true, + 'private' => true, + 'protected' => true, + 'public' => true, + 'static' => true, + 'string' => true, + 'int' => true, + 'float' => true, + 'bool' => true, + 'self' => true, + 'parent' => true, + 'trait' => true, + 'namespace' => true, + ]; + + return isset($reserved[$word]); + } +} diff --git a/vendor_prefixed/sumup-sdk/Members/Members.php b/vendor_prefixed/sumup-sdk/Members/Members.php new file mode 100644 index 0000000..847da0c --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Members/Members.php @@ -0,0 +1,505 @@ +|null + */ + public ?array $metadata = null; + + /** + * Object attributes that are modifiable only by SumUp applications. + * + * @var array|null + */ + public ?array $attributes = null; + + /** + * Create request DTO. + * + * @param string $email + * @param string[] $roles + * @param bool|null $isManagedUser + * @param string|null $password + * @param string|null $nickname + * @param array|null $metadata + * @param array|null $attributes + */ + public function __construct( + string $email, + array $roles, + ?bool $isManagedUser = null, + ?string $password = null, + ?string $nickname = null, + ?array $metadata = null, + ?array $attributes = null + ) { + \SumUp\Hydrator::hydrate([ + 'email' => $email, + 'roles' => $roles, + 'is_managed_user' => $isManagedUser, + 'password' => $password, + 'nickname' => $nickname, + 'metadata' => $metadata, + 'attributes' => $attributes, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'email' => 'email', + 'roles' => 'roles', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} + +class MembersUpdateRequest +{ + /** + * + * @var string[]|null + */ + public ?array $roles = null; + + /** + * Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always submit whole metadata. Maximum of 64 parameters are allowed in the object. + * + * @var array|null + */ + public ?array $metadata = null; + + /** + * Object attributes that are modifiable only by SumUp applications. + * + * @var array|null + */ + public ?array $attributes = null; + + /** + * Allows you to update user data of managed users. + * + * @var MembersUpdateRequestUser|null + */ + public ?MembersUpdateRequestUser $user = null; + + /** + * Create request DTO. + * + * @param string[]|null $roles + * @param array|null $metadata + * @param array|null $attributes + * @param MembersUpdateRequestUser|null $user + */ + public function __construct( + ?array $roles = null, + ?array $metadata = null, + ?array $attributes = null, + ?MembersUpdateRequestUser $user = null + ) { + \SumUp\Hydrator::hydrate([ + 'roles' => $roles, + 'metadata' => $metadata, + 'attributes' => $attributes, + 'user' => $user, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + +} + +class MembersListResponse +{ + /** + * + * @var \SumUp\Types\Member[] + */ + public array $items; + + /** + * + * @var int|null + */ + public ?int $totalCount = null; + +} + +/** + * Allows you to update user data of managed users. + */ +class MembersUpdateRequestUser +{ + /** + * User's preferred name. Used for display purposes only. + * + * @var string|null + */ + public ?string $nickname = null; + + /** + * Password of the member to add. Only used if `is_managed_user` is true. + * + * @var string|null + */ + public ?string $password = null; + +} + +/** + * Query parameters for MembersListParams. + * + * @package SumUp\Services + */ +class MembersListParams +{ + /** + * Offset of the first member to return. + * + * @var int|null + */ + public ?int $offset = null; + + /** + * Maximum number of members to return. + * + * @var int|null + */ + public ?int $limit = null; + + /** + * Indicates to skip count query. + * + * @var bool|null + */ + public ?bool $scroll = null; + + /** + * Filter the returned members by email address prefix. + * + * @var string|null + */ + public ?string $email = null; + + /** + * Search for a member by user id. + * + * @var string|null + */ + public ?string $userId = null; + + /** + * Filter the returned members by the membership status. + * + * @var string|null + */ + public ?string $status = null; + + /** + * Filter the returned members by role. + * + * @var string[]|null + */ + public ?array $roles = null; + +} + +/** + * Class Members + * + * Endpoints to manage account members. Members are users that have membership within merchant accounts. + * + * @package SumUp\Services + */ +class Members implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Members constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Create a member + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param MembersCreateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Member + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function create(string $merchantCode, MembersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + { + $path = sprintf('/v0.1/merchants/%s/members', rawurlencode((string) $merchantCode)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = MembersCreateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\Member::class], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '429' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'POST', $path); + } + + /** + * Delete a member + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $memberId The ID of the member to retrieve. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function delete(string $merchantCode, string $memberId, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v0.1/merchants/%s/members/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $memberId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'void'], + ], [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'DELETE', $path); + } + + /** + * Retrieve a member + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $memberId The ID of the member to retrieve. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Member + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $merchantCode, string $memberId, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + { + $path = sprintf('/v0.1/merchants/%s/members/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $memberId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Member::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * List members + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param MembersListParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\MembersListResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(string $merchantCode, ?MembersListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\MembersListResponse + { + $path = sprintf('/v0.1/merchants/%s/members', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->offset)) { + $queryParamsData['offset'] = $queryParams->offset; + } + if (isset($queryParams->limit)) { + $queryParamsData['limit'] = $queryParams->limit; + } + if (isset($queryParams->scroll)) { + $queryParamsData['scroll'] = $queryParams->scroll; + } + if (isset($queryParams->email)) { + $queryParamsData['email'] = $queryParams->email; + } + if (isset($queryParams->userId)) { + $queryParamsData['user.id'] = $queryParams->userId; + } + if (isset($queryParams->status)) { + $queryParamsData['status'] = $queryParams->status; + } + if (isset($queryParams->roles)) { + $queryParamsData['roles'] = $queryParams->roles; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\MembersListResponse::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Update a member + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $memberId The ID of the member to retrieve. + * @param MembersUpdateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Member + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function update(string $merchantCode, string $memberId, MembersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + { + $path = sprintf('/v0.1/merchants/%s/members/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $memberId)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = MembersUpdateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Member::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'PUT', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Memberships/Memberships.php b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php new file mode 100644 index 0000000..b337315 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php @@ -0,0 +1,210 @@ +client = $client; + $this->accessToken = $accessToken; + } + + /** + * List memberships + * + * @param MembershipsListParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\MembershipsListResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(?MembershipsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\MembershipsListResponse + { + $path = '/v0.1/memberships'; + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->offset)) { + $queryParamsData['offset'] = $queryParams->offset; + } + if (isset($queryParams->limit)) { + $queryParamsData['limit'] = $queryParams->limit; + } + if (isset($queryParams->kind)) { + $queryParamsData['kind'] = $queryParams->kind; + } + if (isset($queryParams->status)) { + $queryParamsData['status'] = $queryParams->status; + } + if (isset($queryParams->resourceType)) { + $queryParamsData['resource.type'] = $queryParams->resourceType; + } + if (isset($queryParams->resourceAttributesSandbox)) { + $queryParamsData['resource.attributes.sandbox'] = $queryParams->resourceAttributesSandbox; + } + if (isset($queryParams->resourceName)) { + $queryParamsData['resource.name'] = $queryParams->resourceName; + } + if (isset($queryParams->resourceParentId)) { + $queryParamsData['resource.parent.id'] = $queryParams->resourceParentId; + } + if (isset($queryParams->resourceParentType)) { + $queryParamsData['resource.parent.type'] = $queryParams->resourceParentType; + } + if (isset($queryParams->roles)) { + $queryParamsData['roles'] = $queryParams->roles; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\MembershipsListResponse::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Merchants/Merchants.php b/vendor_prefixed/sumup-sdk/Merchants/Merchants.php new file mode 100644 index 0000000..4727588 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Merchants/Merchants.php @@ -0,0 +1,211 @@ +client = $client; + $this->accessToken = $accessToken; + } + + /** + * Retrieve a Merchant + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param MerchantsGetParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Merchant + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $merchantCode, ?MerchantsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Merchant + { + $path = sprintf('/v1/merchants/%s', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->version)) { + $queryParamsData['version'] = $queryParams->version; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Merchant::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Retrieve a Person + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $personId Person ID + * @param MerchantsGetPersonParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Person + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function getPerson(string $merchantCode, string $personId, ?MerchantsGetPersonParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Person + { + $path = sprintf('/v1/merchants/%s/persons/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $personId)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->version)) { + $queryParamsData['version'] = $queryParams->version; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Person::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * List Persons + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param MerchantsListPersonsParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\ListPersonsResponseBody + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function listPersons(string $merchantCode, ?MerchantsListPersonsParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\ListPersonsResponseBody + { + $path = sprintf('/v1/merchants/%s/persons', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->version)) { + $queryParamsData['version'] = $queryParams->version; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\ListPersonsResponseBody::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Payouts/Payouts.php b/vendor_prefixed/sumup-sdk/Payouts/Payouts.php new file mode 100644 index 0000000..362c16f --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Payouts/Payouts.php @@ -0,0 +1,147 @@ +client = $client; + $this->accessToken = $accessToken; + } + + /** + * List payouts + * + * @param string $merchantCode Merchant code of the account whose payouts should be listed. + * @param PayoutsListParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\FinancialPayout[] + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(string $merchantCode, ?PayoutsListParams $queryParams = null, ?RequestOptions $requestOptions = null): array + { + $path = sprintf('/v1.0/merchants/%s/payouts', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->startDate)) { + $queryParamsData['start_date'] = $queryParams->startDate; + } + if (isset($queryParams->endDate)) { + $queryParamsData['end_date'] = $queryParams->endDate; + } + if (isset($queryParams->format)) { + $queryParamsData['format'] = $queryParams->format; + } + if (isset($queryParams->limit)) { + $queryParamsData['limit'] = $queryParams->limit; + } + if (isset($queryParams->order)) { + $queryParamsData['order'] = $queryParams->order; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\FinancialPayout::class]], + ], [ + '400' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\ErrorExtended::class]], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Readers/Readers.php b/vendor_prefixed/sumup-sdk/Readers/Readers.php new file mode 100644 index 0000000..8cb839f --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Readers/Readers.php @@ -0,0 +1,450 @@ +|null + */ + public ?array $metadata = null; + + /** + * Create request DTO. + * + * @param string $pairingCode + * @param string $name + * @param array|null $metadata + */ + public function __construct( + string $pairingCode, + string $name, + ?array $metadata = null + ) { + \SumUp\Hydrator::hydrate([ + 'pairing_code' => $pairingCode, + 'name' => $name, + 'metadata' => $metadata, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'pairing_code' => 'pairingCode', + 'name' => 'name', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} + +/** + * Request payload for ReadersTerminateCheckoutRequest. + * + * @package SumUp\Services + */ +class ReadersTerminateCheckoutRequest +{ + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + return new self(); + } +} + +class ReadersUpdateRequest +{ + /** + * Custom human-readable, user-defined name for easier identification of the reader. + * + * @var string|null + */ + public ?string $name = null; + + /** + * Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always submit whole metadata. Maximum of 64 parameters are allowed in the object. + * + * @var array|null + */ + public ?array $metadata = null; + + /** + * Create request DTO. + * + * @param string|null $name + * @param array|null $metadata + */ + public function __construct( + ?string $name = null, + ?array $metadata = null + ) { + \SumUp\Hydrator::hydrate([ + 'name' => $name, + 'metadata' => $metadata, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + +} + +class ReadersListResponse +{ + /** + * + * @var \SumUp\Types\Reader[] + */ + public array $items; + +} + +/** + * Class Readers + * + * A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments. + * + * @package SumUp\Services + */ +class Readers implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Readers constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Create a Reader + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param ReadersCreateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Reader + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function create(string $merchantCode, ReadersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + { + $path = sprintf('/v0.1/merchants/%s/readers', rawurlencode((string) $merchantCode)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = ReadersCreateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\Reader::class], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'POST', $path); + } + + /** + * Create a Reader Checkout + * + * @param string $merchantCode Merchant Code + * @param string $readerId The unique identifier of the Reader + * @param \SumUp\Types\CreateReaderCheckoutRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\CreateReaderCheckoutResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function createCheckout(string $merchantCode, string $readerId, \SumUp\Types\CreateReaderCheckoutRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\CreateReaderCheckoutResponse + { + $path = sprintf('/v0.1/merchants/%s/readers/%s/checkout', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = \SumUp\Types\CreateReaderCheckoutRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\CreateReaderCheckoutResponse::class], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '422' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'POST', $path); + } + + /** + * Delete a reader + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $id The unique identifier of the reader. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function delete(string $merchantCode, string $id, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v0.1/merchants/%s/readers/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'void'], + ], [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'DELETE', $path); + } + + /** + * Retrieve a Reader + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $id The unique identifier of the reader. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Reader + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $merchantCode, string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + { + $path = sprintf('/v0.1/merchants/%s/readers/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Reader::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Get a Reader Status + * + * @param string $merchantCode Merchant Code + * @param string $readerId The unique identifier of the Reader + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\StatusResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function getStatus(string $merchantCode, string $readerId, ?RequestOptions $requestOptions = null): \SumUp\Types\StatusResponse + { + $path = sprintf('/v0.1/merchants/%s/readers/%s/status', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\StatusResponse::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * List Readers + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\ReadersListResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Services\ReadersListResponse + { + $path = sprintf('/v0.1/merchants/%s/readers', rawurlencode((string) $merchantCode)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\ReadersListResponse::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Terminate a Reader Checkout + * + * @param string $merchantCode Merchant Code + * @param string $readerId The unique identifier of the Reader + * @param ReadersTerminateCheckoutRequest|array|null $body Optional request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function terminateCheckout(string $merchantCode, string $readerId, ReadersTerminateCheckoutRequest|array|null $body = null, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v0.1/merchants/%s/readers/%s/terminate', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId)); + $payload = []; + if ($body !== null) { + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = ReadersTerminateCheckoutRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + } + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '202' => ['type' => 'void'], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '422' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'POST', $path); + } + + /** + * Update a Reader + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $id The unique identifier of the reader. + * @param ReadersUpdateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Reader + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function update(string $merchantCode, string $id, ReadersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + { + $path = sprintf('/v0.1/merchants/%s/readers/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = ReadersUpdateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PATCH', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Reader::class, [ + '403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'PATCH', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Receipts/Receipts.php b/vendor_prefixed/sumup-sdk/Receipts/Receipts.php new file mode 100644 index 0000000..bf4dde8 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Receipts/Receipts.php @@ -0,0 +1,114 @@ +client = $client; + $this->accessToken = $accessToken; + } + + /** + * Retrieve receipt details + * + * @param string $id SumUp unique transaction ID or transaction code, e.g. TS7HDYLSKD. + * @param ReceiptsGetParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Receipt + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $id, ?ReceiptsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Receipt + { + $path = sprintf('/v1.1/receipts/%s', rawurlencode((string) $id)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->mid)) { + $queryParamsData['mid'] = $queryParams->mid; + } + if (isset($queryParams->txEventId)) { + $queryParamsData['tx_event_id'] = $queryParams->txEventId; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Receipt::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'GET', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/RequestEncoder.php b/vendor_prefixed/sumup-sdk/RequestEncoder.php new file mode 100644 index 0000000..1246f94 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/RequestEncoder.php @@ -0,0 +1,82 @@ + + */ + public static function encode($value): array + { + if ($value === null) { + return []; + } + + if (is_array($value)) { + return $value; + } + + $normalized = self::normalize($value); + if (is_array($normalized)) { + return $normalized; + } + + return []; + } + + /** + * @param mixed $value + * + * @return mixed + */ + private static function normalize($value) + { + if ($value instanceof \BackedEnum) { + return $value->value; + } + + if (is_array($value)) { + $result = []; + foreach ($value as $key => $item) { + $result[$key] = self::normalize($item); + } + + return $result; + } + + if (!is_object($value)) { + return $value; + } + + $result = []; + foreach (get_object_vars($value) as $key => $item) { + if ($item === null) { + continue; + } + $result[self::toSnakeCase((string) $key)] = self::normalize($item); + } + + return $result; + } + + /** + * @param string $value + * + * @return string + */ + private static function toSnakeCase($value): string + { + $snake = preg_replace('/([a-z])([A-Z])/', '$1_$2', $value); + if (!is_string($snake) || $snake === '') { + return $value; + } + + return strtolower($snake); + } +} diff --git a/vendor_prefixed/sumup-sdk/ResponseDecoder.php b/vendor_prefixed/sumup-sdk/ResponseDecoder.php new file mode 100644 index 0000000..5a0c5db --- /dev/null +++ b/vendor_prefixed/sumup-sdk/ResponseDecoder.php @@ -0,0 +1,258 @@ +|string|null $successDescriptors + * @param array|string|null $errorDescriptors + * @param string|null $httpMethod + * @param string|null $path + * + * @return mixed + * + * @throws ApiException + * @throws UnexpectedApiException + */ + public static function decodeOrThrow( + Response $response, + $successDescriptors = null, + $errorDescriptors = null, + ?string $httpMethod = null, + ?string $path = null + ) { + $statusCode = $response->getHttpResponseCode(); + if ($statusCode >= 200 && $statusCode < 300) { + return self::decode($response, $successDescriptors); + } + + if (self::hasDescriptorForStatus($errorDescriptors, $statusCode)) { + $decodedErrorBody = self::decode($response, $errorDescriptors); + $message = self::extractErrorMessage($decodedErrorBody, self::defaultErrorMessage($statusCode)); + + throw new ApiException( + $message, + $statusCode, + $decodedErrorBody, + $httpMethod, + $path + ); + } + + $rawErrorBody = $response->getBody(); + $message = self::extractErrorMessage($rawErrorBody, self::defaultUnexpectedErrorMessage($statusCode)); + + throw new UnexpectedApiException( + $message, + $statusCode, + $rawErrorBody, + $httpMethod, + $path, + $response->getHeaders(), + $response->getRawBody() + ); + } + + /** + * Decode a response using the provided descriptor map or class name. + * + * @param Response $response + * @param array|string|null $descriptors Can be a descriptor array, a class name string, or null + * + * @return mixed + */ + public static function decode(Response $response, $descriptors = null) + { + // If a simple class name string is provided, use it directly + if (is_string($descriptors)) { + return Hydrator::hydrate($response->getBody(), $descriptors); + } + + // If null or empty, return raw body + if (empty($descriptors)) { + return $response->getBody(); + } + + // Legacy descriptor array support + $statusCode = (string) $response->getHttpResponseCode(); + $descriptor = null; + if (isset($descriptors[$statusCode])) { + $descriptor = $descriptors[$statusCode]; + } elseif (isset($descriptors['default'])) { + $descriptor = $descriptors['default']; + } + + if ($descriptor === null || !isset($descriptor['type'])) { + return $response->getBody(); + } + + return self::castValue($response->getBody(), $descriptor); + } + + /** + * Convert the payload to the descriptor type. + * + * @param mixed $value + * @param array $descriptor + * + * @return mixed + */ + private static function castValue($value, array $descriptor) + { + switch ($descriptor['type']) { + case 'class': + if (!isset($descriptor['class'])) { + return $value; + } + + return Hydrator::hydrate($value, ltrim($descriptor['class'], '\\')); + case 'array': + if (!is_array($value)) { + $value = $value instanceof \stdClass ? get_object_vars($value) : (array) $value; + } + + if (!isset($descriptor['items']) || empty($descriptor['items'])) { + return $value; + } + + $result = []; + foreach ($value as $key => $item) { + $result[$key] = self::castValue($item, $descriptor['items']); + } + + return $result; + case 'scalar': + return self::castScalar($value, isset($descriptor['scalar']) ? $descriptor['scalar'] : 'mixed'); + case 'object': + if (is_array($value)) { + return $value; + } + + if (is_object($value)) { + return get_object_vars($value); + } + + return []; + case 'void': + return null; + case 'mixed': + default: + return $value; + } + } + + /** + * Cast scalar values to their expected PHP type. + * + * @param mixed $value + * @param string $type + * + * @return mixed + */ + private static function castScalar($value, $type) + { + switch ($type) { + case 'string': + return (string) $value; + case 'int': + return (int) $value; + case 'float': + return (float) $value; + case 'bool': + return (bool) $value; + default: + return $value; + } + } + + /** + * @param mixed $descriptors + * @param int $statusCode + * + * @return bool + */ + private static function hasDescriptorForStatus($descriptors, int $statusCode): bool + { + if (is_string($descriptors)) { + return true; + } + + if (!is_array($descriptors) || empty($descriptors)) { + return false; + } + + $status = (string) $statusCode; + return isset($descriptors[$status]) || isset($descriptors['default']); + } + + /** + * @param int $statusCode + * + * @return string + */ + private static function defaultErrorMessage(int $statusCode): string + { + if ($statusCode >= 500) { + return 'Server error'; + } + + return 'Client error'; + } + + /** + * @param int $statusCode + * + * @return string + */ + private static function defaultUnexpectedErrorMessage(int $statusCode): string + { + return sprintf('Unexpected API response (%d)', $statusCode); + } + + /** + * @param mixed $body + * @param string $defaultMessage + * + * @return string + */ + private static function extractErrorMessage($body, string $defaultMessage): string + { + foreach (['message', 'error_message', 'error_description', 'error'] as $key) { + $value = self::readField($body, $key); + if (is_string($value) && $value !== '') { + return $value; + } + } + + return $defaultMessage; + } + + /** + * @param mixed $payload + * @param string $key + * + * @return mixed + */ + private static function readField($payload, string $key) + { + if (is_array($payload) && array_key_exists($key, $payload)) { + return $payload[$key]; + } + if (is_object($payload) && isset($payload->{$key})) { + return $payload->{$key}; + } + + return null; + } +} diff --git a/vendor_prefixed/sumup-sdk/Roles/Roles.php b/vendor_prefixed/sumup-sdk/Roles/Roles.php new file mode 100644 index 0000000..4a8d145 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Roles/Roles.php @@ -0,0 +1,348 @@ +|null + */ + public ?array $metadata = null; + + /** + * User-defined description of the role. + * + * @var string|null + */ + public ?string $description = null; + + /** + * Create request DTO. + * + * @param string $name + * @param string[] $permissions + * @param array|null $metadata + * @param string|null $description + */ + public function __construct( + string $name, + array $permissions, + ?array $metadata = null, + ?string $description = null + ) { + \SumUp\Hydrator::hydrate([ + 'name' => $name, + 'permissions' => $permissions, + 'metadata' => $metadata, + 'description' => $description, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'name' => 'name', + 'permissions' => 'permissions', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} + +class RolesUpdateRequest +{ + /** + * User-defined name of the role. + * + * @var string|null + */ + public ?string $name = null; + + /** + * User's permissions. + * + * @var string[]|null + */ + public ?array $permissions = null; + + /** + * User-defined description of the role. + * + * @var string|null + */ + public ?string $description = null; + + /** + * Create request DTO. + * + * @param string|null $name + * @param string[]|null $permissions + * @param string|null $description + */ + public function __construct( + ?string $name = null, + ?array $permissions = null, + ?string $description = null + ) { + \SumUp\Hydrator::hydrate([ + 'name' => $name, + 'permissions' => $permissions, + 'description' => $description, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + +} + +class RolesListResponse +{ + /** + * + * @var \SumUp\Types\Role[] + */ + public array $items; + +} + +/** + * Class Roles + * + * Endpoints to manage custom roles. Custom roles allow you to tailor roles from individual permissions to match your needs. Once created, you can assign your custom roles to your merchant account members using the memberships. + * + * @package SumUp\Services + */ +class Roles implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Roles constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Create a role + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param RolesCreateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Role + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function create(string $merchantCode, RolesCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + { + $path = sprintf('/v0.1/merchants/%s/roles', rawurlencode((string) $merchantCode)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = RolesCreateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '201' => ['type' => 'class', 'class' => \SumUp\Types\Role::class], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'POST', $path); + } + + /** + * Delete a role + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $roleId The ID of the role to retrieve. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function delete(string $merchantCode, string $roleId, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v0.1/merchants/%s/roles/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $roleId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '200' => ['type' => 'void'], + ], [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'DELETE', $path); + } + + /** + * Retrieve a role + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $roleId The ID of the role to retrieve. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Role + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $merchantCode, string $roleId, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + { + $path = sprintf('/v0.1/merchants/%s/roles/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $roleId)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Role::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * List roles + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\RolesListResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Services\RolesListResponse + { + $path = sprintf('/v0.1/merchants/%s/roles', rawurlencode((string) $merchantCode)); + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\RolesListResponse::class, [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Update a role + * + * @param string $merchantCode Short unique identifier for the merchant. + * @param string $roleId The ID of the role to retrieve. + * @param RolesUpdateRequest|array $body Required request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\Role + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function update(string $merchantCode, string $roleId, RolesUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + { + $path = sprintf('/v0.1/merchants/%s/roles/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $roleId)); + $payload = []; + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = RolesUpdateRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('PATCH', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Role::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'PATCH', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/SdkInfo.php b/vendor_prefixed/sumup-sdk/SdkInfo.php new file mode 100644 index 0000000..1ddd54c --- /dev/null +++ b/vendor_prefixed/sumup-sdk/SdkInfo.php @@ -0,0 +1,100 @@ + + */ + public static function getRuntimeHeaders() + { + static $headers = null; + + if ($headers === null) { + $headers = [ + 'X-Sumup-Api-Version' => ApiVersion::CURRENT, + 'X-Sumup-Lang' => 'php', + 'X-Sumup-Package-Version' => self::getVersion(), + 'X-Sumup-Os' => self::getOsName(), + 'X-Sumup-Arch' => self::getArch(), + 'X-Sumup-Runtime' => 'php', + 'X-Sumup-Runtime-Version' => PHP_VERSION, + ]; + } + + return $headers; + } + + /** + * @return string + */ + private static function getOsName() + { + $osRaw = php_uname('s'); + $os = strtolower($osRaw); + if (strpos($os, 'win') === 0) { + return 'windows'; + } + if (strpos($os, 'linux') === 0) { + return 'linux'; + } + if (strpos($os, 'darwin') === 0) { + return 'darwin'; + } + return $os ? $os : 'unknown'; + } + + /** + * @return string + */ + private static function getArch() + { + $archRaw = php_uname('m'); + $arch = strtolower($archRaw); + $map = [ + 'x86_64' => 'x86_64', + 'x64' => 'x86_64', + 'amd64' => 'x86_64', + 'x86' => 'x86', + 'i386' => 'x86', + 'i686' => 'x86', + 'ia32' => 'x86', + 'x32' => 'x86', + 'aarch64' => 'arm64', + 'arm64' => 'arm64', + 'arm' => 'arm', + ]; + if (isset($map[$arch])) { + return $map[$arch]; + } + return $arch ? $arch : 'unknown'; + } +} diff --git a/vendor_prefixed/sumup-sdk/Services/SumUpService.php b/vendor_prefixed/sumup-sdk/Services/SumUpService.php new file mode 100644 index 0000000..22c2cc7 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Services/SumUpService.php @@ -0,0 +1,12 @@ +|null $configOrApiKey + * + * @throws SDKException + */ + public function __construct(string|array|null $configOrApiKey = null) + { + $config = []; + if (is_string($configOrApiKey) && $configOrApiKey !== '') { + $config['api_key'] = $configOrApiKey; + } elseif (is_array($configOrApiKey)) { + $config = $configOrApiKey; + } + $customHttpClient = $config['client'] ?? null; + if (array_key_exists('client', $config)) { + unset($config['client']); + } + + $config = $this->normalizeConfig($config); + if ($customHttpClient instanceof HttpClientInterface) { + $this->client = $customHttpClient; + } else { + $this->client = new CurlClient( + $config['base_uri'], + $config['custom_headers'], + $config['ca_bundle_path'] + ); + } + + // Set access token from config (api_key or access_token) + if (!empty($config['api_key'])) { + $this->accessToken = $config['api_key']; + } elseif (!empty($config['access_token'])) { + $this->accessToken = $config['access_token']; + } + } + + /** + * Returns the default access token. + * + * @return string|null + */ + public function getDefaultAccessToken(): ?string + { + return $this->accessToken; + } + + /** + * Sets the default access token. + * + * @param string $accessToken + * + * @return void + */ + public function setDefaultAccessToken(string $accessToken): void + { + $this->accessToken = $accessToken; + } + + /** + * Send a raw request through the configured HTTP client. + * + * @param string $method + * @param string $path + * @param array $body + * @param RequestOptions|null $requestOptions + * + * @return Response + */ + public function request( + string $method, + string $path, + array $body = [], + ?RequestOptions $requestOptions = null + ): Response { + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + return $this->client->send($method, $path, $body, $headers, $requestOptions); + } + + /** + * Resolve the access token that should be used for a service. + * + * @param string|null $accessToken + * + * @return string + * + * @throws ConfigurationException + */ + protected function resolveAccessToken(?string $accessToken = null): string + { + if (!empty($accessToken)) { + return $accessToken; + } + + if (empty($this->accessToken)) { + throw new ConfigurationException('No access token provided'); + } + + return $this->accessToken; + } + + /** + * Normalize configuration and apply defaults. + * + * @param array $config + * + * @return array + * + * @throws ConfigurationException + */ + private function normalizeConfig(array $config): array + { + $config = array_merge([ + 'api_key' => null, + 'access_token' => null, + 'base_uri' => 'https://api.sumup.com', + 'custom_headers' => [], + 'ca_bundle_path' => null, + ], $config); + + if ($config['api_key'] === null) { + $config['api_key'] = getenv('SUMUP_API_KEY') ?: null; + } + + if ($config['access_token'] === null) { + $config['access_token'] = getenv('SUMUP_ACCESS_TOKEN') ?: null; + } + + $headers = is_array($config['custom_headers']) ? $config['custom_headers'] : []; + $headers['Accept'] = 'application/problem+json, application/json'; + $headers['User-Agent'] = SdkInfo::getUserAgent(); + $config['custom_headers'] = $headers; + + return $config; + } + + /** + * Access the Checkouts API endpoints. + * + * @return Checkouts + */ + public function checkouts(): Checkouts + { + return new Checkouts($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Customers API endpoints. + * + * @return Customers + */ + public function customers(): Customers + { + return new Customers($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Members API endpoints. + * + * @return Members + */ + public function members(): Members + { + return new Members($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Memberships API endpoints. + * + * @return Memberships + */ + public function memberships(): Memberships + { + return new Memberships($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Merchants API endpoints. + * + * @return Merchants + */ + public function merchants(): Merchants + { + return new Merchants($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Payouts API endpoints. + * + * @return Payouts + */ + public function payouts(): Payouts + { + return new Payouts($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Readers API endpoints. + * + * @return Readers + */ + public function readers(): Readers + { + return new Readers($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Receipts API endpoints. + * + * @return Receipts + */ + public function receipts(): Receipts + { + return new Receipts($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Roles API endpoints. + * + * @return Roles + */ + public function roles(): Roles + { + return new Roles($this->client, $this->resolveAccessToken()); + } + + /** + * Access the Transactions API endpoints. + * + * @return Transactions + */ + public function transactions(): Transactions + { + return new Transactions($this->client, $this->resolveAccessToken()); + } +} diff --git a/vendor_prefixed/sumup-sdk/Transactions/Transactions.php b/vendor_prefixed/sumup-sdk/Transactions/Transactions.php new file mode 100644 index 0000000..01a57d1 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Transactions/Transactions.php @@ -0,0 +1,419 @@ + $amount, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + +} + +class TransactionsListResponse +{ + /** + * + * @var \SumUp\Types\TransactionHistory[]|null + */ + public ?array $items = null; + + /** + * + * @var \SumUp\Types\TransactionsHistoryLink[]|null + */ + public ?array $links = null; + +} + +/** + * Query parameters for TransactionsGetParams. + * + * @package SumUp\Services + */ +class TransactionsGetParams +{ + /** + * Retrieves the transaction resource with the specified transaction ID (the `id` parameter in the transaction resource). + * + * @var string|null + */ + public ?string $id = null; + + /** + * Retrieves the transaction resource with the specified transaction code. + * + * @var string|null + */ + public ?string $transactionCode = null; + + /** + * External/foreign transaction id (passed by clients). + * + * @var string|null + */ + public ?string $foreignTransactionId = null; + + /** + * Client transaction id. + * + * @var string|null + */ + public ?string $clientTransactionId = null; + +} + +/** + * Query parameters for TransactionsListParams. + * + * @package SumUp\Services + */ +class TransactionsListParams +{ + /** + * Retrieves the transaction resource with the specified transaction code. + * + * @var string|null + */ + public ?string $transactionCode = null; + + /** + * Specifies the order in which the returned results are displayed. + * + * @var string|null + */ + public ?string $order = null; + + /** + * Specifies the maximum number of results per page. Value must be a positive integer and if not specified, will return 10 results. + * + * @var int|null + */ + public ?int $limit = null; + + /** + * Filters the returned results by user email. + * + * @var string[]|null + */ + public ?array $users = null; + + /** + * Filters the returned results by the specified list of final statuses of the transactions. + * + * @var string[]|null + */ + public ?array $statusesList = null; + + /** + * Filters the returned results by the specified list of payment types used for the transactions. + * + * @var string[]|null + */ + public ?array $paymentTypes = null; + + /** + * Filters the returned results by the specified list of entry modes. + * + * @var string[]|null + */ + public ?array $entryModesList = null; + + /** + * Filters the returned results by the specified list of transaction types. + * + * @var string[]|null + */ + public ?array $types = null; + + /** + * Filters the results by the latest modification time of resources and returns only transactions that are modified *at or after* the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format). + * + * @var string|null + */ + public ?string $changesSince = null; + + /** + * Filters the results by the creation time of resources and returns only transactions that are created *before* the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format). + * + * @var string|null + */ + public ?string $newestTime = null; + + /** + * Filters the results by the reference ID of transaction events and returns only transactions with events whose IDs are *smaller* than the specified value. This parameters supersedes the `newest_time` parameter (if both are provided in the request). + * + * @var string|null + */ + public ?string $newestRef = null; + + /** + * Filters the results by the creation time of resources and returns only transactions that are created *at or after* the specified timestamp (in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) format). + * + * @var string|null + */ + public ?string $oldestTime = null; + + /** + * Filters the results by the reference ID of transaction events and returns only transactions with events whose IDs are *greater* than the specified value. This parameters supersedes the `oldest_time` parameter (if both are provided in the request). + * + * @var string|null + */ + public ?string $oldestRef = null; + +} + +/** + * Class Transactions + * + * Transactions represent completed or attempted payment operations processed for a merchant account. A transaction contains the core payment result, such as the amount, currency, payment method, creation time, and current high-level status. + * + * In addition to the main payment outcome, a transaction can contain related events that describe what happened after the original payment attempt. These events provide visibility into the financial lifecycle of the transaction, for example: + * - `PAYOUT`: the payment being prepared for payout or included in a payout to the merchant + * - `REFUND`: money returned to the payer + * - `CHARGE_BACK`: money reversed after the original payment + * - `PAYOUT_DEDUCTION`: an amount deducted from a payout to cover a refund or chargeback + * + * From an integrator's perspective, transactions are the authoritative record of payment outcomes. Use this tag to: + * - list transactions for reporting, reconciliation, and customer support workflows + * - retrieve a single transaction when you need the latest payment details + * - inspect `simple_status` for the current merchant-facing outcome of the payment + * - inspect `events` or `transaction_events` when you need refund, payout, or chargeback history + * + * Typical workflow: + * - create and process payments through the Checkouts endpoints + * - use the Transactions endpoints to read the resulting payment records + * - use the returned statuses and events to update your own order, accounting, or support systems + * + * @package SumUp\Services + */ +class Transactions implements SumUpService +{ + /** + * The client for the http communication. + * + * @var HttpClientInterface + */ + protected HttpClientInterface $client; + + /** + * The access token needed for authentication for the services. + * + * @var string + */ + protected string $accessToken; + + /** + * Transactions constructor. + * + * @param HttpClientInterface $client + * @param string $accessToken + */ + public function __construct(HttpClientInterface $client, string $accessToken) + { + $this->client = $client; + $this->accessToken = $accessToken; + } + + /** + * Retrieve a transaction + * + * @param string $merchantCode Merchant code of the account whose transaction should be retrieved. + * @param TransactionsGetParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Types\TransactionFull + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function get(string $merchantCode, ?TransactionsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\TransactionFull + { + $path = sprintf('/v2.1/merchants/%s/transactions', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->id)) { + $queryParamsData['id'] = $queryParams->id; + } + if (isset($queryParams->transactionCode)) { + $queryParamsData['transaction_code'] = $queryParams->transactionCode; + } + if (isset($queryParams->foreignTransactionId)) { + $queryParamsData['foreign_transaction_id'] = $queryParams->foreignTransactionId; + } + if (isset($queryParams->clientTransactionId)) { + $queryParamsData['client_transaction_id'] = $queryParams->clientTransactionId; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\TransactionFull::class, [ + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'GET', $path); + } + + /** + * List transactions + * + * @param string $merchantCode Merchant code of the account whose transaction history should be listed. + * @param TransactionsListParams|null $queryParams Optional query string parameters + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return \SumUp\Services\TransactionsListResponse + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function list(string $merchantCode, ?TransactionsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\TransactionsListResponse + { + $path = sprintf('/v2.1/merchants/%s/transactions/history', rawurlencode((string) $merchantCode)); + if ($queryParams !== null) { + $queryParamsData = []; + if (isset($queryParams->transactionCode)) { + $queryParamsData['transaction_code'] = $queryParams->transactionCode; + } + if (isset($queryParams->order)) { + $queryParamsData['order'] = $queryParams->order; + } + if (isset($queryParams->limit)) { + $queryParamsData['limit'] = $queryParams->limit; + } + if (isset($queryParams->users)) { + $queryParamsData['users'] = $queryParams->users; + } + if (isset($queryParams->statusesList)) { + $queryParamsData['statuses[]'] = $queryParams->statusesList; + } + if (isset($queryParams->paymentTypes)) { + $queryParamsData['payment_types'] = $queryParams->paymentTypes; + } + if (isset($queryParams->entryModesList)) { + $queryParamsData['entry_modes[]'] = $queryParams->entryModesList; + } + if (isset($queryParams->types)) { + $queryParamsData['types'] = $queryParams->types; + } + if (isset($queryParams->changesSince)) { + $queryParamsData['changes_since'] = $queryParams->changesSince; + } + if (isset($queryParams->newestTime)) { + $queryParamsData['newest_time'] = $queryParams->newestTime; + } + if (isset($queryParams->newestRef)) { + $queryParamsData['newest_ref'] = $queryParams->newestRef; + } + if (isset($queryParams->oldestTime)) { + $queryParamsData['oldest_time'] = $queryParams->oldestTime; + } + if (isset($queryParams->oldestRef)) { + $queryParamsData['oldest_ref'] = $queryParams->oldestRef; + } + if (!empty($queryParamsData)) { + $queryString = http_build_query($queryParamsData); + if (!empty($queryString)) { + $path .= '?' . $queryString; + } + } + } + $payload = []; + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\TransactionsListResponse::class, [ + '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + ], 'GET', $path); + } + + /** + * Refund a transaction + * + * @param string $merchantCode Merchant code of the account that owns the payment to refund. + * @param string $id Unique ID of the transaction. + * @param TransactionsRefundRequest|array|null $body Optional request payload + * @param RequestOptions|null $requestOptions Optional typed request options + * + * @return null + * @throws \SumUp\Exception\ApiException + * @throws \SumUp\Exception\UnexpectedApiException + * @throws \SumUp\Exception\ConnectionException + * @throws \SumUp\Exception\SDKException + */ + public function refund(string $merchantCode, string $id, TransactionsRefundRequest|array|null $body = null, ?RequestOptions $requestOptions = null): null + { + $path = sprintf('/v1.0/merchants/%s/payments/%s/refunds', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); + $payload = []; + if ($body !== null) { + $requestBody = $body; + if (is_array($requestBody)) { + $requestBody = TransactionsRefundRequest::fromArray($requestBody); + } + $payload = RequestEncoder::encode($requestBody); + } + $headers = RequestHeaders::build($this->accessToken, $requestOptions); + + $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); + + return ResponseDecoder::decodeOrThrow($response, [ + '204' => ['type' => 'void'], + ], [ + '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + ], 'POST', $path); + } +} diff --git a/vendor_prefixed/sumup-sdk/Types/Address.php b/vendor_prefixed/sumup-sdk/Types/Address.php new file mode 100644 index 0000000..dbaf00d --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/Address.php @@ -0,0 +1,131 @@ +|null + */ + public ?array $payload = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php new file mode 100644 index 0000000..dce1d6d --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php @@ -0,0 +1,165 @@ + $checkoutReference, + 'amount' => $amount, + 'currency' => $currency, + 'merchant_code' => $merchantCode, + 'description' => $description, + 'return_url' => $returnUrl, + 'customer_id' => $customerId, + 'purpose' => $purpose, + 'valid_until' => $validUntil, + 'redirect_url' => $redirectUrl, + 'hosted_checkout' => $hostedCheckout, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'checkout_reference' => 'checkoutReference', + 'amount' => 'amount', + 'currency' => 'currency', + 'merchant_code' => 'merchantCode', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php new file mode 100644 index 0000000..82f16f9 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php @@ -0,0 +1,28 @@ +|null + */ + public ?array $attributes = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php b/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php new file mode 100644 index 0000000..958ce69 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php @@ -0,0 +1,23 @@ + $totalAmount, + 'aade' => $aade, + 'affiliate' => $affiliate, + 'card_type' => $cardType, + 'description' => $description, + 'installments' => $installments, + 'return_url' => $returnUrl, + 'tip_rates' => $tipRates, + 'tip_timeout' => $tipTimeout, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'total_amount' => 'totalAmount', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php new file mode 100644 index 0000000..929e5a0 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php @@ -0,0 +1,35 @@ +|null + */ + public ?array $tags = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php new file mode 100644 index 0000000..cc79da5 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php @@ -0,0 +1,16 @@ + + */ + public array $errors; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php new file mode 100644 index 0000000..f308157 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php @@ -0,0 +1,18 @@ + + */ + public array $errors; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/Customer.php b/vendor_prefixed/sumup-sdk/Types/Customer.php new file mode 100644 index 0000000..9c191fc --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/Customer.php @@ -0,0 +1,72 @@ + $customerId, + 'personal_details' => $personalDetails, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'customer_id' => 'customerId', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} diff --git a/vendor_prefixed/sumup-sdk/Types/DetailsError.php b/vendor_prefixed/sumup-sdk/Types/DetailsError.php new file mode 100644 index 0000000..0913b86 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/DetailsError.php @@ -0,0 +1,40 @@ +[]|null + */ + public ?array $failedConstraints = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/Device.php b/vendor_prefixed/sumup-sdk/Types/Device.php new file mode 100644 index 0000000..a3f3fb1 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/Device.php @@ -0,0 +1,47 @@ +|null + */ + public ?array $metadata = null; + + /** + * Object attributes that are modifiable only by SumUp applications. + * + * @var array|null + */ + public ?array $attributes = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/MemberStatus.php b/vendor_prefixed/sumup-sdk/Types/MemberStatus.php new file mode 100644 index 0000000..fde5f45 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/MemberStatus.php @@ -0,0 +1,17 @@ +|null + */ + public ?array $metadata = null; + + /** + * Object attributes that are modifiable only by SumUp applications. + * + * @var array|null + */ + public ?array $attributes = null; + + /** + * Information about the resource the membership is in. + * + * @var MembershipResource + */ + public MembershipResource $resource; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipResource.php b/vendor_prefixed/sumup-sdk/Types/MembershipResource.php new file mode 100644 index 0000000..92be7b0 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/MembershipResource.php @@ -0,0 +1,64 @@ +|null + */ + public ?array $attributes = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php b/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php new file mode 100644 index 0000000..459faaa --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php @@ -0,0 +1,17 @@ +|null + */ + public ?array $meta = null; + + /** + * + * @var ClassicMerchantIdentifiers|null + */ + public ?ClassicMerchantIdentifiers $classic = null; + + /** + * The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH` endpoints. + * + * @var string|null + */ + public ?string $version = null; + + /** + * Reflects the status of changes submitted through the `PATCH` endpoints for the merchant or persons. If some changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status `done`. + * The status is only returned after write operations or on read endpoints when the `version` query parameter is provided. + * + * @var string|null + */ + public ?string $changeStatus = null; + + /** + * The date and time when the resource was created. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). + * + * @var string + */ + public string $createdAt; + + /** + * The date and time when the resource was last updated. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). + * + * @var string + */ + public string $updatedAt; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/NotFound.php b/vendor_prefixed/sumup-sdk/Types/NotFound.php new file mode 100644 index 0000000..3e41c3f --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/NotFound.php @@ -0,0 +1,18 @@ +|null + */ + public ?array $googlePay = null; + + /** + * Raw payment token object received from Apple Pay. Send the Apple Pay response payload as-is. + * + * @var array|null + */ + public ?array $applePay = null; + + /** + * Saved-card token to use instead of raw card details when processing with a previously stored payment instrument. + * + * @var string|null + */ + public ?string $token = null; + + /** + * Customer identifier associated with the saved payment instrument. Required when `token` is provided. + * + * @var string|null + */ + public ?string $customerId = null; + + /** + * Personal details for the customer. + * + * @var PersonalDetails|null + */ + public ?PersonalDetails $personalDetails = null; + + /** + * Create request DTO. + * + * @param ProcessCheckoutPaymentType|string $paymentType + * @param int|null $installments + * @param MandatePayload|null $mandate + * @param Card|null $card + * @param array|null $googlePay + * @param array|null $applePay + * @param string|null $token + * @param string|null $customerId + * @param PersonalDetails|null $personalDetails + */ + public function __construct( + ProcessCheckoutPaymentType|string $paymentType, + ?int $installments = null, + ?MandatePayload $mandate = null, + ?Card $card = null, + ?array $googlePay = null, + ?array $applePay = null, + ?string $token = null, + ?string $customerId = null, + ?PersonalDetails $personalDetails = null + ) { + \SumUp\Hydrator::hydrate([ + 'payment_type' => $paymentType, + 'installments' => $installments, + 'mandate' => $mandate, + 'card' => $card, + 'google_pay' => $googlePay, + 'apple_pay' => $applePay, + 'token' => $token, + 'customer_id' => $customerId, + 'personal_details' => $personalDetails, + ], self::class, $this); + } + + /** + * Create request DTO from an associative array. + * + * @param array $data + */ + public static function fromArray(array $data): self + { + self::assertRequiredFields($data, [ + 'payment_type' => 'paymentType', + ]); + + $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); + \SumUp\Hydrator::hydrate($data, self::class, $request); + + return $request; + } + + /** + * @param array $data + * @param array $requiredFields + */ + private static function assertRequiredFields(array $data, array $requiredFields): void + { + foreach ($requiredFields as $serializedName => $propertyName) { + if (!array_key_exists($serializedName, $data) && !array_key_exists($propertyName, $data)) { + throw new \InvalidArgumentException(sprintf('Missing required field "%s".', $serializedName)); + } + } + } + +} diff --git a/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php b/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php new file mode 100644 index 0000000..a65b2dc --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php @@ -0,0 +1,19 @@ +|null + */ + public ?array $metadata = null; + + /** + * Identifier of the system-managed service account associated with this reader. + * Present only for readers that are already paired. + * This field is currently in beta and may change. + * + * @var string|null + */ + public ?string $serviceAccountId = null; + + /** + * The timestamp of when the reader was created. + * + * @var string + */ + public string $createdAt; + + /** + * The timestamp of when the reader was last updated. + * + * @var string + */ + public string $updatedAt; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php b/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php new file mode 100644 index 0000000..e19425c --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php @@ -0,0 +1,26 @@ +|null + */ + public ?array $emvData = null; + + /** + * Acquirer-specific metadata related to the card authorization. + * + * @var ReceiptAcquirerData|null + */ + public ?ReceiptAcquirerData $acquirerData = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php b/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php new file mode 100644 index 0000000..de84a42 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php @@ -0,0 +1,36 @@ +[]|null + */ + public ?array $products = null; + + /** + * Vat rates. + * + * @var array[]|null + */ + public ?array $vatRates = null; + + /** + * Events + * + * @var ReceiptEvent[]|null + */ + public ?array $events = null; + + /** + * Receipt number + * + * @var string|null + */ + public ?string $receiptNo = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php b/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php new file mode 100644 index 0000000..f70e351 --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php @@ -0,0 +1,14 @@ +|null + */ + public ?array $metadata = null; + + /** + * The timestamp of when the role was created. + * + * @var string + */ + public string $createdAt; + + /** + * The timestamp of when the role was last updated. + * + * @var string + */ + public string $updatedAt; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponse.php b/vendor_prefixed/sumup-sdk/Types/StatusResponse.php new file mode 100644 index 0000000..a29abba --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponse.php @@ -0,0 +1,18 @@ +[]|null + */ + public ?array $vatRates = null; + + /** + * Detailed list of events related to the transaction. + * + * @var TransactionEvent[]|null + */ + public ?array $transactionEvents = null; + + /** + * High-level status of the transaction from the merchant's perspective. + * - `PENDING`: The payment has been initiated and is still being processed. A final outcome is not available yet. + * - `SUCCESSFUL`: The payment was completed successfully. + * - `PAID_OUT`: The payment was completed successfully and the funds have already been included in a payout to the merchant. + * - `FAILED`: The payment did not complete successfully. + * - `CANCELLED`: The payment was cancelled or reversed and is no longer payable or payable to the merchant. + * - `CANCEL_FAILED`: An attempt to cancel or reverse the payment was not completed successfully. + * - `REFUNDED`: The payment was refunded in full or in part. + * - `REFUND_FAILED`: An attempt to refund the payment was not completed successfully. + * - `CHARGEBACK`: The payment was subject to a chargeback. + * - `NON_COLLECTION`: The amount could not be collected from the merchant after a chargeback or related adjustment. + * + * @var TransactionFullSimpleStatus|null + */ + public ?TransactionFullSimpleStatus $simpleStatus = null; + + /** + * List of hyperlinks for accessing related resources. + * + * @var Link[]|null + */ + public ?array $links = null; + + /** + * Compact list of events related to the transaction. + * + * @var Event[]|null + */ + public ?array $events = null; + + /** + * Details of the payment location as received from the payment terminal. + * + * @var TransactionFullLocation|null + */ + public ?TransactionFullLocation $location = null; + + /** + * Indicates whether tax deduction is enabled for the transaction. + * + * @var bool|null + */ + public ?bool $taxEnabled = null; + +} diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php new file mode 100644 index 0000000..619063d --- /dev/null +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php @@ -0,0 +1,33 @@ + Date: Tue, 26 May 2026 21:33:36 +0200 Subject: [PATCH 03/12] feat: guard activation and prefixed SDK autoloading --- sumup-terminal-for-woocommerce.php | 34 +++++++++++++++++++ tests/regression/activation-guard.php | 23 +++++++++++++ .../prefixed-sdk-autoload-is-conditional.php | 21 ++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 tests/regression/activation-guard.php create mode 100644 tests/regression/prefixed-sdk-autoload-is-conditional.php diff --git a/sumup-terminal-for-woocommerce.php b/sumup-terminal-for-woocommerce.php index 1c80a45..6773daa 100644 --- a/sumup-terminal-for-woocommerce.php +++ b/sumup-terminal-for-woocommerce.php @@ -24,6 +24,8 @@ \define( 'SUTWC_VERSION', '0.0.8' ); \define( 'SUTWC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); \define( 'SUTWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); +\define( 'SUTWC_MINIMUM_PHP_VERSION', '7.4' ); +\define( 'SUTWC_MINIMUM_PHP_VERSION_ID', 70400 ); // Include Composer's autoloader. if ( file_exists( SUTWC_PLUGIN_DIR . 'vendor/autoload.php' ) ) { @@ -32,6 +34,13 @@ Logger::log( 'SumUp Terminal for WooCommerce: Composer autoloader not found.' ); } +// Include the prefixed official SumUp SDK only on PHP versions that can parse it. +// This runtime guard must happen before requiring the SDK autoloader. +$prefixed_sumup_autoload = SUTWC_PLUGIN_DIR . 'vendor_prefixed/sumup-sdk-autoload.php'; +if ( PHP_VERSION_ID >= 80200 && file_exists( $prefixed_sumup_autoload ) ) { + require_once $prefixed_sumup_autoload; +} + // Autoload classes using PSR-4. spl_autoload_register( function ( $class ): void { @@ -52,6 +61,31 @@ function ( $class ): void { } ); +/** + * Validate runtime requirements during plugin activation. + */ +function sutwc_activate(): void { + if ( PHP_VERSION_ID >= SUTWC_MINIMUM_PHP_VERSION_ID ) { + return; + } + + deactivate_plugins( plugin_basename( __FILE__ ) ); + + wp_die( + esc_html( + sprintf( + /* translators: 1: required PHP version, 2: current PHP version. */ + __( 'SumUp Terminal for WooCommerce requires PHP %1$s or newer. Your server is running PHP %2$s.', 'sumup-terminal-for-woocommerce' ), + SUTWC_MINIMUM_PHP_VERSION, + PHP_VERSION + ) + ), + esc_html__( 'Plugin activation failed', 'sumup-terminal-for-woocommerce' ), + array( 'back_link' => true ) + ); +} +register_activation_hook( __FILE__, __NAMESPACE__ . '\\sutwc_activate' ); + /** * Initialize the plugin. */ diff --git a/tests/regression/activation-guard.php b/tests/regression/activation-guard.php new file mode 100644 index 0000000..85ee219 --- /dev/null +++ b/tests/regression/activation-guard.php @@ -0,0 +1,23 @@ += SUTWC_MINIMUM_PHP_VERSION_ID') === false) { + fwrite(STDERR, "Activation guard does not perform the supported-runtime early return.\n"); + exit(1); +} + +echo "PASS: activation guard blocks unsupported plugin runtimes cleanly.\n"; diff --git a/tests/regression/prefixed-sdk-autoload-is-conditional.php b/tests/regression/prefixed-sdk-autoload-is-conditional.php new file mode 100644 index 0000000..cacef40 --- /dev/null +++ b/tests/regression/prefixed-sdk-autoload-is-conditional.php @@ -0,0 +1,21 @@ += 80200") === false) { + fwrite(STDERR, "Prefixed SDK autoloader is not guarded by PHP_VERSION_ID >= 80200.\n"); + exit(1); +} + +echo "PASS: prefixed SDK autoload is conditional.\n"; From a35473497bb1f3ff639c21497e8d2df45cf118f9 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:35:53 +0200 Subject: [PATCH 04/12] refactor: extract WordPress HTTP reader client --- .../Services/ReaderApiClientInterface.php | 22 ++ includes/Services/ReaderService.php | 241 +++++------------- .../Services/WordPressHttpReaderApiClient.php | 210 +++++++++++++++ 3 files changed, 289 insertions(+), 184 deletions(-) create mode 100644 includes/Services/ReaderApiClientInterface.php create mode 100644 includes/Services/WordPressHttpReaderApiClient.php diff --git a/includes/Services/ReaderApiClientInterface.php b/includes/Services/ReaderApiClientInterface.php new file mode 100644 index 0000000..a9a708d --- /dev/null +++ b/includes/Services/ReaderApiClientInterface.php @@ -0,0 +1,22 @@ +profile_service = $profile_service; + public function __construct( $api_key = '', ?ReaderApiClientInterface $client = null ) { + $this->client = $client ?: new WordPressHttpReaderApiClient( $api_key ); } /** - * Get all readers for the merchant. + * Set the profile service for lazy loading merchant ID. * - * @return array|false Readers data or false on failure. + * @param ProfileService $profile_service Profile service instance. */ - public function get_all() { - if ( ! $this->ensure_merchant_id() ) { - return false; - } + public function set_profile_service( ProfileService $profile_service ): void { + $this->client->set_profile_service( $profile_service ); + } - $result = parent::get( "/merchants/{$this->get_merchant_id()}/readers" ); - - if ( $result ) { - // Check if response has 'items' structure - if ( isset( $result['items'] ) && \is_array( $result['items'] ) ) { - return $result['items']; - } + public function get_all() { + return $this->client->get_all(); + } - return $result; - } + public function get_reader( $reader_id ) { + return $this->client->get_reader( $reader_id ); + } - return false; + public function create( array $data ) { + return $this->client->create( $data ); } - /** - * Get a specific reader by ID. - * - * @param string $reader_id Reader ID. - * - * @return array|false Reader data or false on failure. - */ - public function get_reader( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } + public function destroy( $reader_id ) { + return $this->client->destroy( $reader_id ); + } - return parent::get( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}" ); + public function checkout( $reader_id, $checkout_data ) { + return $this->client->checkout( $reader_id, $checkout_data ); } - /** - * Create/register a new reader. - * - * @param array $data Reader data. - * - * @return array|false Reader data or false on failure. - */ - public function create( array $data ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } + public function cancel_checkout( $reader_id ) { + return $this->client->cancel_checkout( $reader_id ); + } - return parent::post( "/merchants/{$this->get_merchant_id()}/readers", $data ); + public function get_status( $reader_id ) { + return $this->client->get_status( $reader_id ); } - /** - * Delete/unregister a reader. - * - * @param string $reader_id Reader ID. - * - * @return bool True on success, false on failure. - */ - public function destroy( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } + public function connect( $reader_id ) { + return $this->client->connect( $reader_id ); + } - $response = parent::delete( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}" ); + public function disconnect( $reader_id ) { + return $this->client->disconnect( $reader_id ); + } - return $response && ( $response['success'] ?? true ); + public function set_merchant_id( $merchant_id ): void { + $this->client->set_merchant_id( $merchant_id ); } - /** - * Initiate a checkout on a specific reader. - * - * @param string $reader_id Reader ID. - * @param array $checkout_data Checkout data. - * - * @return array|false Checkout response or false on failure. - */ - public function checkout( $reader_id, $checkout_data ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } + public function get_merchant_id() { + return $this->client->get_merchant_id(); + } - return parent::post( - "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/checkout", - $checkout_data - ); + public function has_api_key() { + return $this->client->has_api_key(); } /** @@ -125,7 +93,7 @@ public function checkout( $reader_id, $checkout_data ) { * @return array|false Checkout data or false on failure. */ public function create_checkout_for_order( $order, $reader_id ) { - if ( ! $this->has_api_key() || ! $this->ensure_merchant_id() ) { + if ( ! $this->client->has_api_key() ) { return false; } @@ -153,125 +121,30 @@ public function create_checkout_for_order( $order, $reader_id ) { // Construct webhook URL using WordPress AJAX with user-independent token and order ID $webhook_token = $this->generate_webhook_token( $order->get_id() ); - - $checkout_data['return_url'] = add_query_arg( array( - 'action' => 'sumup_webhook', - 'nonce' => $webhook_token, - 'order_id' => $order->get_id(), - ), admin_url( 'admin-ajax.php' ) ); + + $checkout_data['return_url'] = add_query_arg( + array( + 'action' => 'sumup_webhook', + 'nonce' => $webhook_token, + 'order_id' => $order->get_id(), + ), + admin_url( 'admin-ajax.php' ) + ); $result = $this->checkout( $reader_id, $checkout_data ); - + // If successful, save the transaction ID to the order if ( $result && isset( $result['data']['client_transaction_id'] ) ) { $transaction_id = $result['data']['client_transaction_id']; $order->set_transaction_id( $transaction_id ); $order->save(); - + Logger::log( 'SumUp transaction ID saved: ' . $transaction_id . ' for order: ' . $order->get_id() ); } return $result; } - /** - * Cancel/terminate a checkout on a reader. - * - * Note: This is an asynchronous operation. The API only confirms the terminate - * request was accepted, but actual termination may take time. If successful, - * a webhook will be sent to the return_url with status "FAILED". - * - * @param string $reader_id Reader ID. - * - * @return bool True if terminate request was accepted, false if rejected. - */ - public function cancel_checkout( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } - - // According to SumUp API docs, terminate action is sent to the reader - // This is asynchronous - no confirmation of actual termination - // No request body is required for terminate - $response = parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/terminate" ); - - // SumUp API returns HTTP 204 (no content) for terminate requests - // We consider it successful if the request was sent (no network error) - // The actual termination result will come via webhook to return_url - return ! is_wp_error( $response ); - } - - /** - * Get the status of a reader. - * - * @param string $reader_id Reader ID. - * - * @return array|false Reader status or false on failure. - */ - public function get_status( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } - - return parent::get( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/status" ); - } - - /** - * Connect to a reader. - * - * @param string $reader_id Reader ID. - * - * @return array|false Connection response or false on failure. - */ - public function connect( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } - - return parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/connect" ); - } - - /** - * Disconnect from a reader. - * - * @param string $reader_id Reader ID. - * - * @return bool True on success, false on failure. - */ - public function disconnect( $reader_id ) { - if ( ! $this->ensure_merchant_id() ) { - return false; - } - - $response = parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/disconnect" ); - - return $response && ( $response['success'] ?? true ); - } - - /** - * Get merchant ID, fetching it lazily if not set. - * - * @return null|string Merchant ID or null if unavailable. - */ - private function ensure_merchant_id() { - // If merchant ID is already set, return it - if ( $this->get_merchant_id() ) { - return $this->get_merchant_id(); - } - - // Try to fetch it from the profile service - if ( $this->profile_service ) { - $merchant_code = $this->profile_service->get_merchant_code(); - if ( $merchant_code ) { - $this->set_merchant_id( $merchant_code ); - - return $merchant_code; - } - } - - return null; - } - /** * Generate a webhook token for a specific order. * This is user-independent and suitable for external webhook validation. @@ -284,7 +157,7 @@ private function generate_webhook_token( $order_id ) { // Create a deterministic token based on order ID and WordPress salts // This is user-independent but specific to this WordPress installation $data = 'sumup_webhook_' . $order_id . wp_salt( 'nonce' ); - + return substr( wp_hash( $data ), 0, 10 ); } } diff --git a/includes/Services/WordPressHttpReaderApiClient.php b/includes/Services/WordPressHttpReaderApiClient.php new file mode 100644 index 0000000..815f77f --- /dev/null +++ b/includes/Services/WordPressHttpReaderApiClient.php @@ -0,0 +1,210 @@ +profile_service = $profile_service; + } + + /** + * Get all readers for the merchant. + * + * @return array|false Readers data or false on failure. + */ + public function get_all() { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + $result = parent::get( "/merchants/{$this->get_merchant_id()}/readers" ); + + if ( $result ) { + // Check if response has 'items' structure + if ( isset( $result['items'] ) && \is_array( $result['items'] ) ) { + return $result['items']; + } + + return $result; + } + + return false; + } + + /** + * Get a specific reader by ID. + * + * @param string $reader_id Reader ID. + * + * @return array|false Reader data or false on failure. + */ + public function get_reader( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + return parent::get( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}" ); + } + + /** + * Create/register a new reader. + * + * @param array $data Reader data. + * + * @return array|false Reader data or false on failure. + */ + public function create( array $data ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + return parent::post( "/merchants/{$this->get_merchant_id()}/readers", $data ); + } + + /** + * Delete/unregister a reader. + * + * @param string $reader_id Reader ID. + * + * @return bool True on success, false on failure. + */ + public function destroy( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + $response = parent::delete( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}" ); + + return $response && ( $response['success'] ?? true ); + } + + /** + * Initiate a checkout on a specific reader. + * + * @param string $reader_id Reader ID. + * @param array $checkout_data Checkout data. + * + * @return array|false Checkout response or false on failure. + */ + public function checkout( $reader_id, $checkout_data ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + return parent::post( + "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/checkout", + $checkout_data + ); + } + + /** + * Cancel/terminate a checkout on a reader. + * + * Note: This is an asynchronous operation. The API only confirms the terminate + * request was accepted, but actual termination may take time. If successful, + * a webhook will be sent to the return_url with status "FAILED". + * + * @param string $reader_id Reader ID. + * + * @return bool True if terminate request was accepted, false if rejected. + */ + public function cancel_checkout( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + // According to SumUp API docs, terminate action is sent to the reader + // This is asynchronous - no confirmation of actual termination + // No request body is required for terminate + $response = parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/terminate" ); + + // SumUp API returns HTTP 204 (no content) for terminate requests + // We consider it successful if the request was sent (no network error) + // The actual termination result will come via webhook to return_url + return ! is_wp_error( $response ); + } + + /** + * Get the status of a reader. + * + * @param string $reader_id Reader ID. + * + * @return array|false Reader status or false on failure. + */ + public function get_status( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + return parent::get( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/status" ); + } + + /** + * Connect to a reader. + * + * @param string $reader_id Reader ID. + * + * @return array|false Connection response or false on failure. + */ + public function connect( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + return parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/connect" ); + } + + /** + * Disconnect from a reader. + * + * @param string $reader_id Reader ID. + * + * @return bool True on success, false on failure. + */ + public function disconnect( $reader_id ) { + if ( ! $this->ensure_merchant_id() ) { + return false; + } + + $response = parent::post( "/merchants/{$this->get_merchant_id()}/readers/{$reader_id}/disconnect" ); + + return $response && ( $response['success'] ?? true ); + } + + /** + * Get merchant ID, fetching it lazily if not set. + * + * @return null|string Merchant ID or null if unavailable. + */ + private function ensure_merchant_id() { + // If merchant ID is already set, return it + if ( $this->get_merchant_id() ) { + return $this->get_merchant_id(); + } + + // Try to fetch it from the profile service + if ( $this->profile_service ) { + $merchant_code = $this->profile_service->get_merchant_code(); + if ( $merchant_code ) { + $this->set_merchant_id( $merchant_code ); + + return $merchant_code; + } + } + + return null; + } +} From e2da37945cb4aa0d3d79f098b4b73bc7270b5ed1 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:36:41 +0200 Subject: [PATCH 05/12] feat: show SumUp SDK compatibility status --- includes/Gateway.php | 3 ++ includes/Services/SdkAvailability.php | 35 +++++++++++++++++++ .../regression/sdk-compatibility-message.php | 29 +++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 includes/Services/SdkAvailability.php create mode 100644 tests/regression/sdk-compatibility-message.php diff --git a/includes/Gateway.php b/includes/Gateway.php index 33769cd..4a41b54 100644 --- a/includes/Gateway.php +++ b/includes/Gateway.php @@ -10,6 +10,7 @@ use WCPOS\WooCommercePOS\SumUpTerminal\Services\ProfileService; use WCPOS\WooCommercePOS\SumUpTerminal\Services\ReaderService; +use WCPOS\WooCommercePOS\SumUpTerminal\Services\SdkAvailability; /** * Class SumUpTerminalGateway. @@ -150,6 +151,8 @@ public static function register_gateway( $methods ) { public function admin_options(): void { parent::admin_options(); + echo wp_kses_post( $this->get_sdk_status_html() ); + // Add Connection Status section outside of form fields ?> diff --git a/includes/Services/SdkAvailability.php b/includes/Services/SdkAvailability.php new file mode 100644 index 0000000..9036042 --- /dev/null +++ b/includes/Services/SdkAvailability.php @@ -0,0 +1,35 @@ += self::MINIMUM_PHP_VERSION_ID; + } + + public static function is_sdk_available(): bool { + return self::is_php_version_supported() && class_exists( self::PREFIXED_SUMUP_CLASS ); + } + + public static function get_status_message(): string { + if ( self::is_sdk_available() ) { + return __( 'This site is using the official SumUp PHP SDK for supported Terminal API operations.', 'sumup-terminal-for-woocommerce' ); + } + + if ( ! self::is_php_version_supported() ) { + return sprintf( + /* translators: 1: current PHP version. */ + __( 'Your server is running PHP %1$s. The official SumUp PHP SDK requires PHP 8.2 or newer, so this plugin is using its WordPress HTTP compatibility client. Payments can still work normally. Upgrade to PHP 8.2+ to use the official SumUp SDK integration.', 'sumup-terminal-for-woocommerce' ), + PHP_VERSION + ); + } + + return __( 'The official SumUp PHP SDK is not bundled in this build, so this plugin is using its WordPress HTTP compatibility client. Payments can still work normally.', 'sumup-terminal-for-woocommerce' ); + } +} diff --git a/tests/regression/sdk-compatibility-message.php b/tests/regression/sdk-compatibility-message.php new file mode 100644 index 0000000..a960f66 --- /dev/null +++ b/tests/regression/sdk-compatibility-message.php @@ -0,0 +1,29 @@ +get_sdk_status_html()') === false) { + fwrite(STDERR, "Gateway does not render SDK status from admin_options().\n"); + exit(1); +} + +echo "PASS: SDK compatibility message is present.\n"; From 0494c8082f74382a1534dfb1baef2466a00cabfc Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:38:17 +0200 Subject: [PATCH 06/12] build: ensure SumUp SDK namespace prefix --- composer.json | 1 + tools/prefix-sumup-sdk-namespaces.php | 27 +++ vendor_prefixed/sumup-sdk/ApiVersion.php | 2 +- .../sumup-sdk/Checkouts/Checkouts.php | 148 ++++++++-------- .../sumup-sdk/Customers/Customers.php | 124 ++++++------- .../sumup-sdk/Exception/ApiException.php | 2 +- .../sumup-sdk/Exception/ArgumentException.php | 2 +- .../Exception/ConfigurationException.php | 2 +- .../Exception/ConnectionException.php | 2 +- .../sumup-sdk/Exception/ErrorEnvelope.php | 2 +- .../sumup-sdk/Exception/SDKException.php | 2 +- .../Exception/UnexpectedApiException.php | 2 +- .../sumup-sdk/ExceptionMessages.php | 2 +- .../sumup-sdk/HttpClient/CurlClient.php | 8 +- .../sumup-sdk/HttpClient/GuzzleClient.php | 10 +- .../HttpClient/HttpClientInterface.php | 2 +- .../sumup-sdk/HttpClient/RequestHeaders.php | 4 +- .../sumup-sdk/HttpClient/RequestOptions.php | 2 +- .../sumup-sdk/HttpClient/Response.php | 2 +- vendor_prefixed/sumup-sdk/Hydrator.php | 2 +- vendor_prefixed/sumup-sdk/Members/Members.php | 108 ++++++------ .../sumup-sdk/Memberships/Memberships.php | 32 ++-- .../sumup-sdk/Merchants/Merchants.php | 60 +++---- vendor_prefixed/sumup-sdk/Payouts/Payouts.php | 28 +-- vendor_prefixed/sumup-sdk/Readers/Readers.php | 166 +++++++++--------- .../sumup-sdk/Receipts/Receipts.php | 32 ++-- vendor_prefixed/sumup-sdk/RequestEncoder.php | 2 +- vendor_prefixed/sumup-sdk/ResponseDecoder.php | 8 +- vendor_prefixed/sumup-sdk/Roles/Roles.php | 104 +++++------ vendor_prefixed/sumup-sdk/SdkInfo.php | 2 +- .../sumup-sdk/Services/SumUpService.php | 2 +- vendor_prefixed/sumup-sdk/Shared/Shared.php | 2 +- vendor_prefixed/sumup-sdk/SumUp.php | 36 ++-- .../sumup-sdk/Transactions/Transactions.php | 70 ++++---- vendor_prefixed/sumup-sdk/Types/Address.php | 2 +- .../sumup-sdk/Types/AddressLegacy.php | 2 +- .../sumup-sdk/Types/BadRequest.php | 2 +- .../sumup-sdk/Types/BadRequestErrors.php | 2 +- .../sumup-sdk/Types/BadRequestErrorsType.php | 2 +- .../sumup-sdk/Types/BasePerson.php | 2 +- vendor_prefixed/sumup-sdk/Types/Branding.php | 2 +- .../sumup-sdk/Types/BusinessProfile.php | 2 +- vendor_prefixed/sumup-sdk/Types/Card.php | 2 +- .../sumup-sdk/Types/CardExpiryMonth.php | 2 +- .../sumup-sdk/Types/CardResponse.php | 2 +- .../sumup-sdk/Types/CardResponseType.php | 2 +- vendor_prefixed/sumup-sdk/Types/CardType.php | 2 +- vendor_prefixed/sumup-sdk/Types/Checkout.php | 2 +- .../sumup-sdk/Types/CheckoutAccepted.php | 2 +- .../Types/CheckoutAcceptedNextStep.php | 2 +- .../sumup-sdk/Types/CheckoutCreateRequest.php | 6 +- .../Types/CheckoutCreateRequestCurrency.php | 2 +- .../Types/CheckoutCreateRequestPurpose.php | 2 +- .../sumup-sdk/Types/CheckoutCurrency.php | 2 +- .../sumup-sdk/Types/CheckoutStatus.php | 2 +- .../sumup-sdk/Types/CheckoutSuccess.php | 2 +- .../CheckoutSuccessPaymentInstrument.php | 2 +- .../Types/ClassicMerchantIdentifiers.php | 2 +- vendor_prefixed/sumup-sdk/Types/Company.php | 2 +- .../sumup-sdk/Types/CompanyIdentifier.php | 2 +- .../Types/CreateReaderCheckoutError.php | 2 +- .../Types/CreateReaderCheckoutErrorErrors.php | 2 +- .../Types/CreateReaderCheckoutRequest.php | 6 +- .../Types/CreateReaderCheckoutRequestAade.php | 2 +- .../CreateReaderCheckoutRequestAffiliate.php | 2 +- .../CreateReaderCheckoutRequestCardType.php | 2 +- ...CreateReaderCheckoutRequestTotalAmount.php | 2 +- .../Types/CreateReaderCheckoutResponse.php | 2 +- .../CreateReaderCheckoutResponseData.php | 2 +- ...reateReaderCheckoutUnprocessableEntity.php | 2 +- .../Types/CreateReaderTerminateError.php | 2 +- .../CreateReaderTerminateErrorErrors.php | 2 +- ...eateReaderTerminateUnprocessableEntity.php | 2 +- vendor_prefixed/sumup-sdk/Types/Customer.php | 6 +- .../sumup-sdk/Types/DetailsError.php | 2 +- vendor_prefixed/sumup-sdk/Types/Device.php | 2 +- .../sumup-sdk/Types/ElvCardAccount.php | 2 +- vendor_prefixed/sumup-sdk/Types/Error.php | 2 +- .../sumup-sdk/Types/ErrorExtended.php | 2 +- .../sumup-sdk/Types/ErrorForbidden.php | 2 +- vendor_prefixed/sumup-sdk/Types/Event.php | 2 +- .../sumup-sdk/Types/EventStatus.php | 2 +- vendor_prefixed/sumup-sdk/Types/EventType.php | 2 +- .../sumup-sdk/Types/FinancialPayout.php | 2 +- .../sumup-sdk/Types/FinancialPayoutStatus.php | 2 +- .../sumup-sdk/Types/FinancialPayoutType.php | 2 +- .../sumup-sdk/Types/HostedCheckout.php | 2 +- vendor_prefixed/sumup-sdk/Types/Invite.php | 2 +- vendor_prefixed/sumup-sdk/Types/Link.php | 2 +- .../Types/ListPersonsResponseBody.php | 2 +- .../sumup-sdk/Types/MandatePayload.php | 2 +- .../sumup-sdk/Types/MandatePayloadType.php | 2 +- .../sumup-sdk/Types/MandateResponse.php | 2 +- .../sumup-sdk/Types/MandateResponseStatus.php | 2 +- vendor_prefixed/sumup-sdk/Types/Member.php | 2 +- .../sumup-sdk/Types/MemberStatus.php | 2 +- .../sumup-sdk/Types/Membership.php | 2 +- .../sumup-sdk/Types/MembershipResource.php | 2 +- .../sumup-sdk/Types/MembershipStatus.php | 2 +- .../sumup-sdk/Types/MembershipUser.php | 2 +- .../sumup-sdk/Types/MembershipUserClassic.php | 2 +- vendor_prefixed/sumup-sdk/Types/Merchant.php | 2 +- vendor_prefixed/sumup-sdk/Types/NotFound.php | 2 +- .../sumup-sdk/Types/NotFoundErrors.php | 2 +- vendor_prefixed/sumup-sdk/Types/Ownership.php | 2 +- .../Types/PaymentInstrumentResponse.php | 2 +- .../Types/PaymentInstrumentResponseCard.php | 2 +- .../PaymentInstrumentResponseCardType.php | 2 +- .../Types/PaymentInstrumentResponseType.php | 2 +- vendor_prefixed/sumup-sdk/Types/Person.php | 2 +- .../sumup-sdk/Types/PersonalDetails.php | 2 +- .../sumup-sdk/Types/PersonalIdentifier.php | 2 +- vendor_prefixed/sumup-sdk/Types/Problem.php | 2 +- .../sumup-sdk/Types/ProcessCheckout.php | 6 +- .../Types/ProcessCheckoutPaymentType.php | 2 +- vendor_prefixed/sumup-sdk/Types/Product.php | 2 +- vendor_prefixed/sumup-sdk/Types/Reader.php | 2 +- .../sumup-sdk/Types/ReaderDevice.php | 2 +- .../sumup-sdk/Types/ReaderDeviceModel.php | 2 +- .../sumup-sdk/Types/ReaderStatus.php | 2 +- vendor_prefixed/sumup-sdk/Types/Receipt.php | 2 +- .../sumup-sdk/Types/ReceiptAcquirerData.php | 2 +- .../sumup-sdk/Types/ReceiptCard.php | 2 +- .../sumup-sdk/Types/ReceiptEvent.php | 2 +- .../sumup-sdk/Types/ReceiptEventStatus.php | 2 +- .../sumup-sdk/Types/ReceiptEventType.php | 2 +- .../sumup-sdk/Types/ReceiptMerchantData.php | 2 +- .../ReceiptMerchantDataMerchantProfile.php | 2 +- ...eiptMerchantDataMerchantProfileAddress.php | 2 +- .../sumup-sdk/Types/ReceiptReader.php | 2 +- .../sumup-sdk/Types/ReceiptTransaction.php | 2 +- .../Types/ReceiptTransactionProcessAs.php | 2 +- vendor_prefixed/sumup-sdk/Types/Role.php | 2 +- .../sumup-sdk/Types/StatusResponse.php | 2 +- .../sumup-sdk/Types/StatusResponseData.php | 2 +- .../StatusResponseDataConnectionType.php | 2 +- .../Types/StatusResponseDataState.php | 2 +- .../Types/StatusResponseDataStatus.php | 2 +- .../sumup-sdk/Types/Timestamps.php | 2 +- .../sumup-sdk/Types/TransactionBase.php | 2 +- .../Types/TransactionBaseCurrency.php | 2 +- .../Types/TransactionBasePaymentType.php | 2 +- .../sumup-sdk/Types/TransactionBaseStatus.php | 2 +- .../Types/TransactionCheckoutInfo.php | 2 +- .../TransactionCheckoutInfoEntryMode.php | 2 +- .../sumup-sdk/Types/TransactionEvent.php | 2 +- .../Types/TransactionEventEventType.php | 2 +- .../Types/TransactionEventStatus.php | 2 +- .../sumup-sdk/Types/TransactionFull.php | 2 +- .../Types/TransactionFullLocation.php | 2 +- .../Types/TransactionFullPayoutType.php | 2 +- .../Types/TransactionFullProcessAs.php | 2 +- .../TransactionFullSimplePaymentType.php | 2 +- .../Types/TransactionFullSimpleStatus.php | 2 +- .../TransactionFullVerificationMethod.php | 2 +- .../sumup-sdk/Types/TransactionHistory.php | 2 +- .../Types/TransactionHistoryCardType.php | 2 +- .../Types/TransactionHistoryPayoutType.php | 2 +- .../Types/TransactionHistoryType.php | 2 +- .../Types/TransactionMixinHistory.php | 2 +- .../TransactionMixinHistoryPayoutPlan.php | 2 +- .../Types/TransactionsHistoryLink.php | 2 +- .../sumup-sdk/Types/Unauthorized.php | 2 +- .../sumup-sdk/Types/UnauthorizedErrors.php | 2 +- .../Types/UnauthorizedErrorsType.php | 2 +- vendor_prefixed/sumup-sdk/Version.php | 2 +- 166 files changed, 654 insertions(+), 626 deletions(-) create mode 100644 tools/prefix-sumup-sdk-namespaces.php diff --git a/composer.json b/composer.json index d31c1fa..b15a0c0 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "prefix-dependencies": [ "composer --working-dir=php-scoper install --no-dev --optimize-autoloader", "php php-scoper/vendor/bin/php-scoper add-prefix --config=php-scoper/scoper.inc.php --output-dir=vendor_prefixed/sumup-sdk --force", + "php tools/prefix-sumup-sdk-namespaces.php", "php tools/generate-prefixed-sumup-autoload.php", "composer dump-autoload -o" ] diff --git a/tools/prefix-sumup-sdk-namespaces.php b/tools/prefix-sumup-sdk-namespaces.php new file mode 100644 index 0000000..66d9b76 --- /dev/null +++ b/tools/prefix-sumup-sdk-namespaces.php @@ -0,0 +1,27 @@ +isFile() || $file->getExtension() !== 'php') { + continue; + } + + $path = $file->getPathname(); + $contents = file_get_contents($path); + $contents = preg_replace('/namespace\\s+SumUp\\b/', 'namespace ' . $prefix, $contents); + $contents = preg_replace('/use\\s+SumUp\\\\/', 'use ' . str_replace('\\', '\\\\', $prefix) . '\\\\', $contents); + $contents = preg_replace('/(? $context, 'target' => $target, ], self::class, $this); @@ -57,7 +57,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -188,22 +188,22 @@ public function __construct(HttpClientInterface $client, string $accessToken) /** * Create a checkout * - * @param \SumUp\Types\CheckoutCreateRequest|array $body Required request payload + * @param \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutCreateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Checkout - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function create(\SumUp\Types\CheckoutCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Checkout + public function create(\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutCreateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout { $path = '/v0.1/checkouts'; $payload = []; $requestBody = $body; if (is_array($requestBody)) { - $requestBody = \SumUp\Types\CheckoutCreateRequest::fromArray($requestBody); + $requestBody = \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutCreateRequest::fromArray($requestBody); } $payload = RequestEncoder::encode($requestBody); $headers = RequestHeaders::build($this->accessToken, $requestOptions); @@ -211,12 +211,12 @@ public function create(\SumUp\Types\CheckoutCreateRequest|array $body, ?RequestO $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\Checkout::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout::class], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\ErrorExtended::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorExtended::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'POST', $path); } @@ -228,10 +228,10 @@ public function create(\SumUp\Types\CheckoutCreateRequest|array $body, ?RequestO * @param RequestOptions|null $requestOptions Optional typed request options * * @return array - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function createApplePaySession(string $id, CheckoutsCreateApplePaySessionRequest|array|null $body = null, ?RequestOptions $requestOptions = null): array { @@ -252,7 +252,7 @@ public function createApplePaySession(string $id, CheckoutsCreateApplePaySession '200' => ['type' => 'object'], ], [ '400' => ['type' => 'mixed'], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'PUT', $path); } @@ -262,13 +262,13 @@ public function createApplePaySession(string $id, CheckoutsCreateApplePaySession * @param string $id Unique ID of the checkout resource. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Checkout - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function deactivate(string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\Checkout + public function deactivate(string $id, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout { $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); $payload = []; @@ -276,10 +276,10 @@ public function deactivate(string $id, ?RequestOptions $requestOptions = null): $response = $this->client->send('DELETE', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Checkout::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Checkout::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'DELETE', $path); } @@ -289,13 +289,13 @@ public function deactivate(string $id, ?RequestOptions $requestOptions = null): * @param string $id Unique ID of the checkout resource. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\CheckoutSuccess - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\CheckoutSuccess + public function get(string $id, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess { $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); $payload = []; @@ -303,9 +303,9 @@ public function get(string $id, ?RequestOptions $requestOptions = null): \SumUp\ $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\CheckoutSuccess::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'GET', $path); } @@ -315,11 +315,11 @@ public function get(string $id, ?RequestOptions $requestOptions = null): \SumUp\ * @param CheckoutsListParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\CheckoutSuccess[] - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess[] + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function list(?CheckoutsListParams $queryParams = null, ?RequestOptions $requestOptions = null): array { @@ -342,9 +342,9 @@ public function list(?CheckoutsListParams $queryParams = null, ?RequestOptions $ $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutSuccess::class]], + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess::class]], ], [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -355,13 +355,13 @@ public function list(?CheckoutsListParams $queryParams = null, ?RequestOptions $ * @param CheckoutsListAvailablePaymentMethodsParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsListAvailablePaymentMethodsParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse + public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsListAvailablePaymentMethodsParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse { $path = sprintf('/v0.1/merchants/%s/payment-methods', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -384,8 +384,8 @@ public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsList $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\DetailsError::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\CheckoutsListAvailablePaymentMethodsResponse::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\DetailsError::class], ], 'GET', $path); } @@ -393,22 +393,22 @@ public function listAvailablePaymentMethods(string $merchantCode, ?CheckoutsList * Process a checkout * * @param string $id Unique ID of the checkout resource. - * @param \SumUp\Types\ProcessCheckout|array $body Required request payload + * @param \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ProcessCheckout|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\CheckoutSuccess|\SumUp\Types\CheckoutAccepted - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess|\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutAccepted + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function process(string $id, \SumUp\Types\ProcessCheckout|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\CheckoutSuccess|\SumUp\Types\CheckoutAccepted + public function process(string $id, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ProcessCheckout|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess|\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutAccepted { $path = sprintf('/v0.1/checkouts/%s', rawurlencode((string) $id)); $payload = []; $requestBody = $body; if (is_array($requestBody)) { - $requestBody = \SumUp\Types\ProcessCheckout::fromArray($requestBody); + $requestBody = \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ProcessCheckout::fromArray($requestBody); } $payload = RequestEncoder::encode($requestBody); $headers = RequestHeaders::build($this->accessToken, $requestOptions); @@ -416,13 +416,13 @@ public function process(string $id, \SumUp\Types\ProcessCheckout|array $body, ?R $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '200' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutSuccess::class], - '202' => ['type' => 'class', 'class' => \SumUp\Types\CheckoutAccepted::class], + '200' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutSuccess::class], + '202' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CheckoutAccepted::class], ], [ '400' => ['type' => 'mixed'], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'PUT', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Customers/Customers.php b/vendor_prefixed/sumup-sdk/Customers/Customers.php index 981d5dd..0098a70 100644 --- a/vendor_prefixed/sumup-sdk/Customers/Customers.php +++ b/vendor_prefixed/sumup-sdk/Customers/Customers.php @@ -2,34 +2,34 @@ declare(strict_types=1); -namespace SumUp\Customers; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Customers; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\RequestEncoder; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\RequestEncoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; class CustomersUpdateRequest { /** * Personal details for the customer. * - * @var \SumUp\Types\PersonalDetails|null + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PersonalDetails|null */ - public ?\SumUp\Types\PersonalDetails $personalDetails = null; + public ?\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PersonalDetails $personalDetails = null; /** * Create request DTO. * - * @param \SumUp\Types\PersonalDetails|null $personalDetails + * @param \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PersonalDetails|null $personalDetails */ public function __construct( - ?\SumUp\Types\PersonalDetails $personalDetails = null + ?\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PersonalDetails $personalDetails = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'personal_details' => $personalDetails, ], self::class, $this); } @@ -42,7 +42,7 @@ public function __construct( public static function fromArray(array $data): self { $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -91,22 +91,22 @@ public function __construct(HttpClientInterface $client, string $accessToken) /** * Create a customer * - * @param \SumUp\Types\Customer|array $body Required request payload + * @param \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Customer - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function create(\SumUp\Types\Customer|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + public function create(\WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer { $path = '/v0.1/customers'; $payload = []; $requestBody = $body; if (is_array($requestBody)) { - $requestBody = \SumUp\Types\Customer::fromArray($requestBody); + $requestBody = \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer::fromArray($requestBody); } $payload = RequestEncoder::encode($requestBody); $headers = RequestHeaders::build($this->accessToken, $requestOptions); @@ -114,12 +114,12 @@ public function create(\SumUp\Types\Customer|array $body, ?RequestOptions $reque $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\Customer::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer::class], ], [ '400' => ['type' => 'mixed'], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'POST', $path); } @@ -131,10 +131,10 @@ public function create(\SumUp\Types\Customer|array $body, ?RequestOptions $reque * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function deactivatePaymentInstrument(string $customerId, string $token, ?RequestOptions $requestOptions = null): null { @@ -147,10 +147,10 @@ public function deactivatePaymentInstrument(string $customerId, string $token, ? return ResponseDecoder::decodeOrThrow($response, [ '204' => ['type' => 'void'], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'DELETE', $path); } @@ -160,13 +160,13 @@ public function deactivatePaymentInstrument(string $customerId, string $token, ? * @param string $customerId Unique ID of the saved customer resource. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Customer - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $customerId, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + public function get(string $customerId, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer { $path = sprintf('/v0.1/customers/%s', rawurlencode((string) $customerId)); $payload = []; @@ -174,10 +174,10 @@ public function get(string $customerId, ?RequestOptions $requestOptions = null): $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Customer::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'GET', $path); } @@ -187,11 +187,11 @@ public function get(string $customerId, ?RequestOptions $requestOptions = null): * @param string $customerId Unique ID of the saved customer resource. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\PaymentInstrumentResponse[] - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PaymentInstrumentResponse[] + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function listPaymentInstruments(string $customerId, ?RequestOptions $requestOptions = null): array { @@ -202,11 +202,11 @@ public function listPaymentInstruments(string $customerId, ?RequestOptions $requ $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\PaymentInstrumentResponse::class]], + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\PaymentInstrumentResponse::class]], ], [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'GET', $path); } @@ -217,13 +217,13 @@ public function listPaymentInstruments(string $customerId, ?RequestOptions $requ * @param CustomersUpdateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Customer - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function update(string $customerId, CustomersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Customer + public function update(string $customerId, CustomersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer { $path = sprintf('/v0.1/customers/%s', rawurlencode((string) $customerId)); $payload = []; @@ -236,10 +236,10 @@ public function update(string $customerId, CustomersUpdateRequest|array $body, ? $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Customer::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\ErrorForbidden::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Customer::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorForbidden::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'PUT', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Exception/ApiException.php b/vendor_prefixed/sumup-sdk/Exception/ApiException.php index 7babef8..0aacef8 100644 --- a/vendor_prefixed/sumup-sdk/Exception/ApiException.php +++ b/vendor_prefixed/sumup-sdk/Exception/ApiException.php @@ -1,6 +1,6 @@ $email, 'roles' => $roles, 'is_managed_user' => $isManagedUser, @@ -107,7 +107,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -170,7 +170,7 @@ public function __construct( ?array $attributes = null, ?MembersUpdateRequestUser $user = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'roles' => $roles, 'metadata' => $metadata, 'attributes' => $attributes, @@ -186,7 +186,7 @@ public function __construct( public static function fromArray(array $data): self { $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -197,7 +197,7 @@ class MembersListResponse { /** * - * @var \SumUp\Types\Member[] + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member[] */ public array $items; @@ -330,13 +330,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param MembersCreateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Member - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function create(string $merchantCode, MembersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + public function create(string $merchantCode, MembersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member { $path = sprintf('/v0.1/merchants/%s/members', rawurlencode((string) $merchantCode)); $payload = []; @@ -350,11 +350,11 @@ public function create(string $merchantCode, MembersCreateRequest|array $body, ? $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\Member::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member::class], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '429' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '429' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'POST', $path); } @@ -366,10 +366,10 @@ public function create(string $merchantCode, MembersCreateRequest|array $body, ? * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function delete(string $merchantCode, string $memberId, ?RequestOptions $requestOptions = null): null { @@ -382,7 +382,7 @@ public function delete(string $merchantCode, string $memberId, ?RequestOptions $ return ResponseDecoder::decodeOrThrow($response, [ '200' => ['type' => 'void'], ], [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'DELETE', $path); } @@ -393,13 +393,13 @@ public function delete(string $merchantCode, string $memberId, ?RequestOptions $ * @param string $memberId The ID of the member to retrieve. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Member - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $merchantCode, string $memberId, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + public function get(string $merchantCode, string $memberId, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member { $path = sprintf('/v0.1/merchants/%s/members/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $memberId)); $payload = []; @@ -407,8 +407,8 @@ public function get(string $merchantCode, string $memberId, ?RequestOptions $req $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Member::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -419,13 +419,13 @@ public function get(string $merchantCode, string $memberId, ?RequestOptions $req * @param MembersListParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\MembersListResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembersListResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function list(string $merchantCode, ?MembersListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\MembersListResponse + public function list(string $merchantCode, ?MembersListParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembersListResponse { $path = sprintf('/v0.1/merchants/%s/members', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -463,8 +463,8 @@ public function list(string $merchantCode, ?MembersListParams $queryParams = nul $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\MembersListResponse::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembersListResponse::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -476,13 +476,13 @@ public function list(string $merchantCode, ?MembersListParams $queryParams = nul * @param MembersUpdateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Member - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function update(string $merchantCode, string $memberId, MembersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Member + public function update(string $merchantCode, string $memberId, MembersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member { $path = sprintf('/v0.1/merchants/%s/members/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $memberId)); $payload = []; @@ -495,11 +495,11 @@ public function update(string $merchantCode, string $memberId, MembersUpdateRequ $response = $this->client->send('PUT', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Member::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Member::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'PUT', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Memberships/Memberships.php b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php index b337315..117e987 100644 --- a/vendor_prefixed/sumup-sdk/Memberships/Memberships.php +++ b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace SumUp\Memberships; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Memberships; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; class MembershipsListResponse { /** * - * @var \SumUp\Types\Membership[] + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Membership[] */ public array $items; @@ -149,13 +149,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param MembershipsListParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\MembershipsListResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembershipsListResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function list(?MembershipsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\MembershipsListResponse + public function list(?MembershipsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembershipsListResponse { $path = '/v0.1/memberships'; if ($queryParams !== null) { @@ -202,9 +202,9 @@ public function list(?MembershipsListParams $queryParams = null, ?RequestOptions $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\MembershipsListResponse::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\MembershipsListResponse::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Merchants/Merchants.php b/vendor_prefixed/sumup-sdk/Merchants/Merchants.php index 4727588..42af393 100644 --- a/vendor_prefixed/sumup-sdk/Merchants/Merchants.php +++ b/vendor_prefixed/sumup-sdk/Merchants/Merchants.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace SumUp\Merchants; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Merchants; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; /** * Query parameters for MerchantsGetParams. @@ -101,13 +101,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param MerchantsGetParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Merchant - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Merchant + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $merchantCode, ?MerchantsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Merchant + public function get(string $merchantCode, ?MerchantsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Merchant { $path = sprintf('/v1/merchants/%s', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -127,8 +127,8 @@ public function get(string $merchantCode, ?MerchantsGetParams $queryParams = nul $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Merchant::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Merchant::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -140,13 +140,13 @@ public function get(string $merchantCode, ?MerchantsGetParams $queryParams = nul * @param MerchantsGetPersonParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Person - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Person + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function getPerson(string $merchantCode, string $personId, ?MerchantsGetPersonParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Person + public function getPerson(string $merchantCode, string $personId, ?MerchantsGetPersonParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Person { $path = sprintf('/v1/merchants/%s/persons/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $personId)); if ($queryParams !== null) { @@ -166,8 +166,8 @@ public function getPerson(string $merchantCode, string $personId, ?MerchantsGetP $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Person::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Person::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -178,13 +178,13 @@ public function getPerson(string $merchantCode, string $personId, ?MerchantsGetP * @param MerchantsListPersonsParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\ListPersonsResponseBody - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ListPersonsResponseBody + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function listPersons(string $merchantCode, ?MerchantsListPersonsParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\ListPersonsResponseBody + public function listPersons(string $merchantCode, ?MerchantsListPersonsParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ListPersonsResponseBody { $path = sprintf('/v1/merchants/%s/persons', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -204,8 +204,8 @@ public function listPersons(string $merchantCode, ?MerchantsListPersonsParams $q $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\ListPersonsResponseBody::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ListPersonsResponseBody::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Payouts/Payouts.php b/vendor_prefixed/sumup-sdk/Payouts/Payouts.php index 362c16f..a302b18 100644 --- a/vendor_prefixed/sumup-sdk/Payouts/Payouts.php +++ b/vendor_prefixed/sumup-sdk/Payouts/Payouts.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace SumUp\Payouts; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Payouts; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; /** * Query parameters for PayoutsListParams. @@ -99,11 +99,11 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param PayoutsListParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\FinancialPayout[] - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\FinancialPayout[] + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function list(string $merchantCode, ?PayoutsListParams $queryParams = null, ?RequestOptions $requestOptions = null): array { @@ -138,10 +138,10 @@ public function list(string $merchantCode, ?PayoutsListParams $queryParams = nul $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\FinancialPayout::class]], + '200' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\FinancialPayout::class]], ], [ - '400' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \SumUp\Types\ErrorExtended::class]], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'array', 'items' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\ErrorExtended::class]], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Readers/Readers.php b/vendor_prefixed/sumup-sdk/Readers/Readers.php index 8cb839f..f03519f 100644 --- a/vendor_prefixed/sumup-sdk/Readers/Readers.php +++ b/vendor_prefixed/sumup-sdk/Readers/Readers.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace SumUp\Readers; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Readers; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\RequestEncoder; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\RequestEncoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; class ReadersCreateRequest { @@ -47,7 +47,7 @@ public function __construct( string $name, ?array $metadata = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'pairing_code' => $pairingCode, 'name' => $name, 'metadata' => $metadata, @@ -67,7 +67,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -131,7 +131,7 @@ public function __construct( ?string $name = null, ?array $metadata = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'name' => $name, 'metadata' => $metadata, ], self::class, $this); @@ -145,7 +145,7 @@ public function __construct( public static function fromArray(array $data): self { $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -156,7 +156,7 @@ class ReadersListResponse { /** * - * @var \SumUp\Types\Reader[] + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader[] */ public array $items; @@ -204,13 +204,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param ReadersCreateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Reader - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function create(string $merchantCode, ReadersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + public function create(string $merchantCode, ReadersCreateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader { $path = sprintf('/v0.1/merchants/%s/readers', rawurlencode((string) $merchantCode)); $payload = []; @@ -224,11 +224,11 @@ public function create(string $merchantCode, ReadersCreateRequest|array $body, ? $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\Reader::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader::class], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'POST', $path); } @@ -237,22 +237,22 @@ public function create(string $merchantCode, ReadersCreateRequest|array $body, ? * * @param string $merchantCode Merchant Code * @param string $readerId The unique identifier of the Reader - * @param \SumUp\Types\CreateReaderCheckoutRequest|array $body Required request payload + * @param \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\CreateReaderCheckoutResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function createCheckout(string $merchantCode, string $readerId, \SumUp\Types\CreateReaderCheckoutRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\CreateReaderCheckoutResponse + public function createCheckout(string $merchantCode, string $readerId, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutResponse { $path = sprintf('/v0.1/merchants/%s/readers/%s/checkout', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId)); $payload = []; $requestBody = $body; if (is_array($requestBody)) { - $requestBody = \SumUp\Types\CreateReaderCheckoutRequest::fromArray($requestBody); + $requestBody = \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutRequest::fromArray($requestBody); } $payload = RequestEncoder::encode($requestBody); $headers = RequestHeaders::build($this->accessToken, $requestOptions); @@ -260,12 +260,12 @@ public function createCheckout(string $merchantCode, string $readerId, \SumUp\Ty $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\CreateReaderCheckoutResponse::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\CreateReaderCheckoutResponse::class], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '422' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '422' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'POST', $path); } @@ -277,10 +277,10 @@ public function createCheckout(string $merchantCode, string $readerId, \SumUp\Ty * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function delete(string $merchantCode, string $id, ?RequestOptions $requestOptions = null): null { @@ -293,7 +293,7 @@ public function delete(string $merchantCode, string $id, ?RequestOptions $reques return ResponseDecoder::decodeOrThrow($response, [ '200' => ['type' => 'void'], ], [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'DELETE', $path); } @@ -304,13 +304,13 @@ public function delete(string $merchantCode, string $id, ?RequestOptions $reques * @param string $id The unique identifier of the reader. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Reader - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $merchantCode, string $id, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + public function get(string $merchantCode, string $id, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader { $path = sprintf('/v0.1/merchants/%s/readers/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); $payload = []; @@ -318,8 +318,8 @@ public function get(string $merchantCode, string $id, ?RequestOptions $requestOp $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Reader::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -330,13 +330,13 @@ public function get(string $merchantCode, string $id, ?RequestOptions $requestOp * @param string $readerId The unique identifier of the Reader * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\StatusResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\StatusResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function getStatus(string $merchantCode, string $readerId, ?RequestOptions $requestOptions = null): \SumUp\Types\StatusResponse + public function getStatus(string $merchantCode, string $readerId, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\StatusResponse { $path = sprintf('/v0.1/merchants/%s/readers/%s/status', rawurlencode((string) $merchantCode), rawurlencode((string) $readerId)); $payload = []; @@ -344,10 +344,10 @@ public function getStatus(string $merchantCode, string $readerId, ?RequestOption $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\StatusResponse::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\StatusResponse::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -357,13 +357,13 @@ public function getStatus(string $merchantCode, string $readerId, ?RequestOption * @param string $merchantCode Short unique identifier for the merchant. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\ReadersListResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\ReadersListResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Services\ReadersListResponse + public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\ReadersListResponse { $path = sprintf('/v0.1/merchants/%s/readers', rawurlencode((string) $merchantCode)); $payload = []; @@ -371,8 +371,8 @@ public function list(string $merchantCode, ?RequestOptions $requestOptions = nul $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\ReadersListResponse::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\ReadersListResponse::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -385,10 +385,10 @@ public function list(string $merchantCode, ?RequestOptions $requestOptions = nul * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function terminateCheckout(string $merchantCode, string $readerId, ReadersTerminateCheckoutRequest|array|null $body = null, ?RequestOptions $requestOptions = null): null { @@ -408,10 +408,10 @@ public function terminateCheckout(string $merchantCode, string $readerId, Reader return ResponseDecoder::decodeOrThrow($response, [ '202' => ['type' => 'void'], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '422' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '422' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'POST', $path); } @@ -423,13 +423,13 @@ public function terminateCheckout(string $merchantCode, string $readerId, Reader * @param ReadersUpdateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Reader - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function update(string $merchantCode, string $id, ReadersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Reader + public function update(string $merchantCode, string $id, ReadersUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader { $path = sprintf('/v0.1/merchants/%s/readers/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $id)); $payload = []; @@ -442,9 +442,9 @@ public function update(string $merchantCode, string $id, ReadersUpdateRequest|ar $response = $this->client->send('PATCH', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Reader::class, [ - '403' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Reader::class, [ + '403' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'PATCH', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Receipts/Receipts.php b/vendor_prefixed/sumup-sdk/Receipts/Receipts.php index bf4dde8..2464e51 100644 --- a/vendor_prefixed/sumup-sdk/Receipts/Receipts.php +++ b/vendor_prefixed/sumup-sdk/Receipts/Receipts.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace SumUp\Receipts; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Receipts; -namespace SumUp\Services; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services; -use SumUp\HttpClient\HttpClientInterface; -use SumUp\HttpClient\RequestHeaders; -use SumUp\HttpClient\RequestOptions; -use SumUp\ResponseDecoder; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\HttpClientInterface; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestHeaders; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\HttpClient\RequestOptions; +use WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\ResponseDecoder; /** * Query parameters for ReceiptsGetParams. @@ -76,13 +76,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param ReceiptsGetParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Receipt - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Receipt + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $id, ?ReceiptsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\Receipt + public function get(string $id, ?ReceiptsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Receipt { $path = sprintf('/v1.1/receipts/%s', rawurlencode((string) $id)); if ($queryParams !== null) { @@ -105,10 +105,10 @@ public function get(string $id, ?ReceiptsGetParams $queryParams = null, ?Request $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Receipt::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Receipt::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'GET', $path); } } diff --git a/vendor_prefixed/sumup-sdk/RequestEncoder.php b/vendor_prefixed/sumup-sdk/RequestEncoder.php index 1246f94..1dc233c 100644 --- a/vendor_prefixed/sumup-sdk/RequestEncoder.php +++ b/vendor_prefixed/sumup-sdk/RequestEncoder.php @@ -1,6 +1,6 @@ $name, 'permissions' => $permissions, 'metadata' => $metadata, @@ -77,7 +77,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -132,7 +132,7 @@ public function __construct( ?array $permissions = null, ?string $description = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'name' => $name, 'permissions' => $permissions, 'description' => $description, @@ -147,7 +147,7 @@ public function __construct( public static function fromArray(array $data): self { $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -158,7 +158,7 @@ class RolesListResponse { /** * - * @var \SumUp\Types\Role[] + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role[] */ public array $items; @@ -206,13 +206,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param RolesCreateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Role - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function create(string $merchantCode, RolesCreateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + public function create(string $merchantCode, RolesCreateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role { $path = sprintf('/v0.1/merchants/%s/roles', rawurlencode((string) $merchantCode)); $payload = []; @@ -226,10 +226,10 @@ public function create(string $merchantCode, RolesCreateRequest|array $body, ?Re $response = $this->client->send('POST', $path, $payload, $headers, $requestOptions); return ResponseDecoder::decodeOrThrow($response, [ - '201' => ['type' => 'class', 'class' => \SumUp\Types\Role::class], + '201' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role::class], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'POST', $path); } @@ -241,10 +241,10 @@ public function create(string $merchantCode, RolesCreateRequest|array $body, ?Re * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function delete(string $merchantCode, string $roleId, ?RequestOptions $requestOptions = null): null { @@ -257,8 +257,8 @@ public function delete(string $merchantCode, string $roleId, ?RequestOptions $re return ResponseDecoder::decodeOrThrow($response, [ '200' => ['type' => 'void'], ], [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'DELETE', $path); } @@ -269,13 +269,13 @@ public function delete(string $merchantCode, string $roleId, ?RequestOptions $re * @param string $roleId The ID of the role to retrieve. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Role - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $merchantCode, string $roleId, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + public function get(string $merchantCode, string $roleId, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role { $path = sprintf('/v0.1/merchants/%s/roles/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $roleId)); $payload = []; @@ -283,8 +283,8 @@ public function get(string $merchantCode, string $roleId, ?RequestOptions $reque $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Role::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -294,13 +294,13 @@ public function get(string $merchantCode, string $roleId, ?RequestOptions $reque * @param string $merchantCode Short unique identifier for the merchant. * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\RolesListResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\RolesListResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \SumUp\Services\RolesListResponse + public function list(string $merchantCode, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\RolesListResponse { $path = sprintf('/v0.1/merchants/%s/roles', rawurlencode((string) $merchantCode)); $payload = []; @@ -308,8 +308,8 @@ public function list(string $merchantCode, ?RequestOptions $requestOptions = nul $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\RolesListResponse::class, [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\RolesListResponse::class, [ + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -321,13 +321,13 @@ public function list(string $merchantCode, ?RequestOptions $requestOptions = nul * @param RolesUpdateRequest|array $body Required request payload * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\Role - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function update(string $merchantCode, string $roleId, RolesUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \SumUp\Types\Role + public function update(string $merchantCode, string $roleId, RolesUpdateRequest|array $body, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role { $path = sprintf('/v0.1/merchants/%s/roles/%s', rawurlencode((string) $merchantCode), rawurlencode((string) $roleId)); $payload = []; @@ -340,9 +340,9 @@ public function update(string $merchantCode, string $roleId, RolesUpdateRequest| $response = $this->client->send('PATCH', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\Role::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Role::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'PATCH', $path); } } diff --git a/vendor_prefixed/sumup-sdk/SdkInfo.php b/vendor_prefixed/sumup-sdk/SdkInfo.php index 1ddd54c..6f46720 100644 --- a/vendor_prefixed/sumup-sdk/SdkInfo.php +++ b/vendor_prefixed/sumup-sdk/SdkInfo.php @@ -1,6 +1,6 @@ $amount, ], self::class, $this); } @@ -45,7 +45,7 @@ public function __construct( public static function fromArray(array $data): self { $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } @@ -56,13 +56,13 @@ class TransactionsListResponse { /** * - * @var \SumUp\Types\TransactionHistory[]|null + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\TransactionHistory[]|null */ public ?array $items = null; /** * - * @var \SumUp\Types\TransactionsHistoryLink[]|null + * @var \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\TransactionsHistoryLink[]|null */ public ?array $links = null; @@ -264,13 +264,13 @@ public function __construct(HttpClientInterface $client, string $accessToken) * @param TransactionsGetParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Types\TransactionFull - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\TransactionFull + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function get(string $merchantCode, ?TransactionsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Types\TransactionFull + public function get(string $merchantCode, ?TransactionsGetParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\TransactionFull { $path = sprintf('/v2.1/merchants/%s/transactions', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -299,9 +299,9 @@ public function get(string $merchantCode, ?TransactionsGetParams $queryParams = $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Types\TransactionFull::class, [ - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\TransactionFull::class, [ + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'GET', $path); } @@ -312,13 +312,13 @@ public function get(string $merchantCode, ?TransactionsGetParams $queryParams = * @param TransactionsListParams|null $queryParams Optional query string parameters * @param RequestOptions|null $requestOptions Optional typed request options * - * @return \SumUp\Services\TransactionsListResponse - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @return \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\TransactionsListResponse + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ - public function list(string $merchantCode, ?TransactionsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \SumUp\Services\TransactionsListResponse + public function list(string $merchantCode, ?TransactionsListParams $queryParams = null, ?RequestOptions $requestOptions = null): \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\TransactionsListResponse { $path = sprintf('/v2.1/merchants/%s/transactions/history', rawurlencode((string) $merchantCode)); if ($queryParams !== null) { @@ -374,9 +374,9 @@ public function list(string $merchantCode, ?TransactionsListParams $queryParams $response = $this->client->send('GET', $path, $payload, $headers, $requestOptions); - return ResponseDecoder::decodeOrThrow($response, \SumUp\Services\TransactionsListResponse::class, [ - '400' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '401' => ['type' => 'class', 'class' => \SumUp\Types\Problem::class], + return ResponseDecoder::decodeOrThrow($response, \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Services\TransactionsListResponse::class, [ + '400' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '401' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Problem::class], ], 'GET', $path); } @@ -389,10 +389,10 @@ public function list(string $merchantCode, ?TransactionsListParams $queryParams * @param RequestOptions|null $requestOptions Optional typed request options * * @return null - * @throws \SumUp\Exception\ApiException - * @throws \SumUp\Exception\UnexpectedApiException - * @throws \SumUp\Exception\ConnectionException - * @throws \SumUp\Exception\SDKException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\UnexpectedApiException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\ConnectionException + * @throws \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Exception\SDKException */ public function refund(string $merchantCode, string $id, TransactionsRefundRequest|array|null $body = null, ?RequestOptions $requestOptions = null): null { @@ -412,8 +412,8 @@ public function refund(string $merchantCode, string $id, TransactionsRefundReque return ResponseDecoder::decodeOrThrow($response, [ '204' => ['type' => 'void'], ], [ - '404' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], - '409' => ['type' => 'class', 'class' => \SumUp\Types\Error::class], + '404' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], + '409' => ['type' => 'class', 'class' => \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types\Error::class], ], 'POST', $path); } } diff --git a/vendor_prefixed/sumup-sdk/Types/Address.php b/vendor_prefixed/sumup-sdk/Types/Address.php index dbaf00d..c4d9b77 100644 --- a/vendor_prefixed/sumup-sdk/Types/Address.php +++ b/vendor_prefixed/sumup-sdk/Types/Address.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * An address somewhere in the world. The address fields used depend on the country conventions. For example, in Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses is `state`, whereas in Chile it's `region`. diff --git a/vendor_prefixed/sumup-sdk/Types/AddressLegacy.php b/vendor_prefixed/sumup-sdk/Types/AddressLegacy.php index 6168d92..f7ecbfe 100644 --- a/vendor_prefixed/sumup-sdk/Types/AddressLegacy.php +++ b/vendor_prefixed/sumup-sdk/Types/AddressLegacy.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Profile's personal address information. diff --git a/vendor_prefixed/sumup-sdk/Types/BadRequest.php b/vendor_prefixed/sumup-sdk/Types/BadRequest.php index 448a2c5..3ede4b8 100644 --- a/vendor_prefixed/sumup-sdk/Types/BadRequest.php +++ b/vendor_prefixed/sumup-sdk/Types/BadRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * 400 Bad Request diff --git a/vendor_prefixed/sumup-sdk/Types/BadRequestErrors.php b/vendor_prefixed/sumup-sdk/Types/BadRequestErrors.php index 24321d5..f4f52b2 100644 --- a/vendor_prefixed/sumup-sdk/Types/BadRequestErrors.php +++ b/vendor_prefixed/sumup-sdk/Types/BadRequestErrors.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class BadRequestErrors { diff --git a/vendor_prefixed/sumup-sdk/Types/BadRequestErrorsType.php b/vendor_prefixed/sumup-sdk/Types/BadRequestErrorsType.php index de9b1be..8de80a9 100644 --- a/vendor_prefixed/sumup-sdk/Types/BadRequestErrorsType.php +++ b/vendor_prefixed/sumup-sdk/Types/BadRequestErrorsType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Key indicating type of error diff --git a/vendor_prefixed/sumup-sdk/Types/BasePerson.php b/vendor_prefixed/sumup-sdk/Types/BasePerson.php index 5ca488e..0fb01f8 100644 --- a/vendor_prefixed/sumup-sdk/Types/BasePerson.php +++ b/vendor_prefixed/sumup-sdk/Types/BasePerson.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Base schema for a person associated with a merchant. This can be a legal representative, business owner (ultimate beneficial owner), or an officer. A legal representative is the person who registered the merchant with SumUp. They should always have a `user_id`. diff --git a/vendor_prefixed/sumup-sdk/Types/Branding.php b/vendor_prefixed/sumup-sdk/Types/Branding.php index ed06a58..65d9404 100644 --- a/vendor_prefixed/sumup-sdk/Types/Branding.php +++ b/vendor_prefixed/sumup-sdk/Types/Branding.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products. diff --git a/vendor_prefixed/sumup-sdk/Types/BusinessProfile.php b/vendor_prefixed/sumup-sdk/Types/BusinessProfile.php index 115ce39..30be9fe 100644 --- a/vendor_prefixed/sumup-sdk/Types/BusinessProfile.php +++ b/vendor_prefixed/sumup-sdk/Types/BusinessProfile.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Business information about the merchant. This information will be visible to the merchant's customers. diff --git a/vendor_prefixed/sumup-sdk/Types/Card.php b/vendor_prefixed/sumup-sdk/Types/Card.php index f26db1f..1b522c0 100644 --- a/vendor_prefixed/sumup-sdk/Types/Card.php +++ b/vendor_prefixed/sumup-sdk/Types/Card.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * __Required when payment type is `card`.__ Details of the payment card. diff --git a/vendor_prefixed/sumup-sdk/Types/CardExpiryMonth.php b/vendor_prefixed/sumup-sdk/Types/CardExpiryMonth.php index 3ed2a12..e44426c 100644 --- a/vendor_prefixed/sumup-sdk/Types/CardExpiryMonth.php +++ b/vendor_prefixed/sumup-sdk/Types/CardExpiryMonth.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Month from the expiration time of the payment card. Accepted format is `MM`. diff --git a/vendor_prefixed/sumup-sdk/Types/CardResponse.php b/vendor_prefixed/sumup-sdk/Types/CardResponse.php index 82f6133..e044e6a 100644 --- a/vendor_prefixed/sumup-sdk/Types/CardResponse.php +++ b/vendor_prefixed/sumup-sdk/Types/CardResponse.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the payment card. diff --git a/vendor_prefixed/sumup-sdk/Types/CardResponseType.php b/vendor_prefixed/sumup-sdk/Types/CardResponseType.php index 0442c42..5ef922e 100644 --- a/vendor_prefixed/sumup-sdk/Types/CardResponseType.php +++ b/vendor_prefixed/sumup-sdk/Types/CardResponseType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Issuing card network of the payment card used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/CardType.php b/vendor_prefixed/sumup-sdk/Types/CardType.php index 227c8e7..7f7674b 100644 --- a/vendor_prefixed/sumup-sdk/Types/CardType.php +++ b/vendor_prefixed/sumup-sdk/Types/CardType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Issuing card network of the payment card used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/Checkout.php b/vendor_prefixed/sumup-sdk/Types/Checkout.php index d75c5ff..b937303 100644 --- a/vendor_prefixed/sumup-sdk/Types/Checkout.php +++ b/vendor_prefixed/sumup-sdk/Types/Checkout.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Core checkout resource returned by the Checkouts API. A checkout is created before payment processing and then updated as payment attempts, redirects, and resulting transactions are attached to it. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutAccepted.php b/vendor_prefixed/sumup-sdk/Types/CheckoutAccepted.php index a8cef87..9778e89 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutAccepted.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutAccepted.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Response returned when checkout processing requires an additional payer action, such as a 3DS challenge or a redirect to an external payment method page. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutAcceptedNextStep.php b/vendor_prefixed/sumup-sdk/Types/CheckoutAcceptedNextStep.php index a867560..c4d3290 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutAcceptedNextStep.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutAcceptedNextStep.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Instructions for the next action the payer or client must take. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php index dce1d6d..4c2d088 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Request body for creating a checkout before processing payment. Define the payment amount, currency, merchant, and optional customer or redirect behavior here. @@ -114,7 +114,7 @@ public function __construct( ?string $redirectUrl = null, ?HostedCheckout $hostedCheckout = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'checkout_reference' => $checkoutReference, 'amount' => $amount, 'currency' => $currency, @@ -144,7 +144,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php index 82f16f9..b3461cb 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestCurrency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supported currency values are enumerated above. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestPurpose.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestPurpose.php index 7b43a4e..22758b2 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestPurpose.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCreateRequestPurpose.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Business purpose of the checkout. Use `CHECKOUT` for a standard payment and `SETUP_RECURRING_PAYMENT` when collecting consent and payment details for future recurring charges. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutCurrency.php b/vendor_prefixed/sumup-sdk/Types/CheckoutCurrency.php index 211898d..e3a8ee3 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutCurrency.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutCurrency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supported currency values are enumerated above. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutStatus.php b/vendor_prefixed/sumup-sdk/Types/CheckoutStatus.php index 8855297..c1e08c4 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Current high-level state of the checkout. `PENDING` means the checkout exists but is not yet completed, `PAID` means a payment succeeded, `FAILED` means the latest processing attempt failed, and `EXPIRED` means the checkout can no longer be processed. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutSuccess.php b/vendor_prefixed/sumup-sdk/Types/CheckoutSuccess.php index b010083..952ccb8 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutSuccess.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutSuccess.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Checkout resource returned after a synchronous processing attempt. In addition to the base checkout fields, it can include the resulting transaction identifiers and any newly created payment instrument token. diff --git a/vendor_prefixed/sumup-sdk/Types/CheckoutSuccessPaymentInstrument.php b/vendor_prefixed/sumup-sdk/Types/CheckoutSuccessPaymentInstrument.php index cbaf58a..b6b31c7 100644 --- a/vendor_prefixed/sumup-sdk/Types/CheckoutSuccessPaymentInstrument.php +++ b/vendor_prefixed/sumup-sdk/Types/CheckoutSuccessPaymentInstrument.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the saved payment instrument created or reused during checkout processing. diff --git a/vendor_prefixed/sumup-sdk/Types/ClassicMerchantIdentifiers.php b/vendor_prefixed/sumup-sdk/Types/ClassicMerchantIdentifiers.php index 78ab7a3..b8d8b78 100644 --- a/vendor_prefixed/sumup-sdk/Types/ClassicMerchantIdentifiers.php +++ b/vendor_prefixed/sumup-sdk/Types/ClassicMerchantIdentifiers.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class ClassicMerchantIdentifiers { diff --git a/vendor_prefixed/sumup-sdk/Types/Company.php b/vendor_prefixed/sumup-sdk/Types/Company.php index 5a77c63..179bd6e 100644 --- a/vendor_prefixed/sumup-sdk/Types/Company.php +++ b/vendor_prefixed/sumup-sdk/Types/Company.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Information about the company or business. This is legal information that is used for verification. diff --git a/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php b/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php index 958ce69..705e1ea 100644 --- a/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php +++ b/vendor_prefixed/sumup-sdk/Types/CompanyIdentifier.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class CompanyIdentifier { diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutError.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutError.php index a49351f..f154e73 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutError.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutError.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error description diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutErrorErrors.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutErrorErrors.php index 3ba10f4..7c6493e 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutErrorErrors.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutErrorErrors.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class CreateReaderCheckoutErrorErrors { diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequest.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequest.php index cededd1..67f3e0e 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequest.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Reader Checkout @@ -111,7 +111,7 @@ public function __construct( ?array $tipRates = null, ?int $tipTimeout = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'total_amount' => $totalAmount, 'aade' => $aade, 'affiliate' => $affiliate, @@ -136,7 +136,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php index 929e5a0..24b1388 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAade.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Optional object containing data for transactions from ERP integrators in Greece that comply with the AADE 1155 protocol. diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAffiliate.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAffiliate.php index 26b5d50..716d7a4 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAffiliate.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestAffiliate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Affiliate metadata for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php index cc79da5..8c99476 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestCardType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * The card type of the card used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestTotalAmount.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestTotalAmount.php index ae2fd13..7e773c7 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestTotalAmount.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutRequestTotalAmount.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Amount structure. diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponse.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponse.php index b5262b6..b8b4563 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponse.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponse.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class CreateReaderCheckoutResponse { diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponseData.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponseData.php index 2158152..e32cb77 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponseData.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutResponseData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class CreateReaderCheckoutResponseData { diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutUnprocessableEntity.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutUnprocessableEntity.php index fdb7061..8aaeaf1 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutUnprocessableEntity.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderCheckoutUnprocessableEntity.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Unprocessable entity diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php index f308157..6f94acf 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateError.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error description diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateErrorErrors.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateErrorErrors.php index f5092d1..87a27d8 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateErrorErrors.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateErrorErrors.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class CreateReaderTerminateErrorErrors { diff --git a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateUnprocessableEntity.php b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateUnprocessableEntity.php index 7635ce8..5e7d0f1 100644 --- a/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateUnprocessableEntity.php +++ b/vendor_prefixed/sumup-sdk/Types/CreateReaderTerminateUnprocessableEntity.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Unprocessable entity diff --git a/vendor_prefixed/sumup-sdk/Types/Customer.php b/vendor_prefixed/sumup-sdk/Types/Customer.php index 9c191fc..2436b06 100644 --- a/vendor_prefixed/sumup-sdk/Types/Customer.php +++ b/vendor_prefixed/sumup-sdk/Types/Customer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Saved customer details. @@ -33,7 +33,7 @@ public function __construct( string $customerId, ?PersonalDetails $personalDetails = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'customer_id' => $customerId, 'personal_details' => $personalDetails, ], self::class, $this); @@ -51,7 +51,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } diff --git a/vendor_prefixed/sumup-sdk/Types/DetailsError.php b/vendor_prefixed/sumup-sdk/Types/DetailsError.php index 0913b86..440d0f6 100644 --- a/vendor_prefixed/sumup-sdk/Types/DetailsError.php +++ b/vendor_prefixed/sumup-sdk/Types/DetailsError.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error message structure. diff --git a/vendor_prefixed/sumup-sdk/Types/Device.php b/vendor_prefixed/sumup-sdk/Types/Device.php index a3f3fb1..e06dd7a 100644 --- a/vendor_prefixed/sumup-sdk/Types/Device.php +++ b/vendor_prefixed/sumup-sdk/Types/Device.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the device used to create the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/ElvCardAccount.php b/vendor_prefixed/sumup-sdk/Types/ElvCardAccount.php index 4ee785f..abbeb34 100644 --- a/vendor_prefixed/sumup-sdk/Types/ElvCardAccount.php +++ b/vendor_prefixed/sumup-sdk/Types/ElvCardAccount.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the ELV card account associated with the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/Error.php b/vendor_prefixed/sumup-sdk/Types/Error.php index 6186ab6..811435c 100644 --- a/vendor_prefixed/sumup-sdk/Types/Error.php +++ b/vendor_prefixed/sumup-sdk/Types/Error.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error message structure. diff --git a/vendor_prefixed/sumup-sdk/Types/ErrorExtended.php b/vendor_prefixed/sumup-sdk/Types/ErrorExtended.php index 286cb2b..ae9eee9 100644 --- a/vendor_prefixed/sumup-sdk/Types/ErrorExtended.php +++ b/vendor_prefixed/sumup-sdk/Types/ErrorExtended.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error payload with the invalid parameter reference. diff --git a/vendor_prefixed/sumup-sdk/Types/ErrorForbidden.php b/vendor_prefixed/sumup-sdk/Types/ErrorForbidden.php index bdc466d..9fd4a28 100644 --- a/vendor_prefixed/sumup-sdk/Types/ErrorForbidden.php +++ b/vendor_prefixed/sumup-sdk/Types/ErrorForbidden.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Error message for forbidden requests. diff --git a/vendor_prefixed/sumup-sdk/Types/Event.php b/vendor_prefixed/sumup-sdk/Types/Event.php index 288f7f1..c17a071 100644 --- a/vendor_prefixed/sumup-sdk/Types/Event.php +++ b/vendor_prefixed/sumup-sdk/Types/Event.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * High-level transaction event details. diff --git a/vendor_prefixed/sumup-sdk/Types/EventStatus.php b/vendor_prefixed/sumup-sdk/Types/EventStatus.php index eabcb10..ffb05c6 100644 --- a/vendor_prefixed/sumup-sdk/Types/EventStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/EventStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Status of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/EventType.php b/vendor_prefixed/sumup-sdk/Types/EventType.php index 4e814e8..791d01a 100644 --- a/vendor_prefixed/sumup-sdk/Types/EventType.php +++ b/vendor_prefixed/sumup-sdk/Types/EventType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/FinancialPayout.php b/vendor_prefixed/sumup-sdk/Types/FinancialPayout.php index f2f7789..e1600ec 100644 --- a/vendor_prefixed/sumup-sdk/Types/FinancialPayout.php +++ b/vendor_prefixed/sumup-sdk/Types/FinancialPayout.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A single payout-related record. diff --git a/vendor_prefixed/sumup-sdk/Types/FinancialPayoutStatus.php b/vendor_prefixed/sumup-sdk/Types/FinancialPayoutStatus.php index 0970c0f..ae345b4 100644 --- a/vendor_prefixed/sumup-sdk/Types/FinancialPayoutStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/FinancialPayoutStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Merchant-facing outcome of the payout record. diff --git a/vendor_prefixed/sumup-sdk/Types/FinancialPayoutType.php b/vendor_prefixed/sumup-sdk/Types/FinancialPayoutType.php index b168111..864024e 100644 --- a/vendor_prefixed/sumup-sdk/Types/FinancialPayoutType.php +++ b/vendor_prefixed/sumup-sdk/Types/FinancialPayoutType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * High-level payout record category. diff --git a/vendor_prefixed/sumup-sdk/Types/HostedCheckout.php b/vendor_prefixed/sumup-sdk/Types/HostedCheckout.php index d94b6e1..35b2cc8 100644 --- a/vendor_prefixed/sumup-sdk/Types/HostedCheckout.php +++ b/vendor_prefixed/sumup-sdk/Types/HostedCheckout.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the checkout response. diff --git a/vendor_prefixed/sumup-sdk/Types/Invite.php b/vendor_prefixed/sumup-sdk/Types/Invite.php index ab0a059..be29393 100644 --- a/vendor_prefixed/sumup-sdk/Types/Invite.php +++ b/vendor_prefixed/sumup-sdk/Types/Invite.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Pending invitation for membership. diff --git a/vendor_prefixed/sumup-sdk/Types/Link.php b/vendor_prefixed/sumup-sdk/Types/Link.php index 1b19364..d386698 100644 --- a/vendor_prefixed/sumup-sdk/Types/Link.php +++ b/vendor_prefixed/sumup-sdk/Types/Link.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of a link to a related resource. diff --git a/vendor_prefixed/sumup-sdk/Types/ListPersonsResponseBody.php b/vendor_prefixed/sumup-sdk/Types/ListPersonsResponseBody.php index b69ef6c..48410af 100644 --- a/vendor_prefixed/sumup-sdk/Types/ListPersonsResponseBody.php +++ b/vendor_prefixed/sumup-sdk/Types/ListPersonsResponseBody.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class ListPersonsResponseBody { diff --git a/vendor_prefixed/sumup-sdk/Types/MandatePayload.php b/vendor_prefixed/sumup-sdk/Types/MandatePayload.php index 612cb2f..202915d 100644 --- a/vendor_prefixed/sumup-sdk/Types/MandatePayload.php +++ b/vendor_prefixed/sumup-sdk/Types/MandatePayload.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Mandate details used when a checkout should create a reusable card token for future recurring or merchant-initiated payments. diff --git a/vendor_prefixed/sumup-sdk/Types/MandatePayloadType.php b/vendor_prefixed/sumup-sdk/Types/MandatePayloadType.php index ec68ad0..ad38d59 100644 --- a/vendor_prefixed/sumup-sdk/Types/MandatePayloadType.php +++ b/vendor_prefixed/sumup-sdk/Types/MandatePayloadType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of mandate to create for the saved payment instrument. diff --git a/vendor_prefixed/sumup-sdk/Types/MandateResponse.php b/vendor_prefixed/sumup-sdk/Types/MandateResponse.php index 319c030..909751b 100644 --- a/vendor_prefixed/sumup-sdk/Types/MandateResponse.php +++ b/vendor_prefixed/sumup-sdk/Types/MandateResponse.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the mandate linked to the saved payment instrument. diff --git a/vendor_prefixed/sumup-sdk/Types/MandateResponseStatus.php b/vendor_prefixed/sumup-sdk/Types/MandateResponseStatus.php index 4b1fadb..8746b11 100644 --- a/vendor_prefixed/sumup-sdk/Types/MandateResponseStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/MandateResponseStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Current lifecycle status of the mandate. diff --git a/vendor_prefixed/sumup-sdk/Types/Member.php b/vendor_prefixed/sumup-sdk/Types/Member.php index e30ee14..a5bc2a2 100644 --- a/vendor_prefixed/sumup-sdk/Types/Member.php +++ b/vendor_prefixed/sumup-sdk/Types/Member.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A member is user within specific resource identified by resource id, resource type, and associated roles. diff --git a/vendor_prefixed/sumup-sdk/Types/MemberStatus.php b/vendor_prefixed/sumup-sdk/Types/MemberStatus.php index fde5f45..4f6658b 100644 --- a/vendor_prefixed/sumup-sdk/Types/MemberStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/MemberStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * The status of the membership. diff --git a/vendor_prefixed/sumup-sdk/Types/Membership.php b/vendor_prefixed/sumup-sdk/Types/Membership.php index 1752915..d054d2c 100644 --- a/vendor_prefixed/sumup-sdk/Types/Membership.php +++ b/vendor_prefixed/sumup-sdk/Types/Membership.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A membership associates a user with a resource, memberships is defined by user, resource, resource type, and associated roles. diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipResource.php b/vendor_prefixed/sumup-sdk/Types/MembershipResource.php index 92be7b0..3a5e2f8 100644 --- a/vendor_prefixed/sumup-sdk/Types/MembershipResource.php +++ b/vendor_prefixed/sumup-sdk/Types/MembershipResource.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Information about the resource the membership is in. diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php b/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php index 459faaa..c45a46b 100644 --- a/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/MembershipStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * The status of the membership. diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipUser.php b/vendor_prefixed/sumup-sdk/Types/MembershipUser.php index b942c98..84e1795 100644 --- a/vendor_prefixed/sumup-sdk/Types/MembershipUser.php +++ b/vendor_prefixed/sumup-sdk/Types/MembershipUser.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Information about the user associated with the membership. diff --git a/vendor_prefixed/sumup-sdk/Types/MembershipUserClassic.php b/vendor_prefixed/sumup-sdk/Types/MembershipUserClassic.php index 2c75579..8165b44 100644 --- a/vendor_prefixed/sumup-sdk/Types/MembershipUserClassic.php +++ b/vendor_prefixed/sumup-sdk/Types/MembershipUserClassic.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Classic identifiers of the user. diff --git a/vendor_prefixed/sumup-sdk/Types/Merchant.php b/vendor_prefixed/sumup-sdk/Types/Merchant.php index 4d31c53..4e90b08 100644 --- a/vendor_prefixed/sumup-sdk/Types/Merchant.php +++ b/vendor_prefixed/sumup-sdk/Types/Merchant.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class Merchant { diff --git a/vendor_prefixed/sumup-sdk/Types/NotFound.php b/vendor_prefixed/sumup-sdk/Types/NotFound.php index 3e41c3f..8e3ebe3 100644 --- a/vendor_prefixed/sumup-sdk/Types/NotFound.php +++ b/vendor_prefixed/sumup-sdk/Types/NotFound.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * 404 Not Found diff --git a/vendor_prefixed/sumup-sdk/Types/NotFoundErrors.php b/vendor_prefixed/sumup-sdk/Types/NotFoundErrors.php index 80ef380..0443001 100644 --- a/vendor_prefixed/sumup-sdk/Types/NotFoundErrors.php +++ b/vendor_prefixed/sumup-sdk/Types/NotFoundErrors.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class NotFoundErrors { diff --git a/vendor_prefixed/sumup-sdk/Types/Ownership.php b/vendor_prefixed/sumup-sdk/Types/Ownership.php index 3ec60c3..1a42692 100644 --- a/vendor_prefixed/sumup-sdk/Types/Ownership.php +++ b/vendor_prefixed/sumup-sdk/Types/Ownership.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class Ownership { diff --git a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponse.php b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponse.php index ab5b7ff..3cd478e 100644 --- a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponse.php +++ b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponse.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payment Instrument Response diff --git a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCard.php b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCard.php index 1faa856..84b5525 100644 --- a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCard.php +++ b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCard.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the payment card. diff --git a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCardType.php b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCardType.php index 06ddd68..a4e8089 100644 --- a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCardType.php +++ b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseCardType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Issuing card network of the payment card used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseType.php b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseType.php index 88ddb52..1330832 100644 --- a/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseType.php +++ b/vendor_prefixed/sumup-sdk/Types/PaymentInstrumentResponseType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of the payment instrument. diff --git a/vendor_prefixed/sumup-sdk/Types/Person.php b/vendor_prefixed/sumup-sdk/Types/Person.php index c60023b..621b73a 100644 --- a/vendor_prefixed/sumup-sdk/Types/Person.php +++ b/vendor_prefixed/sumup-sdk/Types/Person.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class Person { diff --git a/vendor_prefixed/sumup-sdk/Types/PersonalDetails.php b/vendor_prefixed/sumup-sdk/Types/PersonalDetails.php index ae8793f..6d92bd0 100644 --- a/vendor_prefixed/sumup-sdk/Types/PersonalDetails.php +++ b/vendor_prefixed/sumup-sdk/Types/PersonalDetails.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Personal details for the customer. diff --git a/vendor_prefixed/sumup-sdk/Types/PersonalIdentifier.php b/vendor_prefixed/sumup-sdk/Types/PersonalIdentifier.php index 3fb6d63..639312a 100644 --- a/vendor_prefixed/sumup-sdk/Types/PersonalIdentifier.php +++ b/vendor_prefixed/sumup-sdk/Types/PersonalIdentifier.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class PersonalIdentifier { diff --git a/vendor_prefixed/sumup-sdk/Types/Problem.php b/vendor_prefixed/sumup-sdk/Types/Problem.php index 6735200..ab3edbe 100644 --- a/vendor_prefixed/sumup-sdk/Types/Problem.php +++ b/vendor_prefixed/sumup-sdk/Types/Problem.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A RFC 9457 problem details object. diff --git a/vendor_prefixed/sumup-sdk/Types/ProcessCheckout.php b/vendor_prefixed/sumup-sdk/Types/ProcessCheckout.php index 06384fc..46c36cb 100644 --- a/vendor_prefixed/sumup-sdk/Types/ProcessCheckout.php +++ b/vendor_prefixed/sumup-sdk/Types/ProcessCheckout.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Request body for attempting payment on an existing checkout. The required companion fields depend on the selected `payment_type`, for example card details, saved-card data, or payer information required by a specific payment method. @@ -96,7 +96,7 @@ public function __construct( ?string $customerId = null, ?PersonalDetails $personalDetails = null ) { - \SumUp\Hydrator::hydrate([ + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate([ 'payment_type' => $paymentType, 'installments' => $installments, 'mandate' => $mandate, @@ -121,7 +121,7 @@ public static function fromArray(array $data): self ]); $request = (new \ReflectionClass(self::class))->newInstanceWithoutConstructor(); - \SumUp\Hydrator::hydrate($data, self::class, $request); + \WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Hydrator::hydrate($data, self::class, $request); return $request; } diff --git a/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php b/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php index a65b2dc..06970cf 100644 --- a/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php +++ b/vendor_prefixed/sumup-sdk/Types/ProcessCheckoutPaymentType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payment method used for this processing attempt. It determines which additional request fields are required. diff --git a/vendor_prefixed/sumup-sdk/Types/Product.php b/vendor_prefixed/sumup-sdk/Types/Product.php index 646080a..948479f 100644 --- a/vendor_prefixed/sumup-sdk/Types/Product.php +++ b/vendor_prefixed/sumup-sdk/Types/Product.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Purchase product. diff --git a/vendor_prefixed/sumup-sdk/Types/Reader.php b/vendor_prefixed/sumup-sdk/Types/Reader.php index d649f14..7d9b927 100644 --- a/vendor_prefixed/sumup-sdk/Types/Reader.php +++ b/vendor_prefixed/sumup-sdk/Types/Reader.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A physical card reader device that can accept in-person payments. diff --git a/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php b/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php index e19425c..6953b6c 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php +++ b/vendor_prefixed/sumup-sdk/Types/ReaderDevice.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Information about the underlying physical device. diff --git a/vendor_prefixed/sumup-sdk/Types/ReaderDeviceModel.php b/vendor_prefixed/sumup-sdk/Types/ReaderDeviceModel.php index 494be92..2b50424 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReaderDeviceModel.php +++ b/vendor_prefixed/sumup-sdk/Types/ReaderDeviceModel.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Identifier of the model of the device. diff --git a/vendor_prefixed/sumup-sdk/Types/ReaderStatus.php b/vendor_prefixed/sumup-sdk/Types/ReaderStatus.php index f611e69..ce69367 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReaderStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/ReaderStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * The status of the reader object gives information about the current state of the reader. diff --git a/vendor_prefixed/sumup-sdk/Types/Receipt.php b/vendor_prefixed/sumup-sdk/Types/Receipt.php index 0145f61..4e55e37 100644 --- a/vendor_prefixed/sumup-sdk/Types/Receipt.php +++ b/vendor_prefixed/sumup-sdk/Types/Receipt.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Receipt details for a transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php b/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php index de84a42..c6c4dde 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptAcquirerData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Acquirer-specific metadata related to the card authorization. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptCard.php b/vendor_prefixed/sumup-sdk/Types/ReceiptCard.php index aaea744..1737fb2 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptCard.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptCard.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payment card details displayed on the receipt. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptEvent.php b/vendor_prefixed/sumup-sdk/Types/ReceiptEvent.php index 16466a3..9f3b0d9 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptEvent.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptEvent.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Transaction event details as rendered on the receipt. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptEventStatus.php b/vendor_prefixed/sumup-sdk/Types/ReceiptEventStatus.php index 12a17cd..8aaa3a4 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptEventStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptEventStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Status of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptEventType.php b/vendor_prefixed/sumup-sdk/Types/ReceiptEventType.php index 06ef736..fda2747 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptEventType.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptEventType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantData.php b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantData.php index 467a6fd..66b8cfb 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantData.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Receipt merchant data diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfile.php b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfile.php index 58e17cd..dd8a81e 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfile.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfile.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Merchant profile details displayed on the receipt. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfileAddress.php b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfileAddress.php index f734bab..a56e3b3 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfileAddress.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptMerchantDataMerchantProfileAddress.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class ReceiptMerchantDataMerchantProfileAddress { diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptReader.php b/vendor_prefixed/sumup-sdk/Types/ReceiptReader.php index 5b10470..1443c42 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptReader.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptReader.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Card reader details displayed on the receipt. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptTransaction.php b/vendor_prefixed/sumup-sdk/Types/ReceiptTransaction.php index 663afbd..b1d9954 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptTransaction.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptTransaction.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Transaction information. diff --git a/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php b/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php index f70e351..c46c360 100644 --- a/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php +++ b/vendor_prefixed/sumup-sdk/Types/ReceiptTransactionProcessAs.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Debit/Credit. diff --git a/vendor_prefixed/sumup-sdk/Types/Role.php b/vendor_prefixed/sumup-sdk/Types/Role.php index d98462e..98895cc 100644 --- a/vendor_prefixed/sumup-sdk/Types/Role.php +++ b/vendor_prefixed/sumup-sdk/Types/Role.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * A custom role that can be used to assign set of permissions to members. diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponse.php b/vendor_prefixed/sumup-sdk/Types/StatusResponse.php index a29abba..d0f723a 100644 --- a/vendor_prefixed/sumup-sdk/Types/StatusResponse.php +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponse.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Status of a device diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponseData.php b/vendor_prefixed/sumup-sdk/Types/StatusResponseData.php index 67e1e4a..91ee439 100644 --- a/vendor_prefixed/sumup-sdk/Types/StatusResponseData.php +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponseData.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class StatusResponseData { diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataConnectionType.php b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataConnectionType.php index 3ccbdb3..82b6f65 100644 --- a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataConnectionType.php +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataConnectionType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of connection used by the device diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataState.php b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataState.php index 02dfb8f..4fb9368 100644 --- a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataState.php +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataState.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Latest state of the device diff --git a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataStatus.php b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataStatus.php index 57fb333..a4ecb05 100644 --- a/vendor_prefixed/sumup-sdk/Types/StatusResponseDataStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/StatusResponseDataStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Status of a device diff --git a/vendor_prefixed/sumup-sdk/Types/Timestamps.php b/vendor_prefixed/sumup-sdk/Types/Timestamps.php index 6fa0c60..f68ac46 100644 --- a/vendor_prefixed/sumup-sdk/Types/Timestamps.php +++ b/vendor_prefixed/sumup-sdk/Types/Timestamps.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class Timestamps { diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionBase.php b/vendor_prefixed/sumup-sdk/Types/TransactionBase.php index 4178990..ba37f92 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionBase.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionBase.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionBaseCurrency.php b/vendor_prefixed/sumup-sdk/Types/TransactionBaseCurrency.php index 14d3bce..6fe87b3 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionBaseCurrency.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionBaseCurrency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supported currency values are enumerated above. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionBasePaymentType.php b/vendor_prefixed/sumup-sdk/Types/TransactionBasePaymentType.php index ded12b6..19dbcea 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionBasePaymentType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionBasePaymentType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payment type used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionBaseStatus.php b/vendor_prefixed/sumup-sdk/Types/TransactionBaseStatus.php index 633289a..869beac 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionBaseStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionBaseStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Current status of the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfo.php b/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfo.php index faa8993..8ae901c 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfo.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfo.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Checkout-specific fields associated with a transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfoEntryMode.php b/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfoEntryMode.php index b5f3043..14395b2 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfoEntryMode.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionCheckoutInfoEntryMode.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Entry mode of the payment details. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionEvent.php b/vendor_prefixed/sumup-sdk/Types/TransactionEvent.php index cee24d4..dd594cb 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionEvent.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionEvent.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Detailed information about a transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionEventEventType.php b/vendor_prefixed/sumup-sdk/Types/TransactionEventEventType.php index 9486d86..473ae29 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionEventEventType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionEventEventType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionEventStatus.php b/vendor_prefixed/sumup-sdk/Types/TransactionEventStatus.php index 3a17052..15e555d 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionEventStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionEventStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Status of the transaction event. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFull.php b/vendor_prefixed/sumup-sdk/Types/TransactionFull.php index 0c65c31..a4b61cf 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFull.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFull.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Full transaction resource with checkout, payout, and event details. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php index 619063d..fbcd1ab 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullLocation.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Details of the payment location as received from the payment terminal. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullPayoutType.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullPayoutType.php index 99dba61..ef73836 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullPayoutType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullPayoutType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payout type for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullProcessAs.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullProcessAs.php index 1ea4faa..3b8cff6 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullProcessAs.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullProcessAs.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Debit/Credit. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullSimplePaymentType.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullSimplePaymentType.php index 940be99..a767525 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullSimplePaymentType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullSimplePaymentType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Simple name of the payment type. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullSimpleStatus.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullSimpleStatus.php index cf605d7..1640c73 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullSimpleStatus.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullSimpleStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * High-level status of the transaction from the merchant's perspective. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionFullVerificationMethod.php b/vendor_prefixed/sumup-sdk/Types/TransactionFullVerificationMethod.php index 53a94b0..ef66a4a 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionFullVerificationMethod.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionFullVerificationMethod.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Verification method used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionHistory.php b/vendor_prefixed/sumup-sdk/Types/TransactionHistory.php index 6340405..16c0af0 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionHistory.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionHistory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Transaction entry returned in history listing responses. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryCardType.php b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryCardType.php index 8c5a4f8..309409c 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryCardType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryCardType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Issuing card network of the payment card used for the transaction. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryPayoutType.php b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryPayoutType.php index f677dfd..0c5bd91 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryPayoutType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryPayoutType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payout type. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryType.php b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryType.php index 85cfeb1..099d42c 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionHistoryType.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionHistoryType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Type of the transaction for the registered user specified in the `user` property. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistory.php b/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistory.php index 087540a..e1eed51 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistory.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Additional transaction fields used by history and detailed views. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistoryPayoutPlan.php b/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistoryPayoutPlan.php index b16c9a8..13f3e10 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistoryPayoutPlan.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionMixinHistoryPayoutPlan.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Payout plan of the registered user at the time when the transaction was made. diff --git a/vendor_prefixed/sumup-sdk/Types/TransactionsHistoryLink.php b/vendor_prefixed/sumup-sdk/Types/TransactionsHistoryLink.php index 97bc542..94b97a5 100644 --- a/vendor_prefixed/sumup-sdk/Types/TransactionsHistoryLink.php +++ b/vendor_prefixed/sumup-sdk/Types/TransactionsHistoryLink.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Hypermedia link used for transaction history pagination. diff --git a/vendor_prefixed/sumup-sdk/Types/Unauthorized.php b/vendor_prefixed/sumup-sdk/Types/Unauthorized.php index e23fbd1..df68bf2 100644 --- a/vendor_prefixed/sumup-sdk/Types/Unauthorized.php +++ b/vendor_prefixed/sumup-sdk/Types/Unauthorized.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * 401 Unauthorized diff --git a/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrors.php b/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrors.php index ccbbe15..7b4e723 100644 --- a/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrors.php +++ b/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrors.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; class UnauthorizedErrors { diff --git a/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrorsType.php b/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrorsType.php index 817bdc8..cc56d71 100644 --- a/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrorsType.php +++ b/vendor_prefixed/sumup-sdk/Types/UnauthorizedErrorsType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SumUp\Types; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp\Types; /** * Key indicating type of error. Present only for typed 401 responses (e.g. invalid token, invalid password). Absent for generic unauthorized responses. diff --git a/vendor_prefixed/sumup-sdk/Version.php b/vendor_prefixed/sumup-sdk/Version.php index e80e3b9..49b6845 100644 --- a/vendor_prefixed/sumup-sdk/Version.php +++ b/vendor_prefixed/sumup-sdk/Version.php @@ -2,7 +2,7 @@ // File generated from our OpenAPI spec -namespace SumUp; +namespace WCPOS\WooCommercePOS\SumUpTerminal\Vendor\SumUpSdk\SumUp; class Version { From f78abee1ce860fb674cfac9f0683f2f5bf0b8f28 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:39:59 +0200 Subject: [PATCH 07/12] feat: use official SumUp SDK when available --- includes/Services/ReaderApiClientFactory.php | 18 ++ includes/Services/ReaderService.php | 2 +- includes/Services/SdkReaderApiClient.php | 254 ++++++++++++++++++ tests/regression/sdk-reader-normalization.php | 51 ++++ 4 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 includes/Services/ReaderApiClientFactory.php create mode 100644 includes/Services/SdkReaderApiClient.php create mode 100644 tests/regression/sdk-reader-normalization.php diff --git a/includes/Services/ReaderApiClientFactory.php b/includes/Services/ReaderApiClientFactory.php new file mode 100644 index 0000000..df0fe7a --- /dev/null +++ b/includes/Services/ReaderApiClientFactory.php @@ -0,0 +1,18 @@ +client = $client ?: new WordPressHttpReaderApiClient( $api_key ); + $this->client = $client ? $client : ReaderApiClientFactory::create( $api_key ); } /** diff --git a/includes/Services/SdkReaderApiClient.php b/includes/Services/SdkReaderApiClient.php new file mode 100644 index 0000000..d815384 --- /dev/null +++ b/includes/Services/SdkReaderApiClient.php @@ -0,0 +1,254 @@ +api_key = $api_key; + $this->fallback = $fallback; + } + + public function set_profile_service( ProfileService $profile_service ): void { + $this->profile_service = $profile_service; + $this->fallback->set_profile_service( $profile_service ); + } + + public function set_merchant_id( $merchant_id ): void { + $this->merchant_id = $merchant_id; + $this->fallback->set_merchant_id( $merchant_id ); + } + + public function get_merchant_id() { + return $this->merchant_id ? $this->merchant_id : $this->fallback->get_merchant_id(); + } + + public function has_api_key() { + return ! empty( $this->api_key ); + } + + public function get_all() { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'list readers', + function () use ( $merchant_id ) { + $response = $this->get_readers_service()->list( $merchant_id ); + $items = $response->items ?? array(); + + return array_map( array( $this, 'normalize_reader' ), $items ); + }, + function () { + return $this->fallback->get_all(); + } + ); + } + + public function get_reader( $reader_id ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'get reader', + function () use ( $merchant_id, $reader_id ) { + return $this->normalize_reader( $this->get_readers_service()->get( $merchant_id, $reader_id ) ); + }, + function () use ( $reader_id ) { + return $this->fallback->get_reader( $reader_id ); + } + ); + } + + public function create( array $data ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'create reader', + function () use ( $merchant_id, $data ) { + return $this->normalize_reader( $this->get_readers_service()->create( $merchant_id, $data ) ); + }, + function () use ( $data ) { + return $this->fallback->create( $data ); + } + ); + } + + public function destroy( $reader_id ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'delete reader', + function () use ( $merchant_id, $reader_id ) { + $this->get_readers_service()->delete( $merchant_id, $reader_id ); + + return true; + }, + function () use ( $reader_id ) { + return $this->fallback->destroy( $reader_id ); + } + ); + } + + public function checkout( $reader_id, $checkout_data ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'create reader checkout', + function () use ( $merchant_id, $reader_id, $checkout_data ) { + return $this->normalize_checkout_response( $this->get_readers_service()->createCheckout( $merchant_id, $reader_id, $checkout_data ) ); + }, + function () use ( $reader_id, $checkout_data ) { + return $this->fallback->checkout( $reader_id, $checkout_data ); + } + ); + } + + public function cancel_checkout( $reader_id ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'terminate reader checkout', + function () use ( $merchant_id, $reader_id ) { + $this->get_readers_service()->terminateCheckout( $merchant_id, $reader_id ); + + return true; + }, + function () use ( $reader_id ) { + return $this->fallback->cancel_checkout( $reader_id ); + } + ); + } + + public function get_status( $reader_id ) { + $merchant_id = $this->ensure_merchant_id(); + if ( ! $merchant_id ) { + return false; + } + + return $this->sdk_call( + 'get reader status', + function () use ( $merchant_id, $reader_id ) { + return $this->normalize_status( $this->get_readers_service()->getStatus( $merchant_id, $reader_id ) ); + }, + function () use ( $reader_id ) { + return $this->fallback->get_status( $reader_id ); + } + ); + } + + public function connect( $reader_id ) { + return $this->fallback->connect( $reader_id ); + } + + public function disconnect( $reader_id ) { + return $this->fallback->disconnect( $reader_id ); + } + + private function ensure_merchant_id() { + if ( $this->merchant_id ) { + return $this->merchant_id; + } + + if ( $this->profile_service ) { + $merchant_code = $this->profile_service->get_merchant_code(); + if ( $merchant_code ) { + $this->set_merchant_id( $merchant_code ); + + return $merchant_code; + } + } + + return null; + } + + private function get_sdk() { + if ( $this->sdk ) { + return $this->sdk; + } + + $class = SdkAvailability::PREFIXED_SUMUP_CLASS; + $this->sdk = new $class( $this->api_key ); + + return $this->sdk; + } + + private function get_readers_service() { + $sdk = $this->get_sdk(); + + return $sdk->readers(); + } + + private function normalize_reader( $reader ) { + if ( is_array( $reader ) ) { + return $reader; + } + + return array( + 'id' => $reader->id ?? null, + 'name' => $reader->name ?? null, + 'status' => $this->enum_value( $reader->status ?? null ), + 'created_at' => $reader->createdAt ?? $reader->created_at ?? null, + 'device' => array( + 'model' => $this->enum_value( $reader->device->model ?? null ), + 'identifier' => $reader->device->identifier ?? null, + ), + ); + } + + private function normalize_status( $status ) { + return json_decode( wp_json_encode( $status ), true ); + } + + private function normalize_checkout_response( $response ) { + return json_decode( wp_json_encode( $response ), true ); + } + + private function enum_value( $value ) { + if ( is_object( $value ) && $value instanceof \BackedEnum ) { + return $value->value; + } + + if ( is_object( $value ) && property_exists( $value, 'value' ) ) { + return $value->value; + } + + return $value; + } + + private function sdk_call( $operation, callable $callback, callable $fallback ) { + try { + return $callback(); + } catch ( \Throwable $e ) { + Logger::log( 'SumUp SDK ' . $operation . ' failed; falling back to WordPress HTTP client: ' . $e->getMessage() ); + + return $fallback(); + } + } +} diff --git a/tests/regression/sdk-reader-normalization.php b/tests/regression/sdk-reader-normalization.php new file mode 100644 index 0000000..42c435b --- /dev/null +++ b/tests/regression/sdk-reader-normalization.php @@ -0,0 +1,51 @@ +newInstanceWithoutConstructor(); +$method = $reflection->getMethod('normalize_reader'); +if (PHP_VERSION_ID < 80100) { + $method->setAccessible(true); +} + +$reader = new stdClass(); +$reader->id = 'reader-123'; +$reader->name = 'Front Desk'; +$reader->status = 'paired'; +$reader->createdAt = '2026-05-26T10:00:00Z'; +$reader->device = new stdClass(); +$reader->device->model = 'solo'; +$reader->device->identifier = 'SN123'; + +$result = $method->invoke($client, $reader); + +$expected = array( + 'id' => 'reader-123', + 'name' => 'Front Desk', + 'status' => 'paired', + 'created_at' => '2026-05-26T10:00:00Z', + 'device' => array( + 'model' => 'solo', + 'identifier' => 'SN123', + ), +); + +if ($result !== $expected) { + fwrite(STDERR, "SDK reader normalization did not preserve the existing array shape.\n"); + fwrite(STDERR, var_export($result, true) . "\n"); + exit(1); +} + +echo "PASS: SDK reader normalization matches existing array shape.\n"; From 83834084de2ae5b775cc044ca9a58c6c4a9b7cb6 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:40:18 +0200 Subject: [PATCH 08/12] docs: document SumUp SDK hybrid strategy --- docs/adr/0001-sumup-sdk-hybrid.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/adr/0001-sumup-sdk-hybrid.md diff --git a/docs/adr/0001-sumup-sdk-hybrid.md b/docs/adr/0001-sumup-sdk-hybrid.md new file mode 100644 index 0000000..6ae6cc5 --- /dev/null +++ b/docs/adr/0001-sumup-sdk-hybrid.md @@ -0,0 +1,29 @@ +# ADR 0001: Use prefixed SumUp SDK on PHP 8.2+ with WordPress HTTP compatibility fallback + +## Status + +Accepted + +## Context + +This plugin integrates SumUp Terminal reader operations for WooCommerce. The previous Composer dependency, `sumup/sumup-ecom-php-sdk`, was unused and did not provide first-class Terminal reader operations. + +SumUp now publishes `sumup/sumup-php`, which includes reader support for listing, pairing, retrieving, deleting, checkout creation, checkout termination, and reader status. That SDK requires PHP 8.2+ and ext-curl, while this plugin continues to support WordPress sites running PHP 7.4+. + +WordPress also provides its own HTTP API, `wp_remote_request()`, which handles WordPress-specific hosting concerns such as proxies, filters, and transport selection. The official SDK uses its own cURL client; this is an intentional trade-off on PHP 8.2+ unless a future WordPress-backed SDK HTTP client is added. + +## Decision + +The plugin uses a prefixed copy of the official `sumup/sumup-php` SDK for supported Terminal reader operations when PHP 8.2+ is available and the prefixed SDK is bundled. + +On PHP 7.4-8.1, or when the prefixed SDK is unavailable, the plugin uses its WordPress HTTP compatibility client. Payments can still work normally in compatibility mode. + +The SDK is loaded through a PHP-version-guarded autoloader so older PHP runtimes do not parse PHP 8.2-only SDK files. + +## Consequences + +- Users on PHP 8.2+ get the official SDK path for supported operations. +- Users on older PHP versions keep the existing direct HTTP behavior. +- The plugin maintains two reader API transports, so behavior must remain covered by shared service-level tests or regression checks. +- Operations not exposed by the SDK, such as connect and disconnect, remain on the WordPress HTTP client. +- The settings UI explains when the compatibility client is active because the server PHP version is below 8.2. From 6f4032f59d719b1895910584c80f3c97b3979460 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:41:44 +0200 Subject: [PATCH 09/12] build: map prefixed SDK service classes --- tools/generate-prefixed-sumup-autoload.php | 5 +++++ vendor_prefixed/sumup-sdk-autoload.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/generate-prefixed-sumup-autoload.php b/tools/generate-prefixed-sumup-autoload.php index df2421c..c4f7474 100644 --- a/tools/generate-prefixed-sumup-autoload.php +++ b/tools/generate-prefixed-sumup-autoload.php @@ -61,6 +61,11 @@ static function (\$class) use (\$baseDir, \$prefix): void { \$relative = substr(\$class, strlen(\$prefix)); \$file = \$baseDir . str_replace('\\\\', '/', \$relative) . '.php'; + if (!is_file(\$file) && strpos(\$relative, 'Services\\\\') === 0) { + \$service = substr(\$relative, strlen('Services\\\\')); + \$file = \$baseDir . \$service . '/' . \$service . '.php'; + } + if (is_file(\$file)) { require \$file; } diff --git a/vendor_prefixed/sumup-sdk-autoload.php b/vendor_prefixed/sumup-sdk-autoload.php index 40f4c14..bdaa609 100644 --- a/vendor_prefixed/sumup-sdk-autoload.php +++ b/vendor_prefixed/sumup-sdk-autoload.php @@ -20,6 +20,11 @@ static function ($class) use ($baseDir, $prefix): void { $relative = substr($class, strlen($prefix)); $file = $baseDir . str_replace('\\', '/', $relative) . '.php'; + if (!is_file($file) && strpos($relative, 'Services\\') === 0) { + $service = substr($relative, strlen('Services\\')); + $file = $baseDir . $service . '/' . $service . '.php'; + } + if (is_file($file)) { require $file; } From e51e4ccf9ef868f83360ce84870fe9d731406d5d Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Tue, 26 May 2026 21:42:35 +0200 Subject: [PATCH 10/12] chore: tidy SDK integration lint metadata --- includes/Services/ReaderApiClientFactory.php | 4 ++++ includes/Services/ReaderApiClientInterface.php | 4 ++++ includes/Services/SdkAvailability.php | 4 ++++ includes/Services/SdkReaderApiClient.php | 4 ++++ includes/Services/WordPressHttpReaderApiClient.php | 2 ++ sumup-terminal-for-woocommerce.php | 6 +++--- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/Services/ReaderApiClientFactory.php b/includes/Services/ReaderApiClientFactory.php index df0fe7a..35539c3 100644 --- a/includes/Services/ReaderApiClientFactory.php +++ b/includes/Services/ReaderApiClientFactory.php @@ -1,10 +1,14 @@ = 80200 && file_exists( $prefixed_sumup_autoload ) ) { - require_once $prefixed_sumup_autoload; +$sutwc_prefixed_sumup_autoload = SUTWC_PLUGIN_DIR . 'vendor_prefixed/sumup-sdk-autoload.php'; +if ( PHP_VERSION_ID >= 80200 && file_exists( $sutwc_prefixed_sumup_autoload ) ) { + require_once $sutwc_prefixed_sumup_autoload; } // Autoload classes using PSR-4. From 0904aeb7088da6896b0858d8bfe06c50037132bb Mon Sep 17 00:00:00 2001 From: "wcpos-agents[bot]" <2860316+wcpos-agents[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 19:53:48 +0000 Subject: [PATCH 11/12] Fix SDK status and checkout normalization --- includes/Gateway.php | 22 +++++++++++++ includes/Services/SdkReaderApiClient.php | 20 ++++++++++- tests/regression/sdk-reader-normalization.php | 33 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/includes/Gateway.php b/includes/Gateway.php index 4a41b54..0626dae 100644 --- a/includes/Gateway.php +++ b/includes/Gateway.php @@ -529,6 +529,28 @@ private function get_connection_status_html() { return $html; } + /** + * Get the SDK status HTML for display. + * + * @return string HTML for SDK status. + */ + private function get_sdk_status_html() { + $type = SdkAvailability::is_sdk_available() ? 'success' : 'info'; + + $html = '
'; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= $this->render_status_card( $type, __( 'Terminal API Client', 'sumup-terminal-for-woocommerce' ), SdkAvailability::get_status_message() ); + $html .= '
'; + + return $html; + } + /** * Render a status card. * diff --git a/includes/Services/SdkReaderApiClient.php b/includes/Services/SdkReaderApiClient.php index eb24399..a56a684 100644 --- a/includes/Services/SdkReaderApiClient.php +++ b/includes/Services/SdkReaderApiClient.php @@ -231,7 +231,7 @@ private function normalize_status( $status ) { } private function normalize_checkout_response( $response ) { - return json_decode( wp_json_encode( $response ), true ); + return $this->snake_case_array_keys( json_decode( wp_json_encode( $response ), true ) ); } private function enum_value( $value ) { @@ -246,6 +246,24 @@ private function enum_value( $value ) { return $value; } + private function snake_case_array_keys( $value ) { + if ( ! is_array( $value ) ) { + return $value; + } + + $normalized = array(); + + foreach ( $value as $key => $item ) { + if ( is_string( $key ) ) { + $key = strtolower( preg_replace( '/(?snake_case_array_keys( $item ); + } + + return $normalized; + } + private function sdk_call( $operation, callable $callback, callable $fallback ) { try { return $callback(); diff --git a/tests/regression/sdk-reader-normalization.php b/tests/regression/sdk-reader-normalization.php index 42c435b..32a58db 100644 --- a/tests/regression/sdk-reader-normalization.php +++ b/tests/regression/sdk-reader-normalization.php @@ -49,3 +49,36 @@ function wp_json_encode($data) { } echo "PASS: SDK reader normalization matches existing array shape.\n"; + +$checkoutMethod = $reflection->getMethod('normalize_checkout_response'); +if (PHP_VERSION_ID < 80100) { + $checkoutMethod->setAccessible(true); +} + +$checkout = (object) array( + 'data' => (object) array( + 'clientTransactionId' => 'txn-123', + 'totalAmount' => (object) array( + 'minorUnit' => 2, + ), + ), +); + +$checkoutResult = $checkoutMethod->invoke($client, $checkout); + +$expectedCheckout = array( + 'data' => array( + 'client_transaction_id' => 'txn-123', + 'total_amount' => array( + 'minor_unit' => 2, + ), + ), +); + +if ($checkoutResult !== $expectedCheckout) { + fwrite(STDERR, "SDK checkout normalization did not convert response keys to snake_case.\n"); + fwrite(STDERR, var_export($checkoutResult, true) . "\n"); + exit(1); +} + +echo "PASS: SDK checkout normalization matches existing array shape.\n"; From c37e9ba29a5b9c6cfa3db4ee9d6b4428f02ac752 Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 26 May 2026 21:48:09 +0000 Subject: [PATCH 12/12] fix: address sdk readiness audit feedback --- .../Services/WordPressHttpReaderApiClient.php | 6 +++- tools/generate-prefixed-sumup-autoload.php | 7 +++- tools/prefix-sumup-sdk-namespaces.php | 35 ++++++++++++++++--- .../sumup-sdk/HttpClient/CurlClient.php | 3 ++ .../sumup-sdk/Memberships/Memberships.php | 22 +++++++++--- vendor_prefixed/sumup-sdk/Readers/Readers.php | 4 +++ vendor_prefixed/sumup-sdk/RequestEncoder.php | 2 +- 7 files changed, 68 insertions(+), 11 deletions(-) diff --git a/includes/Services/WordPressHttpReaderApiClient.php b/includes/Services/WordPressHttpReaderApiClient.php index bbf3ee8..9ab970f 100644 --- a/includes/Services/WordPressHttpReaderApiClient.php +++ b/includes/Services/WordPressHttpReaderApiClient.php @@ -136,7 +136,11 @@ public function cancel_checkout( $reader_id ) { // SumUp API returns HTTP 204 (no content) for terminate requests // We consider it successful if the request was sent (no network error) // The actual termination result will come via webhook to return_url - return ! is_wp_error( $response ); + if ( false === $response || is_wp_error( $response ) ) { + return false; + } + + return true; } /** diff --git a/tools/generate-prefixed-sumup-autoload.php b/tools/generate-prefixed-sumup-autoload.php index c4f7474..ef531a0 100644 --- a/tools/generate-prefixed-sumup-autoload.php +++ b/tools/generate-prefixed-sumup-autoload.php @@ -73,4 +73,9 @@ static function (\$class) use (\$baseDir, \$prefix): void { ); PHP; -file_put_contents($root . '/vendor_prefixed/sumup-sdk-autoload.php', $autoload); +$autoloadPath = $root . '/vendor_prefixed/sumup-sdk-autoload.php'; +$written = file_put_contents($autoloadPath, $autoload); +if ($written === false || $written !== strlen($autoload)) { + fwrite(STDERR, "Failed to write prefixed SDK autoload file: {$autoloadPath}\n"); + exit(1); +} diff --git a/tools/prefix-sumup-sdk-namespaces.php b/tools/prefix-sumup-sdk-namespaces.php index 66d9b76..0e82e39 100644 --- a/tools/prefix-sumup-sdk-namespaces.php +++ b/tools/prefix-sumup-sdk-namespaces.php @@ -20,8 +20,35 @@ $path = $file->getPathname(); $contents = file_get_contents($path); - $contents = preg_replace('/namespace\\s+SumUp\\b/', 'namespace ' . $prefix, $contents); - $contents = preg_replace('/use\\s+SumUp\\\\/', 'use ' . str_replace('\\', '\\\\', $prefix) . '\\\\', $contents); - $contents = preg_replace('/(?formatHeaders($reqHeaders)); diff --git a/vendor_prefixed/sumup-sdk/Memberships/Memberships.php b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php index 117e987..933b62c 100644 --- a/vendor_prefixed/sumup-sdk/Memberships/Memberships.php +++ b/vendor_prefixed/sumup-sdk/Memberships/Memberships.php @@ -91,6 +91,13 @@ class MembershipsListParams */ public ?string $resourceParentId = null; + /** + * Include resource.parent.id even when it is null. + * + * @var bool + */ + public bool $resourceParentIdPresent = false; + /** * Filter memberships by the parent of the resource the membership is in. * When filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null to filter for resources without a parent. @@ -99,6 +106,13 @@ class MembershipsListParams */ public mixed $resourceParentType = null; + /** + * Include resource.parent.type even when it is null. + * + * @var bool + */ + public bool $resourceParentTypePresent = false; + /** * Filter the returned memberships by role. * @@ -181,11 +195,11 @@ public function list(?MembershipsListParams $queryParams = null, ?RequestOptions if (isset($queryParams->resourceName)) { $queryParamsData['resource.name'] = $queryParams->resourceName; } - if (isset($queryParams->resourceParentId)) { - $queryParamsData['resource.parent.id'] = $queryParams->resourceParentId; + if (isset($queryParams->resourceParentId) || $queryParams->resourceParentIdPresent) { + $queryParamsData['resource.parent.id'] = $queryParams->resourceParentId ?? ''; } - if (isset($queryParams->resourceParentType)) { - $queryParamsData['resource.parent.type'] = $queryParams->resourceParentType; + if (isset($queryParams->resourceParentType) || $queryParams->resourceParentTypePresent) { + $queryParamsData['resource.parent.type'] = $queryParams->resourceParentType ?? ''; } if (isset($queryParams->roles)) { $queryParamsData['roles'] = $queryParams->roles; diff --git a/vendor_prefixed/sumup-sdk/Readers/Readers.php b/vendor_prefixed/sumup-sdk/Readers/Readers.php index f03519f..eb07e1d 100644 --- a/vendor_prefixed/sumup-sdk/Readers/Readers.php +++ b/vendor_prefixed/sumup-sdk/Readers/Readers.php @@ -101,6 +101,10 @@ class ReadersTerminateCheckoutRequest */ public static function fromArray(array $data): self { + if ($data !== []) { + throw new \InvalidArgumentException('ReadersTerminateCheckoutRequest does not accept payload fields.'); + } + return new self(); } } diff --git a/vendor_prefixed/sumup-sdk/RequestEncoder.php b/vendor_prefixed/sumup-sdk/RequestEncoder.php index 1dc233c..66afa90 100644 --- a/vendor_prefixed/sumup-sdk/RequestEncoder.php +++ b/vendor_prefixed/sumup-sdk/RequestEncoder.php @@ -19,7 +19,7 @@ public static function encode($value): array } if (is_array($value)) { - return $value; + return self::normalize($value); } $normalized = self::normalize($value);