From e81359006ef88f1d8f6d6e8ff7896b4406a225ef Mon Sep 17 00:00:00 2001 From: xendit-devx-bot Date: Mon, 4 Sep 2023 03:34:54 +0000 Subject: [PATCH] Generated Xendit php SDK --- .editorconfig | 12 - .env.example | 1 - .github/dependabot.yml | 6 + .github/workflows/generate-release-tag.yml | 27 + .github/workflows/php.yml | 38 - .gitignore | 38 +- .openapi-generator-ignore | 23 + .openapi-generator/FILES | 58 + .openapi-generator/VERSION | 1 + .php-cs-fixer.dist.php | 29 + .pre-commit-config.yaml | 19 - LICENSE | 4 +- MIGRATE.md | 157 - README.md | 1961 +------- composer.json | 53 +- composer.lock | 2651 ----------- docs/BalanceAndTransaction.yaml | 1054 +++++ docs/BalanceAndTransaction/Balance.md | 14 + docs/BalanceAndTransaction/BalanceApi.md | 65 + .../ChannelsCategories.md | 13 + docs/BalanceAndTransaction/Currency.md | 13 + docs/BalanceAndTransaction/DateRangeFilter.md | 15 + docs/BalanceAndTransaction/FeeResponse.md | 18 + docs/BalanceAndTransaction/LinkItem.md | 16 + docs/BalanceAndTransaction/ServerError.md | 16 + docs/BalanceAndTransaction/TransactionApi.md | 143 + .../TransactionResponse.md | 30 + .../TransactionResponseType.md | 13 + .../TransactionStatuses.md | 13 + .../BalanceAndTransaction/TransactionTypes.md | 13 + .../TransactionsResponse.md | 16 + docs/BalanceAndTransaction/ValidationError.md | 17 + docs/Invoice.yaml | 1401 ++++++ docs/Invoice/AddressObject.md | 20 + docs/Invoice/BadRequestError.md | 15 + docs/Invoice/Bank.md | 19 + docs/Invoice/BankCode.md | 13 + docs/Invoice/CreateInvoiceRequest.md | 34 + docs/Invoice/CustomerObject.md | 21 + docs/Invoice/DirectDebit.md | 14 + docs/Invoice/DirectDebitType.md | 13 + docs/Invoice/Ewallet.md | 14 + docs/Invoice/EwalletType.md | 13 + docs/Invoice/ForbiddenError.md | 15 + docs/Invoice/Invoice.md | 48 + docs/Invoice/InvoiceApi.md | 241 + docs/Invoice/InvoiceClientType.md | 13 + docs/Invoice/InvoiceCurrency.md | 13 + .../InvoiceError404ResponseDefinition.md | 15 + docs/Invoice/InvoiceFee.md | 15 + docs/Invoice/InvoiceItem.md | 19 + docs/Invoice/InvoiceNotFoundError.md | 15 + docs/Invoice/InvoicePaymentMethod.md | 13 + docs/Invoice/InvoiceStatus.md | 13 + docs/Invoice/NotificationChannel.md | 13 + docs/Invoice/NotificationPreference.md | 17 + docs/Invoice/Paylater.md | 15 + docs/Invoice/PaylaterType.md | 13 + docs/Invoice/QrCode.md | 14 + docs/Invoice/QrCodeType.md | 13 + docs/Invoice/RetailOutlet.md | 17 + docs/Invoice/RetailOutletName.md | 13 + docs/Invoice/ServerError.md | 15 + docs/Invoice/UnauthorizedError.md | 15 + docs/PaymentMethod.yaml | 2367 ++++++++++ docs/PaymentMethod/BillingInformation.md | 19 + docs/PaymentMethod/Card.md | 17 + docs/PaymentMethod/CardChannelProperties.md | 17 + docs/PaymentMethod/CardParameters.md | 16 + .../CardParametersCardInformation.md | 18 + docs/PaymentMethod/CardVerificationResults.md | 16 + .../CardVerificationResultsThreeDSecure.md | 18 + docs/PaymentMethod/ChannelAmountLimits.md | 16 + .../PaymentMethod/ChannelAmountLimitsAllOf.md | 16 + docs/PaymentMethod/ChannelProperty.md | 16 + docs/PaymentMethod/ChannelPropertyAllOf.md | 16 + .../CreatePaymentMethod409Response.md | 15 + .../CreatePaymentMethod503Response.md | 15 + docs/PaymentMethod/DirectDebit.md | 18 + docs/PaymentMethod/DirectDebitAllOf.md | 16 + docs/PaymentMethod/DirectDebitBankAccount.md | 17 + docs/PaymentMethod/DirectDebitChannelCode.md | 13 + .../DirectDebitChannelProperties.md | 21 + docs/PaymentMethod/DirectDebitDebitCard.md | 17 + docs/PaymentMethod/DirectDebitParameters.md | 15 + docs/PaymentMethod/DirectDebitType.md | 13 + docs/PaymentMethod/EWallet.md | 16 + docs/PaymentMethod/EWalletAccount.md | 17 + docs/PaymentMethod/EWalletChannelCode.md | 13 + .../PaymentMethod/EWalletChannelProperties.md | 19 + docs/PaymentMethod/EWalletParameters.md | 16 + .../GetAllPaymentMethods400Response.md | 15 + .../GetAllPaymentMethods403Response.md | 15 + .../GetAllPaymentMethods404Response.md | 15 + .../GetAllPaymentMethodsDefaultResponse.md | 15 + docs/PaymentMethod/OverTheCounter.md | 17 + .../OverTheCounterChannelCode.md | 13 + .../OverTheCounterChannelProperties.md | 16 + .../OverTheCounterChannelPropertiesUpdate.md | 15 + .../PaymentMethod/OverTheCounterParameters.md | 17 + .../OverTheCounterUpdateParameters.md | 15 + docs/PaymentMethod/PaymentChannel.md | 20 + docs/PaymentMethod/PaymentChannelAllOf.md | 20 + docs/PaymentMethod/PaymentChannelList.md | 16 + .../PaymentChannelListLinksInner.md | 16 + .../PaymentChannelListLinksInnerAllOf.md | 16 + docs/PaymentMethod/PaymentMethod.md | 35 + docs/PaymentMethod/PaymentMethodAction.md | 17 + docs/PaymentMethod/PaymentMethodApi.md | 546 +++ .../PaymentMethodAuthParameters.md | 14 + docs/PaymentMethod/PaymentMethodCountry.md | 13 + .../PaymentMethodExpireParameters.md | 15 + docs/PaymentMethod/PaymentMethodList.md | 15 + docs/PaymentMethod/PaymentMethodParameters.md | 27 + .../PaymentMethod/PaymentMethodReusability.md | 13 + docs/PaymentMethod/PaymentMethodStatus.md | 13 + docs/PaymentMethod/PaymentMethodType.md | 13 + .../PaymentMethodUpdateParameters.md | 19 + docs/PaymentMethod/QRCode.md | 17 + docs/PaymentMethod/QRCodeChannelCode.md | 13 + docs/PaymentMethod/QRCodeChannelProperties.md | 15 + docs/PaymentMethod/QRCodeParameters.md | 17 + docs/PaymentMethod/SimulatePaymentRequest.md | 14 + .../PaymentMethod/TokenizedCardInformation.md | 23 + docs/PaymentMethod/VirtualAccount.md | 21 + docs/PaymentMethod/VirtualAccountAllOf.md | 14 + .../VirtualAccountAlternativeDisplay.md | 15 + .../VirtualAccountChannelCode.md | 13 + .../VirtualAccountChannelProperties.md | 17 + .../VirtualAccountChannelPropertiesPatch.md | 15 + .../PaymentMethod/VirtualAccountParameters.md | 20 + .../VirtualAccountUpdateParameters.md | 18 + docs/PaymentRequest.yaml | 2500 +++++++++++ docs/PaymentRequest/Capture.md | 28 + docs/PaymentRequest/CaptureListResponse.md | 15 + docs/PaymentRequest/CaptureParameters.md | 15 + docs/PaymentRequest/Card.md | 17 + docs/PaymentRequest/CardChannelProperties.md | 18 + docs/PaymentRequest/CardInformation.md | 23 + .../PaymentRequest/CardVerificationResults.md | 16 + .../CardVerificationResultsThreeDSecure.md | 18 + docs/PaymentRequest/DirectDebit.md | 18 + docs/PaymentRequest/DirectDebitAllOf.md | 16 + docs/PaymentRequest/DirectDebitBankAccount.md | 15 + docs/PaymentRequest/DirectDebitChannelCode.md | 13 + .../DirectDebitChannelProperties.md | 21 + ...DirectDebitChannelPropertiesBankAccount.md | 17 + ...irectDebitChannelPropertiesBankRedirect.md | 16 + .../DirectDebitChannelPropertiesDebitCard.md | 18 + docs/PaymentRequest/DirectDebitDebitCard.md | 18 + docs/PaymentRequest/DirectDebitParameters.md | 16 + docs/PaymentRequest/DirectDebitType.md | 13 + docs/PaymentRequest/EWallet.md | 16 + docs/PaymentRequest/EWalletAccount.md | 17 + docs/PaymentRequest/EWalletAllOf.md | 14 + docs/PaymentRequest/EWalletChannelCode.md | 13 + .../EWalletChannelProperties.md | 19 + docs/PaymentRequest/EWalletParameters.md | 15 + docs/PaymentRequest/Error.md | 15 + docs/PaymentRequest/OverTheCounter.md | 17 + .../OverTheCounterChannelCode.md | 13 + .../OverTheCounterChannelProperties.md | 16 + .../OverTheCounterParameters.md | 17 + docs/PaymentRequest/PaymentMethod.md | 28 + .../PaymentRequest/PaymentMethodParameters.md | 22 + .../PaymentMethodReusability.md | 13 + docs/PaymentRequest/PaymentMethodStatus.md | 13 + docs/PaymentRequest/PaymentMethodType.md | 13 + docs/PaymentRequest/PaymentRequest.md | 36 + docs/PaymentRequest/PaymentRequestAction.md | 18 + docs/PaymentRequest/PaymentRequestApi.md | 407 ++ .../PaymentRequestAuthParameters.md | 14 + .../PaymentRequestBasketItem.md | 26 + .../PaymentRequestCaptureMethod.md | 13 + .../PaymentRequestCardVerificationResults.md | 16 + ...stCardVerificationResultsThreeDeeSecure.md | 18 + .../PaymentRequestChannelProperties.md | 20 + docs/PaymentRequest/PaymentRequestCountry.md | 13 + docs/PaymentRequest/PaymentRequestCurrency.md | 13 + .../PaymentRequest/PaymentRequestInitiator.md | 13 + .../PaymentRequestListResponse.md | 15 + .../PaymentRequestParameters.md | 27 + ...ymentRequestParametersChannelProperties.md | 21 + ...RequestParametersChannelPropertiesAllOf.md | 14 + .../PaymentRequestShippingInformation.md | 19 + docs/PaymentRequest/PaymentRequestStatus.md | 13 + docs/PaymentRequest/QRCode.md | 15 + docs/PaymentRequest/QRCodeChannelCode.md | 13 + .../PaymentRequest/QRCodeChannelProperties.md | 15 + docs/PaymentRequest/QRCodeParameters.md | 15 + docs/PaymentRequest/VirtualAccount.md | 21 + docs/PaymentRequest/VirtualAccountAllOf.md | 14 + .../VirtualAccountAlternativeDisplay.md | 15 + .../VirtualAccountChannelCode.md | 13 + .../VirtualAccountChannelProperties.md | 17 + .../VirtualAccountParameters.md | 20 + docs/Payout.yaml | 836 ++++ docs/Payout/Channel.md | 18 + docs/Payout/ChannelAccountType.md | 13 + docs/Payout/ChannelAmountLimits.md | 16 + docs/Payout/ChannelCategory.md | 13 + docs/Payout/CreatePayoutRequest.md | 21 + docs/Payout/DigitalPayoutChannelProperties.md | 16 + docs/Payout/Error.md | 16 + docs/Payout/ErrorErrorsInner.md | 15 + docs/Payout/GetPayouts200Response.md | 16 + docs/Payout/GetPayouts200ResponseDataInner.md | 28 + docs/Payout/GetPayouts200ResponseLinks.md | 16 + docs/Payout/Payout.md | 28 + docs/Payout/PayoutAllOf.md | 20 + docs/Payout/PayoutApi.md | 281 ++ docs/Payout/ReceiptNotification.md | 16 + docs/Refund.yaml | 479 ++ docs/Refund/CreateRefund.md | 20 + docs/Refund/CreateRefund400Response.md | 15 + docs/Refund/CreateRefund403Response.md | 15 + docs/Refund/CreateRefund404Response.md | 15 + docs/Refund/CreateRefund409Response.md | 15 + docs/Refund/CreateRefund503Response.md | 15 + docs/Refund/CreateRefundDefaultResponse.md | 15 + docs/Refund/Refund.md | 25 + docs/Refund/RefundApi.md | 218 + docs/Refund/RefundList.md | 15 + docs/header.jpg | Bin 0 -> 113176 bytes examples/BalanceExample.php | 24 - examples/CardlessCreditExample.php | 81 - examples/CardsExample.php | 53 - examples/CardsReverseExample.php | 38 - examples/CustomHttpClient.php | 46 - examples/CustomersExample.php | 135 - examples/DirectDebitExample.php | 175 - examples/DisbursementChannelsExample.php | 29 - examples/DisbursementsExample.php | 74 - examples/DisbursementsPHPExample.php | 74 - examples/EWalletsExample.php | 145 - examples/InvoiceExample.php | 44 - examples/PayLaterExample.php | 72 - examples/PaymentChannelsExample.php | 21 - examples/PayoutsExample.php | 35 - examples/PayoutsNewExample.php | 52 - examples/PlatformExample.php | 65 - examples/PromotionExample.php | 31 - examples/QRCodeExample.php | 31 - examples/RecurringExample.php | 50 - examples/ReportExample.php | 27 - examples/RetailExample.php | 38 - examples/TransactionExample.php | 28 - examples/VirtualAccountExample.php | 44 - lib/ApiException.php | 110 + lib/BalanceAndTransaction/Balance.php | 406 ++ lib/BalanceAndTransaction/BalanceApi.php | 496 ++ .../ChannelsCategories.php | 114 + lib/BalanceAndTransaction/Currency.php | 558 +++ lib/BalanceAndTransaction/DateRangeFilter.php | 436 ++ lib/BalanceAndTransaction/FeeResponse.php | 582 +++ lib/BalanceAndTransaction/LinkItem.php | 479 ++ lib/BalanceAndTransaction/ServerError.php | 479 ++ lib/BalanceAndTransaction/TransactionApi.php | 1021 +++++ .../TransactionResponse.php | 1096 +++++ .../TransactionResponseType.php | 375 ++ .../TransactionStatuses.php | 87 + .../TransactionTypes.php | 111 + .../TransactionsResponse.php | 477 ++ lib/BalanceAndTransaction/ValidationError.php | 520 +++ lib/Configuration.php | 379 ++ lib/HeaderSelector.php | 239 + lib/Invoice/AddressObject.php | 656 +++ lib/Invoice/BadRequestError.php | 487 ++ lib/Invoice/Bank.php | 582 +++ lib/Invoice/BankCode.php | 94 + lib/Invoice/CreateInvoiceRequest.php | 1089 +++++ lib/Invoice/CustomerObject.php | 697 +++ lib/Invoice/DirectDebit.php | 406 ++ lib/Invoice/DirectDebitType.php | 115 + lib/Invoice/Ewallet.php | 406 ++ lib/Invoice/EwalletType.php | 94 + lib/Invoice/ForbiddenError.php | 475 ++ lib/Invoice/Invoice.php | 1616 +++++++ lib/Invoice/InvoiceApi.php | 1748 ++++++++ lib/Invoice/InvoiceClientType.php | 94 + lib/Invoice/InvoiceCurrency.php | 82 + .../InvoiceError404ResponseDefinition.php | 475 ++ lib/Invoice/InvoiceFee.php | 443 ++ lib/Invoice/InvoiceItem.php | 591 +++ lib/Invoice/InvoiceNotFoundError.php | 479 ++ lib/Invoice/InvoicePaymentMethod.php | 103 + lib/Invoice/InvoiceStatus.php | 91 + lib/Invoice/NotificationChannel.php | 85 + lib/Invoice/NotificationPreference.php | 505 +++ lib/Invoice/Paylater.php | 440 ++ lib/Invoice/PaylaterType.php | 91 + lib/Invoice/QrCode.php | 406 ++ lib/Invoice/QrCodeType.php | 79 + lib/Invoice/RetailOutlet.php | 508 +++ lib/Invoice/RetailOutletName.php | 100 + lib/Invoice/ServerError.php | 474 ++ lib/Invoice/UnauthorizedError.php | 475 ++ lib/Model/ModelInterface.php | 104 + lib/ObjectSerializer.php | 563 +++ lib/PaymentMethod/BillingInformation.php | 659 +++ lib/PaymentMethod/Card.php | 532 +++ lib/PaymentMethod/CardChannelProperties.php | 587 +++ lib/PaymentMethod/CardParameters.php | 480 ++ .../CardParametersCardInformation.php | 562 +++ lib/PaymentMethod/CardVerificationResults.php | 494 ++ .../CardVerificationResultsThreeDSecure.php | 607 +++ lib/PaymentMethod/ChannelAmountLimits.php | 470 ++ .../ChannelAmountLimitsAllOf.php | 471 ++ lib/PaymentMethod/ChannelProperty.php | 470 ++ lib/PaymentMethod/ChannelPropertyAllOf.php | 471 ++ .../CreatePaymentMethod409Response.php | 474 ++ .../CreatePaymentMethod503Response.php | 470 ++ lib/PaymentMethod/DirectDebit.php | 569 +++ lib/PaymentMethod/DirectDebitAllOf.php | 487 ++ lib/PaymentMethod/DirectDebitBankAccount.php | 532 +++ lib/PaymentMethod/DirectDebitChannelCode.php | 262 ++ .../DirectDebitChannelProperties.php | 690 +++ lib/PaymentMethod/DirectDebitDebitCard.php | 532 +++ lib/PaymentMethod/DirectDebitParameters.php | 449 ++ lib/PaymentMethod/DirectDebitType.php | 81 + lib/PaymentMethod/EWallet.php | 474 ++ lib/PaymentMethod/EWalletAccount.php | 533 +++ lib/PaymentMethod/EWalletChannelCode.php | 121 + .../EWalletChannelProperties.php | 609 +++ lib/PaymentMethod/EWalletParameters.php | 473 ++ .../GetAllPaymentMethods400Response.php | 494 ++ .../GetAllPaymentMethods403Response.php | 470 ++ .../GetAllPaymentMethods404Response.php | 468 ++ .../GetAllPaymentMethodsDefaultResponse.php | 436 ++ lib/PaymentMethod/OverTheCounter.php | 518 +++ .../OverTheCounterChannelCode.php | 121 + .../OverTheCounterChannelProperties.php | 474 ++ .../OverTheCounterChannelPropertiesUpdate.php | 437 ++ .../OverTheCounterParameters.php | 517 +++ .../OverTheCounterUpdateParameters.php | 443 ++ lib/PaymentMethod/PaymentChannel.php | 606 +++ lib/PaymentMethod/PaymentChannelAllOf.php | 606 +++ lib/PaymentMethod/PaymentChannelList.php | 470 ++ .../PaymentChannelListLinksInner.php | 508 +++ .../PaymentChannelListLinksInnerAllOf.php | 508 +++ lib/PaymentMethod/PaymentMethod.php | 1203 +++++ lib/PaymentMethod/PaymentMethodAction.php | 504 +++ lib/PaymentMethod/PaymentMethodApi.php | 3986 +++++++++++++++++ .../PaymentMethodAuthParameters.php | 420 ++ lib/PaymentMethod/PaymentMethodCountry.php | 87 + .../PaymentMethodExpireParameters.php | 450 ++ lib/PaymentMethod/PaymentMethodList.php | 439 ++ lib/PaymentMethod/PaymentMethodParameters.php | 885 ++++ .../PaymentMethodReusability.php | 78 + lib/PaymentMethod/PaymentMethodStatus.php | 90 + lib/PaymentMethod/PaymentMethodType.php | 96 + .../PaymentMethodUpdateParameters.php | 572 +++ lib/PaymentMethod/QRCode.php | 526 +++ lib/PaymentMethod/QRCodeChannelCode.php | 88 + lib/PaymentMethod/QRCodeChannelProperties.php | 437 ++ lib/PaymentMethod/QRCodeParameters.php | 525 +++ lib/PaymentMethod/SimulatePaymentRequest.php | 402 ++ .../TokenizedCardInformation.php | 743 +++ lib/PaymentMethod/VirtualAccount.php | 708 +++ lib/PaymentMethod/VirtualAccountAllOf.php | 402 ++ .../VirtualAccountAlternativeDisplay.php | 469 ++ .../VirtualAccountChannelCode.php | 115 + .../VirtualAccountChannelProperties.php | 505 +++ .../VirtualAccountChannelPropertiesPatch.php | 446 ++ .../VirtualAccountParameters.php | 673 +++ .../VirtualAccountUpdateParameters.php | 599 +++ lib/PaymentRequest/Capture.php | 985 ++++ lib/PaymentRequest/CaptureListResponse.php | 442 ++ lib/PaymentRequest/CaptureParameters.php | 446 ++ lib/PaymentRequest/Card.php | 520 +++ lib/PaymentRequest/CardChannelProperties.php | 585 +++ lib/PaymentRequest/CardInformation.php | 768 ++++ .../CardVerificationResults.php | 484 ++ .../CardVerificationResultsThreeDSecure.php | 607 +++ lib/PaymentRequest/DirectDebit.php | 569 +++ lib/PaymentRequest/DirectDebitAllOf.php | 487 ++ lib/PaymentRequest/DirectDebitBankAccount.php | 450 ++ lib/PaymentRequest/DirectDebitChannelCode.php | 262 ++ .../DirectDebitChannelProperties.php | 640 +++ ...irectDebitChannelPropertiesBankAccount.php | 505 +++ ...rectDebitChannelPropertiesBankRedirect.php | 471 ++ .../DirectDebitChannelPropertiesDebitCard.php | 539 +++ lib/PaymentRequest/DirectDebitDebitCard.php | 566 +++ lib/PaymentRequest/DirectDebitParameters.php | 483 ++ lib/PaymentRequest/DirectDebitType.php | 81 + lib/PaymentRequest/EWallet.php | 471 ++ lib/PaymentRequest/EWalletAccount.php | 533 +++ lib/PaymentRequest/EWalletAllOf.php | 402 ++ lib/PaymentRequest/EWalletChannelCode.php | 130 + .../EWalletChannelProperties.php | 600 +++ lib/PaymentRequest/EWalletParameters.php | 436 ++ lib/PaymentRequest/Error.php | 590 +++ lib/PaymentRequest/OverTheCounter.php | 518 +++ .../OverTheCounterChannelCode.php | 121 + .../OverTheCounterChannelProperties.php | 474 ++ .../OverTheCounterParameters.php | 517 +++ lib/PaymentRequest/PaymentMethod.php | 946 ++++ .../PaymentMethodParameters.php | 722 +++ .../PaymentMethodReusability.php | 78 + lib/PaymentRequest/PaymentMethodStatus.php | 87 + lib/PaymentRequest/PaymentMethodType.php | 90 + lib/PaymentRequest/PaymentRequest.php | 1258 ++++++ lib/PaymentRequest/PaymentRequestAction.php | 652 +++ lib/PaymentRequest/PaymentRequestApi.php | 2809 ++++++++++++ .../PaymentRequestAuthParameters.php | 405 ++ .../PaymentRequestBasketItem.php | 825 ++++ .../PaymentRequestCaptureMethod.php | 78 + .../PaymentRequestCardVerificationResults.php | 494 ++ ...tCardVerificationResultsThreeDeeSecure.php | 545 +++ .../PaymentRequestChannelProperties.php | 640 +++ lib/PaymentRequest/PaymentRequestCountry.php | 87 + lib/PaymentRequest/PaymentRequestCurrency.php | 87 + .../PaymentRequestInitiator.php | 78 + .../PaymentRequestListResponse.php | 442 ++ .../PaymentRequestParameters.php | 903 ++++ ...mentRequestParametersChannelProperties.php | 674 +++ ...equestParametersChannelPropertiesAllOf.php | 402 ++ .../PaymentRequestShippingInformation.php | 575 +++ lib/PaymentRequest/PaymentRequestStatus.php | 96 + lib/PaymentRequest/QRCode.php | 444 ++ lib/PaymentRequest/QRCodeChannelCode.php | 85 + .../QRCodeChannelProperties.php | 437 ++ lib/PaymentRequest/QRCodeParameters.php | 443 ++ lib/PaymentRequest/VirtualAccount.php | 690 +++ lib/PaymentRequest/VirtualAccountAllOf.php | 402 ++ .../VirtualAccountAlternativeDisplay.php | 469 ++ .../VirtualAccountChannelCode.php | 115 + .../VirtualAccountChannelProperties.php | 508 +++ .../VirtualAccountParameters.php | 655 +++ lib/Payout/Channel.php | 554 +++ lib/Payout/ChannelAccountType.php | 88 + lib/Payout/ChannelAmountLimits.php | 480 ++ lib/Payout/ChannelCategory.php | 79 + lib/Payout/CreatePayoutRequest.php | 665 +++ lib/Payout/DigitalPayoutChannelProperties.php | 481 ++ lib/Payout/Error.php | 476 ++ lib/Payout/ErrorErrorsInner.php | 442 ++ lib/Payout/GetPayouts200Response.php | 470 ++ lib/Payout/GetPayouts200ResponseDataInner.php | 1001 +++++ lib/Payout/GetPayouts200ResponseLinks.php | 470 ++ lib/Payout/Payout.php | 1001 +++++ lib/Payout/PayoutAllOf.php | 705 +++ lib/Payout/PayoutApi.php | 2033 +++++++++ lib/Payout/ReceiptNotification.php | 492 ++ lib/Refund/CreateRefund.php | 653 +++ lib/Refund/CreateRefund400Response.php | 480 ++ lib/Refund/CreateRefund403Response.php | 468 ++ lib/Refund/CreateRefund404Response.php | 468 ++ lib/Refund/CreateRefund409Response.php | 470 ++ lib/Refund/CreateRefund503Response.php | 470 ++ lib/Refund/CreateRefundDefaultResponse.php | 436 ++ lib/Refund/Refund.php | 804 ++++ lib/Refund/RefundApi.php | 1553 +++++++ lib/Refund/RefundList.php | 439 ++ phpunit.xml | 9 - phpunit.xml.bak | 15 - phpunit.xml.dist | 18 + src/ApiOperations/Create.php | 42 - src/ApiOperations/Request.php | 100 - src/ApiOperations/Retrieve.php | 39 - src/ApiOperations/RetrieveAll.php | 37 - src/ApiOperations/Update.php | 43 - src/ApiRequestor.php | 121 - src/Balance.php | 72 - src/CardlessCredit.php | 83 - src/Cards.php | 143 - src/Customers.php | 98 - src/DirectDebit.php | 254 -- src/DisbursementChannels.php | 127 - src/Disbursements.php | 148 - src/DisbursementsPHP.php | 199 - src/EWallets.php | 200 - src/Exceptions/ApiException.php | 55 - src/Exceptions/ExceptionInterface.php | 33 - src/Exceptions/InvalidArgumentException.php | 28 - src/HttpClient/ClientInterface.php | 45 - src/HttpClient/GuzzleClient.php | 173 - src/HttpClientInterface.php | 43 - src/Invoice.php | 83 - src/PayLater.php | 175 - src/PaymentChannels.php | 43 - src/Payouts.php | 76 - src/PayoutsNew.php | 182 - src/Platform.php | 213 - src/Promotion.php | 104 - src/QRCode.php | 167 - src/Recurring.php | 164 - src/Report.php | 93 - src/Retail.php | 61 - src/Transaction.php | 60 - src/VirtualAccounts.php | 102 - src/Xendit.php | 129 - test/Api/BalanceApiTest.php | 74 + test/Api/InvoiceApiTest.php | 110 + test/Api/PaymentMethodApiTest.php | 170 + test/Api/PaymentRequestApiTest.php | 146 + test/Api/PayoutApiTest.php | 122 + test/Api/RefundApiTest.php | 110 + test/Api/TransactionApiTest.php | 86 + test/Model/AddressObjectTest.php | 137 + test/Model/BadRequestErrorTest.php | 92 + test/Model/BalanceTest.php | 83 + test/Model/BankCodeTest.php | 74 + test/Model/BankTest.php | 128 + test/Model/BillingInformationTest.php | 128 + test/Model/CaptureListResponseTest.php | 92 + test/Model/CaptureParametersTest.php | 92 + test/Model/CaptureTest.php | 209 + test/Model/CardChannelPropertiesTest.php | 110 + test/Model/CardInformationTest.php | 164 + .../CardParametersCardInformationTest.php | 119 + test/Model/CardParametersTest.php | 101 + test/Model/CardTest.php | 110 + test/Model/CardVerificationResultsTest.php | 101 + ...ardVerificationResultsThreeDSecureTest.php | 119 + test/Model/ChannelAccountTypeTest.php | 74 + test/Model/ChannelAmountLimitsAllOfTest.php | 101 + test/Model/ChannelAmountLimitsTest.php | 101 + test/Model/ChannelCategoryTest.php | 74 + test/Model/ChannelPropertyAllOfTest.php | 101 + test/Model/ChannelPropertyTest.php | 101 + test/Model/ChannelTest.php | 119 + test/Model/ChannelsCategoriesTest.php | 74 + test/Model/CreateInvoiceRequestTest.php | 263 ++ .../CreatePaymentMethod409ResponseTest.php | 92 + .../CreatePaymentMethod503ResponseTest.php | 92 + test/Model/CreatePayoutRequestTest.php | 146 + test/Model/CreateRefund400ResponseTest.php | 92 + test/Model/CreateRefund403ResponseTest.php | 92 + test/Model/CreateRefund404ResponseTest.php | 92 + test/Model/CreateRefund409ResponseTest.php | 92 + test/Model/CreateRefund503ResponseTest.php | 92 + .../Model/CreateRefundDefaultResponseTest.php | 92 + test/Model/CreateRefundTest.php | 137 + test/Model/CurrencyTest.php | 74 + test/Model/CustomerObjectTest.php | 146 + test/Model/DateRangeFilterTest.php | 92 + .../DigitalPayoutChannelPropertiesTest.php | 101 + test/Model/DirectDebitAllOfTest.php | 101 + test/Model/DirectDebitBankAccountTest.php | 92 + test/Model/DirectDebitChannelCodeTest.php | 74 + ...tDebitChannelPropertiesBankAccountTest.php | 110 + ...DebitChannelPropertiesBankRedirectTest.php | 101 + ...ectDebitChannelPropertiesDebitCardTest.php | 119 + .../DirectDebitChannelPropertiesTest.php | 146 + test/Model/DirectDebitDebitCardTest.php | 110 + test/Model/DirectDebitParametersTest.php | 92 + test/Model/DirectDebitTest.php | 83 + test/Model/DirectDebitTypeTest.php | 74 + test/Model/EWalletAccountTest.php | 110 + test/Model/EWalletAllOfTest.php | 83 + test/Model/EWalletChannelCodeTest.php | 74 + test/Model/EWalletChannelPropertiesTest.php | 128 + test/Model/EWalletParametersTest.php | 101 + test/Model/EWalletTest.php | 101 + test/Model/ErrorErrorsInnerTest.php | 92 + test/Model/ErrorTest.php | 92 + test/Model/EwalletTest.php | 83 + test/Model/EwalletTypeTest.php | 74 + test/Model/FeeResponseTest.php | 119 + test/Model/ForbiddenErrorTest.php | 92 + .../GetAllPaymentMethods400ResponseTest.php | 92 + .../GetAllPaymentMethods403ResponseTest.php | 92 + .../GetAllPaymentMethods404ResponseTest.php | 92 + ...etAllPaymentMethodsDefaultResponseTest.php | 92 + .../GetPayouts200ResponseDataInnerTest.php | 209 + test/Model/GetPayouts200ResponseLinksTest.php | 101 + test/Model/GetPayouts200ResponseTest.php | 101 + test/Model/InvoiceClientTypeTest.php | 74 + test/Model/InvoiceCurrencyTest.php | 74 + .../InvoiceError404ResponseDefinitionTest.php | 92 + test/Model/InvoiceFeeTest.php | 92 + test/Model/InvoiceItemTest.php | 128 + test/Model/InvoiceNotFoundErrorTest.php | 92 + test/Model/InvoicePaymentMethodTest.php | 74 + test/Model/InvoiceStatusTest.php | 74 + test/Model/InvoiceTest.php | 389 ++ test/Model/LinkItemTest.php | 101 + test/Model/NotificationChannelTest.php | 74 + test/Model/NotificationPreferenceTest.php | 110 + test/Model/OverTheCounterChannelCodeTest.php | 74 + .../OverTheCounterChannelPropertiesTest.php | 101 + ...rTheCounterChannelPropertiesUpdateTest.php | 92 + test/Model/OverTheCounterParametersTest.php | 110 + test/Model/OverTheCounterTest.php | 110 + .../OverTheCounterUpdateParametersTest.php | 92 + test/Model/PaylaterTest.php | 92 + test/Model/PaylaterTypeTest.php | 74 + test/Model/PaymentChannelAllOfTest.php | 137 + .../PaymentChannelListLinksInnerAllOfTest.php | 101 + .../PaymentChannelListLinksInnerTest.php | 101 + test/Model/PaymentChannelListTest.php | 101 + test/Model/PaymentChannelTest.php | 137 + test/Model/PaymentMethodActionTest.php | 110 + .../Model/PaymentMethodAuthParametersTest.php | 83 + test/Model/PaymentMethodCountryTest.php | 74 + .../PaymentMethodExpireParametersTest.php | 92 + test/Model/PaymentMethodListTest.php | 92 + test/Model/PaymentMethodParametersTest.php | 155 + test/Model/PaymentMethodReusabilityTest.php | 74 + test/Model/PaymentMethodStatusTest.php | 74 + test/Model/PaymentMethodTest.php | 209 + test/Model/PaymentMethodTypeTest.php | 74 + .../PaymentMethodUpdateParametersTest.php | 128 + test/Model/PaymentRequestActionTest.php | 119 + .../PaymentRequestAuthParametersTest.php | 83 + test/Model/PaymentRequestBasketItemTest.php | 191 + .../Model/PaymentRequestCaptureMethodTest.php | 74 + ...mentRequestCardVerificationResultsTest.php | 101 + ...dVerificationResultsThreeDeeSecureTest.php | 119 + .../PaymentRequestChannelPropertiesTest.php | 137 + test/Model/PaymentRequestCountryTest.php | 74 + test/Model/PaymentRequestCurrencyTest.php | 74 + test/Model/PaymentRequestInitiatorTest.php | 74 + test/Model/PaymentRequestListResponseTest.php | 92 + ...stParametersChannelPropertiesAllOfTest.php | 83 + ...RequestParametersChannelPropertiesTest.php | 146 + test/Model/PaymentRequestParametersTest.php | 200 + .../PaymentRequestShippingInformationTest.php | 128 + test/Model/PaymentRequestStatusTest.php | 74 + test/Model/PaymentRequestTest.php | 281 ++ test/Model/PayoutAllOfTest.php | 137 + test/Model/PayoutTest.php | 209 + test/Model/QRCodeChannelCodeTest.php | 74 + test/Model/QRCodeChannelPropertiesTest.php | 92 + test/Model/QRCodeParametersTest.php | 110 + test/Model/QRCodeTest.php | 110 + test/Model/QrCodeTest.php | 83 + test/Model/QrCodeTypeTest.php | 74 + test/Model/ReceiptNotificationTest.php | 101 + test/Model/RefundListTest.php | 92 + test/Model/RefundTest.php | 182 + test/Model/RetailOutletNameTest.php | 74 + test/Model/RetailOutletTest.php | 110 + test/Model/ServerErrorTest.php | 101 + test/Model/SimulatePaymentRequestTest.php | 83 + test/Model/TokenizedCardInformationTest.php | 164 + test/Model/TransactionResponseTest.php | 227 + test/Model/TransactionResponseTypeTest.php | 74 + test/Model/TransactionStatusesTest.php | 74 + test/Model/TransactionTypesTest.php | 74 + test/Model/TransactionsResponseTest.php | 101 + test/Model/UnauthorizedErrorTest.php | 92 + test/Model/ValidationErrorTest.php | 110 + test/Model/VirtualAccountAllOfTest.php | 83 + .../VirtualAccountAlternativeDisplayTest.php | 92 + test/Model/VirtualAccountChannelCodeTest.php | 74 + ...rtualAccountChannelPropertiesPatchTest.php | 92 + .../VirtualAccountChannelPropertiesTest.php | 110 + test/Model/VirtualAccountParametersTest.php | 137 + test/Model/VirtualAccountTest.php | 146 + .../VirtualAccountUpdateParametersTest.php | 119 + tests/TestCase.php | 160 - tests/Xendit/BalanceTest.php | 70 - tests/Xendit/CardlessCreditTest.php | 228 - tests/Xendit/CardsTest.php | 268 -- tests/Xendit/CustomersTest.php | 531 --- tests/Xendit/DirectDebitTest.php | 888 ---- tests/Xendit/DisbursementsChannelsTest.php | 217 - tests/Xendit/DisbursementsPHPTest.php | 261 -- tests/Xendit/DisbursementsTest.php | 256 -- tests/Xendit/EWalletsTest.php | 720 --- tests/Xendit/InvoiceTest.php | 176 - tests/Xendit/PayLaterTest.php | 511 --- tests/Xendit/PaymentChannelsTest.php | 54 - tests/Xendit/PayoutsNewTest.php | 232 - tests/Xendit/PayoutsTest.php | 150 - tests/Xendit/PlatformTest.php | 310 -- tests/Xendit/PromotionTest.php | 115 - tests/Xendit/QRCodeTest.php | 259 -- tests/Xendit/RecurringTest.php | 280 -- tests/Xendit/ReportTest.php | 103 - tests/Xendit/RetailTest.php | 159 - tests/Xendit/TransactionTest.php | 91 - tests/Xendit/VirtualAccountTest.php | 212 - 675 files changed, 136788 insertions(+), 16270 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .env.example create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/generate-release-tag.yml delete mode 100644 .github/workflows/php.yml create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .pre-commit-config.yaml delete mode 100644 MIGRATE.md delete mode 100644 composer.lock create mode 100644 docs/BalanceAndTransaction.yaml create mode 100644 docs/BalanceAndTransaction/Balance.md create mode 100644 docs/BalanceAndTransaction/BalanceApi.md create mode 100644 docs/BalanceAndTransaction/ChannelsCategories.md create mode 100644 docs/BalanceAndTransaction/Currency.md create mode 100644 docs/BalanceAndTransaction/DateRangeFilter.md create mode 100644 docs/BalanceAndTransaction/FeeResponse.md create mode 100644 docs/BalanceAndTransaction/LinkItem.md create mode 100644 docs/BalanceAndTransaction/ServerError.md create mode 100644 docs/BalanceAndTransaction/TransactionApi.md create mode 100644 docs/BalanceAndTransaction/TransactionResponse.md create mode 100644 docs/BalanceAndTransaction/TransactionResponseType.md create mode 100644 docs/BalanceAndTransaction/TransactionStatuses.md create mode 100644 docs/BalanceAndTransaction/TransactionTypes.md create mode 100644 docs/BalanceAndTransaction/TransactionsResponse.md create mode 100644 docs/BalanceAndTransaction/ValidationError.md create mode 100644 docs/Invoice.yaml create mode 100644 docs/Invoice/AddressObject.md create mode 100644 docs/Invoice/BadRequestError.md create mode 100644 docs/Invoice/Bank.md create mode 100644 docs/Invoice/BankCode.md create mode 100644 docs/Invoice/CreateInvoiceRequest.md create mode 100644 docs/Invoice/CustomerObject.md create mode 100644 docs/Invoice/DirectDebit.md create mode 100644 docs/Invoice/DirectDebitType.md create mode 100644 docs/Invoice/Ewallet.md create mode 100644 docs/Invoice/EwalletType.md create mode 100644 docs/Invoice/ForbiddenError.md create mode 100644 docs/Invoice/Invoice.md create mode 100644 docs/Invoice/InvoiceApi.md create mode 100644 docs/Invoice/InvoiceClientType.md create mode 100644 docs/Invoice/InvoiceCurrency.md create mode 100644 docs/Invoice/InvoiceError404ResponseDefinition.md create mode 100644 docs/Invoice/InvoiceFee.md create mode 100644 docs/Invoice/InvoiceItem.md create mode 100644 docs/Invoice/InvoiceNotFoundError.md create mode 100644 docs/Invoice/InvoicePaymentMethod.md create mode 100644 docs/Invoice/InvoiceStatus.md create mode 100644 docs/Invoice/NotificationChannel.md create mode 100644 docs/Invoice/NotificationPreference.md create mode 100644 docs/Invoice/Paylater.md create mode 100644 docs/Invoice/PaylaterType.md create mode 100644 docs/Invoice/QrCode.md create mode 100644 docs/Invoice/QrCodeType.md create mode 100644 docs/Invoice/RetailOutlet.md create mode 100644 docs/Invoice/RetailOutletName.md create mode 100644 docs/Invoice/ServerError.md create mode 100644 docs/Invoice/UnauthorizedError.md create mode 100644 docs/PaymentMethod.yaml create mode 100644 docs/PaymentMethod/BillingInformation.md create mode 100644 docs/PaymentMethod/Card.md create mode 100644 docs/PaymentMethod/CardChannelProperties.md create mode 100644 docs/PaymentMethod/CardParameters.md create mode 100644 docs/PaymentMethod/CardParametersCardInformation.md create mode 100644 docs/PaymentMethod/CardVerificationResults.md create mode 100644 docs/PaymentMethod/CardVerificationResultsThreeDSecure.md create mode 100644 docs/PaymentMethod/ChannelAmountLimits.md create mode 100644 docs/PaymentMethod/ChannelAmountLimitsAllOf.md create mode 100644 docs/PaymentMethod/ChannelProperty.md create mode 100644 docs/PaymentMethod/ChannelPropertyAllOf.md create mode 100644 docs/PaymentMethod/CreatePaymentMethod409Response.md create mode 100644 docs/PaymentMethod/CreatePaymentMethod503Response.md create mode 100644 docs/PaymentMethod/DirectDebit.md create mode 100644 docs/PaymentMethod/DirectDebitAllOf.md create mode 100644 docs/PaymentMethod/DirectDebitBankAccount.md create mode 100644 docs/PaymentMethod/DirectDebitChannelCode.md create mode 100644 docs/PaymentMethod/DirectDebitChannelProperties.md create mode 100644 docs/PaymentMethod/DirectDebitDebitCard.md create mode 100644 docs/PaymentMethod/DirectDebitParameters.md create mode 100644 docs/PaymentMethod/DirectDebitType.md create mode 100644 docs/PaymentMethod/EWallet.md create mode 100644 docs/PaymentMethod/EWalletAccount.md create mode 100644 docs/PaymentMethod/EWalletChannelCode.md create mode 100644 docs/PaymentMethod/EWalletChannelProperties.md create mode 100644 docs/PaymentMethod/EWalletParameters.md create mode 100644 docs/PaymentMethod/GetAllPaymentMethods400Response.md create mode 100644 docs/PaymentMethod/GetAllPaymentMethods403Response.md create mode 100644 docs/PaymentMethod/GetAllPaymentMethods404Response.md create mode 100644 docs/PaymentMethod/GetAllPaymentMethodsDefaultResponse.md create mode 100644 docs/PaymentMethod/OverTheCounter.md create mode 100644 docs/PaymentMethod/OverTheCounterChannelCode.md create mode 100644 docs/PaymentMethod/OverTheCounterChannelProperties.md create mode 100644 docs/PaymentMethod/OverTheCounterChannelPropertiesUpdate.md create mode 100644 docs/PaymentMethod/OverTheCounterParameters.md create mode 100644 docs/PaymentMethod/OverTheCounterUpdateParameters.md create mode 100644 docs/PaymentMethod/PaymentChannel.md create mode 100644 docs/PaymentMethod/PaymentChannelAllOf.md create mode 100644 docs/PaymentMethod/PaymentChannelList.md create mode 100644 docs/PaymentMethod/PaymentChannelListLinksInner.md create mode 100644 docs/PaymentMethod/PaymentChannelListLinksInnerAllOf.md create mode 100644 docs/PaymentMethod/PaymentMethod.md create mode 100644 docs/PaymentMethod/PaymentMethodAction.md create mode 100644 docs/PaymentMethod/PaymentMethodApi.md create mode 100644 docs/PaymentMethod/PaymentMethodAuthParameters.md create mode 100644 docs/PaymentMethod/PaymentMethodCountry.md create mode 100644 docs/PaymentMethod/PaymentMethodExpireParameters.md create mode 100644 docs/PaymentMethod/PaymentMethodList.md create mode 100644 docs/PaymentMethod/PaymentMethodParameters.md create mode 100644 docs/PaymentMethod/PaymentMethodReusability.md create mode 100644 docs/PaymentMethod/PaymentMethodStatus.md create mode 100644 docs/PaymentMethod/PaymentMethodType.md create mode 100644 docs/PaymentMethod/PaymentMethodUpdateParameters.md create mode 100644 docs/PaymentMethod/QRCode.md create mode 100644 docs/PaymentMethod/QRCodeChannelCode.md create mode 100644 docs/PaymentMethod/QRCodeChannelProperties.md create mode 100644 docs/PaymentMethod/QRCodeParameters.md create mode 100644 docs/PaymentMethod/SimulatePaymentRequest.md create mode 100644 docs/PaymentMethod/TokenizedCardInformation.md create mode 100644 docs/PaymentMethod/VirtualAccount.md create mode 100644 docs/PaymentMethod/VirtualAccountAllOf.md create mode 100644 docs/PaymentMethod/VirtualAccountAlternativeDisplay.md create mode 100644 docs/PaymentMethod/VirtualAccountChannelCode.md create mode 100644 docs/PaymentMethod/VirtualAccountChannelProperties.md create mode 100644 docs/PaymentMethod/VirtualAccountChannelPropertiesPatch.md create mode 100644 docs/PaymentMethod/VirtualAccountParameters.md create mode 100644 docs/PaymentMethod/VirtualAccountUpdateParameters.md create mode 100644 docs/PaymentRequest.yaml create mode 100644 docs/PaymentRequest/Capture.md create mode 100644 docs/PaymentRequest/CaptureListResponse.md create mode 100644 docs/PaymentRequest/CaptureParameters.md create mode 100644 docs/PaymentRequest/Card.md create mode 100644 docs/PaymentRequest/CardChannelProperties.md create mode 100644 docs/PaymentRequest/CardInformation.md create mode 100644 docs/PaymentRequest/CardVerificationResults.md create mode 100644 docs/PaymentRequest/CardVerificationResultsThreeDSecure.md create mode 100644 docs/PaymentRequest/DirectDebit.md create mode 100644 docs/PaymentRequest/DirectDebitAllOf.md create mode 100644 docs/PaymentRequest/DirectDebitBankAccount.md create mode 100644 docs/PaymentRequest/DirectDebitChannelCode.md create mode 100644 docs/PaymentRequest/DirectDebitChannelProperties.md create mode 100644 docs/PaymentRequest/DirectDebitChannelPropertiesBankAccount.md create mode 100644 docs/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.md create mode 100644 docs/PaymentRequest/DirectDebitChannelPropertiesDebitCard.md create mode 100644 docs/PaymentRequest/DirectDebitDebitCard.md create mode 100644 docs/PaymentRequest/DirectDebitParameters.md create mode 100644 docs/PaymentRequest/DirectDebitType.md create mode 100644 docs/PaymentRequest/EWallet.md create mode 100644 docs/PaymentRequest/EWalletAccount.md create mode 100644 docs/PaymentRequest/EWalletAllOf.md create mode 100644 docs/PaymentRequest/EWalletChannelCode.md create mode 100644 docs/PaymentRequest/EWalletChannelProperties.md create mode 100644 docs/PaymentRequest/EWalletParameters.md create mode 100644 docs/PaymentRequest/Error.md create mode 100644 docs/PaymentRequest/OverTheCounter.md create mode 100644 docs/PaymentRequest/OverTheCounterChannelCode.md create mode 100644 docs/PaymentRequest/OverTheCounterChannelProperties.md create mode 100644 docs/PaymentRequest/OverTheCounterParameters.md create mode 100644 docs/PaymentRequest/PaymentMethod.md create mode 100644 docs/PaymentRequest/PaymentMethodParameters.md create mode 100644 docs/PaymentRequest/PaymentMethodReusability.md create mode 100644 docs/PaymentRequest/PaymentMethodStatus.md create mode 100644 docs/PaymentRequest/PaymentMethodType.md create mode 100644 docs/PaymentRequest/PaymentRequest.md create mode 100644 docs/PaymentRequest/PaymentRequestAction.md create mode 100644 docs/PaymentRequest/PaymentRequestApi.md create mode 100644 docs/PaymentRequest/PaymentRequestAuthParameters.md create mode 100644 docs/PaymentRequest/PaymentRequestBasketItem.md create mode 100644 docs/PaymentRequest/PaymentRequestCaptureMethod.md create mode 100644 docs/PaymentRequest/PaymentRequestCardVerificationResults.md create mode 100644 docs/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.md create mode 100644 docs/PaymentRequest/PaymentRequestChannelProperties.md create mode 100644 docs/PaymentRequest/PaymentRequestCountry.md create mode 100644 docs/PaymentRequest/PaymentRequestCurrency.md create mode 100644 docs/PaymentRequest/PaymentRequestInitiator.md create mode 100644 docs/PaymentRequest/PaymentRequestListResponse.md create mode 100644 docs/PaymentRequest/PaymentRequestParameters.md create mode 100644 docs/PaymentRequest/PaymentRequestParametersChannelProperties.md create mode 100644 docs/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.md create mode 100644 docs/PaymentRequest/PaymentRequestShippingInformation.md create mode 100644 docs/PaymentRequest/PaymentRequestStatus.md create mode 100644 docs/PaymentRequest/QRCode.md create mode 100644 docs/PaymentRequest/QRCodeChannelCode.md create mode 100644 docs/PaymentRequest/QRCodeChannelProperties.md create mode 100644 docs/PaymentRequest/QRCodeParameters.md create mode 100644 docs/PaymentRequest/VirtualAccount.md create mode 100644 docs/PaymentRequest/VirtualAccountAllOf.md create mode 100644 docs/PaymentRequest/VirtualAccountAlternativeDisplay.md create mode 100644 docs/PaymentRequest/VirtualAccountChannelCode.md create mode 100644 docs/PaymentRequest/VirtualAccountChannelProperties.md create mode 100644 docs/PaymentRequest/VirtualAccountParameters.md create mode 100644 docs/Payout.yaml create mode 100644 docs/Payout/Channel.md create mode 100644 docs/Payout/ChannelAccountType.md create mode 100644 docs/Payout/ChannelAmountLimits.md create mode 100644 docs/Payout/ChannelCategory.md create mode 100644 docs/Payout/CreatePayoutRequest.md create mode 100644 docs/Payout/DigitalPayoutChannelProperties.md create mode 100644 docs/Payout/Error.md create mode 100644 docs/Payout/ErrorErrorsInner.md create mode 100644 docs/Payout/GetPayouts200Response.md create mode 100644 docs/Payout/GetPayouts200ResponseDataInner.md create mode 100644 docs/Payout/GetPayouts200ResponseLinks.md create mode 100644 docs/Payout/Payout.md create mode 100644 docs/Payout/PayoutAllOf.md create mode 100644 docs/Payout/PayoutApi.md create mode 100644 docs/Payout/ReceiptNotification.md create mode 100644 docs/Refund.yaml create mode 100644 docs/Refund/CreateRefund.md create mode 100644 docs/Refund/CreateRefund400Response.md create mode 100644 docs/Refund/CreateRefund403Response.md create mode 100644 docs/Refund/CreateRefund404Response.md create mode 100644 docs/Refund/CreateRefund409Response.md create mode 100644 docs/Refund/CreateRefund503Response.md create mode 100644 docs/Refund/CreateRefundDefaultResponse.md create mode 100644 docs/Refund/Refund.md create mode 100644 docs/Refund/RefundApi.md create mode 100644 docs/Refund/RefundList.md create mode 100644 docs/header.jpg delete mode 100644 examples/BalanceExample.php delete mode 100644 examples/CardlessCreditExample.php delete mode 100644 examples/CardsExample.php delete mode 100644 examples/CardsReverseExample.php delete mode 100644 examples/CustomHttpClient.php delete mode 100644 examples/CustomersExample.php delete mode 100644 examples/DirectDebitExample.php delete mode 100644 examples/DisbursementChannelsExample.php delete mode 100644 examples/DisbursementsExample.php delete mode 100644 examples/DisbursementsPHPExample.php delete mode 100644 examples/EWalletsExample.php delete mode 100644 examples/InvoiceExample.php delete mode 100644 examples/PayLaterExample.php delete mode 100644 examples/PaymentChannelsExample.php delete mode 100644 examples/PayoutsExample.php delete mode 100644 examples/PayoutsNewExample.php delete mode 100644 examples/PlatformExample.php delete mode 100644 examples/PromotionExample.php delete mode 100644 examples/QRCodeExample.php delete mode 100644 examples/RecurringExample.php delete mode 100644 examples/ReportExample.php delete mode 100644 examples/RetailExample.php delete mode 100644 examples/TransactionExample.php delete mode 100644 examples/VirtualAccountExample.php create mode 100644 lib/ApiException.php create mode 100644 lib/BalanceAndTransaction/Balance.php create mode 100644 lib/BalanceAndTransaction/BalanceApi.php create mode 100644 lib/BalanceAndTransaction/ChannelsCategories.php create mode 100644 lib/BalanceAndTransaction/Currency.php create mode 100644 lib/BalanceAndTransaction/DateRangeFilter.php create mode 100644 lib/BalanceAndTransaction/FeeResponse.php create mode 100644 lib/BalanceAndTransaction/LinkItem.php create mode 100644 lib/BalanceAndTransaction/ServerError.php create mode 100644 lib/BalanceAndTransaction/TransactionApi.php create mode 100644 lib/BalanceAndTransaction/TransactionResponse.php create mode 100644 lib/BalanceAndTransaction/TransactionResponseType.php create mode 100644 lib/BalanceAndTransaction/TransactionStatuses.php create mode 100644 lib/BalanceAndTransaction/TransactionTypes.php create mode 100644 lib/BalanceAndTransaction/TransactionsResponse.php create mode 100644 lib/BalanceAndTransaction/ValidationError.php create mode 100644 lib/Configuration.php create mode 100644 lib/HeaderSelector.php create mode 100644 lib/Invoice/AddressObject.php create mode 100644 lib/Invoice/BadRequestError.php create mode 100644 lib/Invoice/Bank.php create mode 100644 lib/Invoice/BankCode.php create mode 100644 lib/Invoice/CreateInvoiceRequest.php create mode 100644 lib/Invoice/CustomerObject.php create mode 100644 lib/Invoice/DirectDebit.php create mode 100644 lib/Invoice/DirectDebitType.php create mode 100644 lib/Invoice/Ewallet.php create mode 100644 lib/Invoice/EwalletType.php create mode 100644 lib/Invoice/ForbiddenError.php create mode 100644 lib/Invoice/Invoice.php create mode 100644 lib/Invoice/InvoiceApi.php create mode 100644 lib/Invoice/InvoiceClientType.php create mode 100644 lib/Invoice/InvoiceCurrency.php create mode 100644 lib/Invoice/InvoiceError404ResponseDefinition.php create mode 100644 lib/Invoice/InvoiceFee.php create mode 100644 lib/Invoice/InvoiceItem.php create mode 100644 lib/Invoice/InvoiceNotFoundError.php create mode 100644 lib/Invoice/InvoicePaymentMethod.php create mode 100644 lib/Invoice/InvoiceStatus.php create mode 100644 lib/Invoice/NotificationChannel.php create mode 100644 lib/Invoice/NotificationPreference.php create mode 100644 lib/Invoice/Paylater.php create mode 100644 lib/Invoice/PaylaterType.php create mode 100644 lib/Invoice/QrCode.php create mode 100644 lib/Invoice/QrCodeType.php create mode 100644 lib/Invoice/RetailOutlet.php create mode 100644 lib/Invoice/RetailOutletName.php create mode 100644 lib/Invoice/ServerError.php create mode 100644 lib/Invoice/UnauthorizedError.php create mode 100644 lib/Model/ModelInterface.php create mode 100644 lib/ObjectSerializer.php create mode 100644 lib/PaymentMethod/BillingInformation.php create mode 100644 lib/PaymentMethod/Card.php create mode 100644 lib/PaymentMethod/CardChannelProperties.php create mode 100644 lib/PaymentMethod/CardParameters.php create mode 100644 lib/PaymentMethod/CardParametersCardInformation.php create mode 100644 lib/PaymentMethod/CardVerificationResults.php create mode 100644 lib/PaymentMethod/CardVerificationResultsThreeDSecure.php create mode 100644 lib/PaymentMethod/ChannelAmountLimits.php create mode 100644 lib/PaymentMethod/ChannelAmountLimitsAllOf.php create mode 100644 lib/PaymentMethod/ChannelProperty.php create mode 100644 lib/PaymentMethod/ChannelPropertyAllOf.php create mode 100644 lib/PaymentMethod/CreatePaymentMethod409Response.php create mode 100644 lib/PaymentMethod/CreatePaymentMethod503Response.php create mode 100644 lib/PaymentMethod/DirectDebit.php create mode 100644 lib/PaymentMethod/DirectDebitAllOf.php create mode 100644 lib/PaymentMethod/DirectDebitBankAccount.php create mode 100644 lib/PaymentMethod/DirectDebitChannelCode.php create mode 100644 lib/PaymentMethod/DirectDebitChannelProperties.php create mode 100644 lib/PaymentMethod/DirectDebitDebitCard.php create mode 100644 lib/PaymentMethod/DirectDebitParameters.php create mode 100644 lib/PaymentMethod/DirectDebitType.php create mode 100644 lib/PaymentMethod/EWallet.php create mode 100644 lib/PaymentMethod/EWalletAccount.php create mode 100644 lib/PaymentMethod/EWalletChannelCode.php create mode 100644 lib/PaymentMethod/EWalletChannelProperties.php create mode 100644 lib/PaymentMethod/EWalletParameters.php create mode 100644 lib/PaymentMethod/GetAllPaymentMethods400Response.php create mode 100644 lib/PaymentMethod/GetAllPaymentMethods403Response.php create mode 100644 lib/PaymentMethod/GetAllPaymentMethods404Response.php create mode 100644 lib/PaymentMethod/GetAllPaymentMethodsDefaultResponse.php create mode 100644 lib/PaymentMethod/OverTheCounter.php create mode 100644 lib/PaymentMethod/OverTheCounterChannelCode.php create mode 100644 lib/PaymentMethod/OverTheCounterChannelProperties.php create mode 100644 lib/PaymentMethod/OverTheCounterChannelPropertiesUpdate.php create mode 100644 lib/PaymentMethod/OverTheCounterParameters.php create mode 100644 lib/PaymentMethod/OverTheCounterUpdateParameters.php create mode 100644 lib/PaymentMethod/PaymentChannel.php create mode 100644 lib/PaymentMethod/PaymentChannelAllOf.php create mode 100644 lib/PaymentMethod/PaymentChannelList.php create mode 100644 lib/PaymentMethod/PaymentChannelListLinksInner.php create mode 100644 lib/PaymentMethod/PaymentChannelListLinksInnerAllOf.php create mode 100644 lib/PaymentMethod/PaymentMethod.php create mode 100644 lib/PaymentMethod/PaymentMethodAction.php create mode 100644 lib/PaymentMethod/PaymentMethodApi.php create mode 100644 lib/PaymentMethod/PaymentMethodAuthParameters.php create mode 100644 lib/PaymentMethod/PaymentMethodCountry.php create mode 100644 lib/PaymentMethod/PaymentMethodExpireParameters.php create mode 100644 lib/PaymentMethod/PaymentMethodList.php create mode 100644 lib/PaymentMethod/PaymentMethodParameters.php create mode 100644 lib/PaymentMethod/PaymentMethodReusability.php create mode 100644 lib/PaymentMethod/PaymentMethodStatus.php create mode 100644 lib/PaymentMethod/PaymentMethodType.php create mode 100644 lib/PaymentMethod/PaymentMethodUpdateParameters.php create mode 100644 lib/PaymentMethod/QRCode.php create mode 100644 lib/PaymentMethod/QRCodeChannelCode.php create mode 100644 lib/PaymentMethod/QRCodeChannelProperties.php create mode 100644 lib/PaymentMethod/QRCodeParameters.php create mode 100644 lib/PaymentMethod/SimulatePaymentRequest.php create mode 100644 lib/PaymentMethod/TokenizedCardInformation.php create mode 100644 lib/PaymentMethod/VirtualAccount.php create mode 100644 lib/PaymentMethod/VirtualAccountAllOf.php create mode 100644 lib/PaymentMethod/VirtualAccountAlternativeDisplay.php create mode 100644 lib/PaymentMethod/VirtualAccountChannelCode.php create mode 100644 lib/PaymentMethod/VirtualAccountChannelProperties.php create mode 100644 lib/PaymentMethod/VirtualAccountChannelPropertiesPatch.php create mode 100644 lib/PaymentMethod/VirtualAccountParameters.php create mode 100644 lib/PaymentMethod/VirtualAccountUpdateParameters.php create mode 100644 lib/PaymentRequest/Capture.php create mode 100644 lib/PaymentRequest/CaptureListResponse.php create mode 100644 lib/PaymentRequest/CaptureParameters.php create mode 100644 lib/PaymentRequest/Card.php create mode 100644 lib/PaymentRequest/CardChannelProperties.php create mode 100644 lib/PaymentRequest/CardInformation.php create mode 100644 lib/PaymentRequest/CardVerificationResults.php create mode 100644 lib/PaymentRequest/CardVerificationResultsThreeDSecure.php create mode 100644 lib/PaymentRequest/DirectDebit.php create mode 100644 lib/PaymentRequest/DirectDebitAllOf.php create mode 100644 lib/PaymentRequest/DirectDebitBankAccount.php create mode 100644 lib/PaymentRequest/DirectDebitChannelCode.php create mode 100644 lib/PaymentRequest/DirectDebitChannelProperties.php create mode 100644 lib/PaymentRequest/DirectDebitChannelPropertiesBankAccount.php create mode 100644 lib/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.php create mode 100644 lib/PaymentRequest/DirectDebitChannelPropertiesDebitCard.php create mode 100644 lib/PaymentRequest/DirectDebitDebitCard.php create mode 100644 lib/PaymentRequest/DirectDebitParameters.php create mode 100644 lib/PaymentRequest/DirectDebitType.php create mode 100644 lib/PaymentRequest/EWallet.php create mode 100644 lib/PaymentRequest/EWalletAccount.php create mode 100644 lib/PaymentRequest/EWalletAllOf.php create mode 100644 lib/PaymentRequest/EWalletChannelCode.php create mode 100644 lib/PaymentRequest/EWalletChannelProperties.php create mode 100644 lib/PaymentRequest/EWalletParameters.php create mode 100644 lib/PaymentRequest/Error.php create mode 100644 lib/PaymentRequest/OverTheCounter.php create mode 100644 lib/PaymentRequest/OverTheCounterChannelCode.php create mode 100644 lib/PaymentRequest/OverTheCounterChannelProperties.php create mode 100644 lib/PaymentRequest/OverTheCounterParameters.php create mode 100644 lib/PaymentRequest/PaymentMethod.php create mode 100644 lib/PaymentRequest/PaymentMethodParameters.php create mode 100644 lib/PaymentRequest/PaymentMethodReusability.php create mode 100644 lib/PaymentRequest/PaymentMethodStatus.php create mode 100644 lib/PaymentRequest/PaymentMethodType.php create mode 100644 lib/PaymentRequest/PaymentRequest.php create mode 100644 lib/PaymentRequest/PaymentRequestAction.php create mode 100644 lib/PaymentRequest/PaymentRequestApi.php create mode 100644 lib/PaymentRequest/PaymentRequestAuthParameters.php create mode 100644 lib/PaymentRequest/PaymentRequestBasketItem.php create mode 100644 lib/PaymentRequest/PaymentRequestCaptureMethod.php create mode 100644 lib/PaymentRequest/PaymentRequestCardVerificationResults.php create mode 100644 lib/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.php create mode 100644 lib/PaymentRequest/PaymentRequestChannelProperties.php create mode 100644 lib/PaymentRequest/PaymentRequestCountry.php create mode 100644 lib/PaymentRequest/PaymentRequestCurrency.php create mode 100644 lib/PaymentRequest/PaymentRequestInitiator.php create mode 100644 lib/PaymentRequest/PaymentRequestListResponse.php create mode 100644 lib/PaymentRequest/PaymentRequestParameters.php create mode 100644 lib/PaymentRequest/PaymentRequestParametersChannelProperties.php create mode 100644 lib/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.php create mode 100644 lib/PaymentRequest/PaymentRequestShippingInformation.php create mode 100644 lib/PaymentRequest/PaymentRequestStatus.php create mode 100644 lib/PaymentRequest/QRCode.php create mode 100644 lib/PaymentRequest/QRCodeChannelCode.php create mode 100644 lib/PaymentRequest/QRCodeChannelProperties.php create mode 100644 lib/PaymentRequest/QRCodeParameters.php create mode 100644 lib/PaymentRequest/VirtualAccount.php create mode 100644 lib/PaymentRequest/VirtualAccountAllOf.php create mode 100644 lib/PaymentRequest/VirtualAccountAlternativeDisplay.php create mode 100644 lib/PaymentRequest/VirtualAccountChannelCode.php create mode 100644 lib/PaymentRequest/VirtualAccountChannelProperties.php create mode 100644 lib/PaymentRequest/VirtualAccountParameters.php create mode 100644 lib/Payout/Channel.php create mode 100644 lib/Payout/ChannelAccountType.php create mode 100644 lib/Payout/ChannelAmountLimits.php create mode 100644 lib/Payout/ChannelCategory.php create mode 100644 lib/Payout/CreatePayoutRequest.php create mode 100644 lib/Payout/DigitalPayoutChannelProperties.php create mode 100644 lib/Payout/Error.php create mode 100644 lib/Payout/ErrorErrorsInner.php create mode 100644 lib/Payout/GetPayouts200Response.php create mode 100644 lib/Payout/GetPayouts200ResponseDataInner.php create mode 100644 lib/Payout/GetPayouts200ResponseLinks.php create mode 100644 lib/Payout/Payout.php create mode 100644 lib/Payout/PayoutAllOf.php create mode 100644 lib/Payout/PayoutApi.php create mode 100644 lib/Payout/ReceiptNotification.php create mode 100644 lib/Refund/CreateRefund.php create mode 100644 lib/Refund/CreateRefund400Response.php create mode 100644 lib/Refund/CreateRefund403Response.php create mode 100644 lib/Refund/CreateRefund404Response.php create mode 100644 lib/Refund/CreateRefund409Response.php create mode 100644 lib/Refund/CreateRefund503Response.php create mode 100644 lib/Refund/CreateRefundDefaultResponse.php create mode 100644 lib/Refund/Refund.php create mode 100644 lib/Refund/RefundApi.php create mode 100644 lib/Refund/RefundList.php delete mode 100644 phpunit.xml delete mode 100644 phpunit.xml.bak create mode 100644 phpunit.xml.dist delete mode 100644 src/ApiOperations/Create.php delete mode 100644 src/ApiOperations/Request.php delete mode 100644 src/ApiOperations/Retrieve.php delete mode 100644 src/ApiOperations/RetrieveAll.php delete mode 100644 src/ApiOperations/Update.php delete mode 100644 src/ApiRequestor.php delete mode 100644 src/Balance.php delete mode 100644 src/CardlessCredit.php delete mode 100644 src/Cards.php delete mode 100644 src/Customers.php delete mode 100644 src/DirectDebit.php delete mode 100644 src/DisbursementChannels.php delete mode 100644 src/Disbursements.php delete mode 100644 src/DisbursementsPHP.php delete mode 100644 src/EWallets.php delete mode 100644 src/Exceptions/ApiException.php delete mode 100644 src/Exceptions/ExceptionInterface.php delete mode 100644 src/Exceptions/InvalidArgumentException.php delete mode 100644 src/HttpClient/ClientInterface.php delete mode 100644 src/HttpClient/GuzzleClient.php delete mode 100644 src/HttpClientInterface.php delete mode 100644 src/Invoice.php delete mode 100644 src/PayLater.php delete mode 100644 src/PaymentChannels.php delete mode 100644 src/Payouts.php delete mode 100644 src/PayoutsNew.php delete mode 100644 src/Platform.php delete mode 100644 src/Promotion.php delete mode 100644 src/QRCode.php delete mode 100644 src/Recurring.php delete mode 100644 src/Report.php delete mode 100644 src/Retail.php delete mode 100644 src/Transaction.php delete mode 100644 src/VirtualAccounts.php delete mode 100644 src/Xendit.php create mode 100644 test/Api/BalanceApiTest.php create mode 100644 test/Api/InvoiceApiTest.php create mode 100644 test/Api/PaymentMethodApiTest.php create mode 100644 test/Api/PaymentRequestApiTest.php create mode 100644 test/Api/PayoutApiTest.php create mode 100644 test/Api/RefundApiTest.php create mode 100644 test/Api/TransactionApiTest.php create mode 100644 test/Model/AddressObjectTest.php create mode 100644 test/Model/BadRequestErrorTest.php create mode 100644 test/Model/BalanceTest.php create mode 100644 test/Model/BankCodeTest.php create mode 100644 test/Model/BankTest.php create mode 100644 test/Model/BillingInformationTest.php create mode 100644 test/Model/CaptureListResponseTest.php create mode 100644 test/Model/CaptureParametersTest.php create mode 100644 test/Model/CaptureTest.php create mode 100644 test/Model/CardChannelPropertiesTest.php create mode 100644 test/Model/CardInformationTest.php create mode 100644 test/Model/CardParametersCardInformationTest.php create mode 100644 test/Model/CardParametersTest.php create mode 100644 test/Model/CardTest.php create mode 100644 test/Model/CardVerificationResultsTest.php create mode 100644 test/Model/CardVerificationResultsThreeDSecureTest.php create mode 100644 test/Model/ChannelAccountTypeTest.php create mode 100644 test/Model/ChannelAmountLimitsAllOfTest.php create mode 100644 test/Model/ChannelAmountLimitsTest.php create mode 100644 test/Model/ChannelCategoryTest.php create mode 100644 test/Model/ChannelPropertyAllOfTest.php create mode 100644 test/Model/ChannelPropertyTest.php create mode 100644 test/Model/ChannelTest.php create mode 100644 test/Model/ChannelsCategoriesTest.php create mode 100644 test/Model/CreateInvoiceRequestTest.php create mode 100644 test/Model/CreatePaymentMethod409ResponseTest.php create mode 100644 test/Model/CreatePaymentMethod503ResponseTest.php create mode 100644 test/Model/CreatePayoutRequestTest.php create mode 100644 test/Model/CreateRefund400ResponseTest.php create mode 100644 test/Model/CreateRefund403ResponseTest.php create mode 100644 test/Model/CreateRefund404ResponseTest.php create mode 100644 test/Model/CreateRefund409ResponseTest.php create mode 100644 test/Model/CreateRefund503ResponseTest.php create mode 100644 test/Model/CreateRefundDefaultResponseTest.php create mode 100644 test/Model/CreateRefundTest.php create mode 100644 test/Model/CurrencyTest.php create mode 100644 test/Model/CustomerObjectTest.php create mode 100644 test/Model/DateRangeFilterTest.php create mode 100644 test/Model/DigitalPayoutChannelPropertiesTest.php create mode 100644 test/Model/DirectDebitAllOfTest.php create mode 100644 test/Model/DirectDebitBankAccountTest.php create mode 100644 test/Model/DirectDebitChannelCodeTest.php create mode 100644 test/Model/DirectDebitChannelPropertiesBankAccountTest.php create mode 100644 test/Model/DirectDebitChannelPropertiesBankRedirectTest.php create mode 100644 test/Model/DirectDebitChannelPropertiesDebitCardTest.php create mode 100644 test/Model/DirectDebitChannelPropertiesTest.php create mode 100644 test/Model/DirectDebitDebitCardTest.php create mode 100644 test/Model/DirectDebitParametersTest.php create mode 100644 test/Model/DirectDebitTest.php create mode 100644 test/Model/DirectDebitTypeTest.php create mode 100644 test/Model/EWalletAccountTest.php create mode 100644 test/Model/EWalletAllOfTest.php create mode 100644 test/Model/EWalletChannelCodeTest.php create mode 100644 test/Model/EWalletChannelPropertiesTest.php create mode 100644 test/Model/EWalletParametersTest.php create mode 100644 test/Model/EWalletTest.php create mode 100644 test/Model/ErrorErrorsInnerTest.php create mode 100644 test/Model/ErrorTest.php create mode 100644 test/Model/EwalletTest.php create mode 100644 test/Model/EwalletTypeTest.php create mode 100644 test/Model/FeeResponseTest.php create mode 100644 test/Model/ForbiddenErrorTest.php create mode 100644 test/Model/GetAllPaymentMethods400ResponseTest.php create mode 100644 test/Model/GetAllPaymentMethods403ResponseTest.php create mode 100644 test/Model/GetAllPaymentMethods404ResponseTest.php create mode 100644 test/Model/GetAllPaymentMethodsDefaultResponseTest.php create mode 100644 test/Model/GetPayouts200ResponseDataInnerTest.php create mode 100644 test/Model/GetPayouts200ResponseLinksTest.php create mode 100644 test/Model/GetPayouts200ResponseTest.php create mode 100644 test/Model/InvoiceClientTypeTest.php create mode 100644 test/Model/InvoiceCurrencyTest.php create mode 100644 test/Model/InvoiceError404ResponseDefinitionTest.php create mode 100644 test/Model/InvoiceFeeTest.php create mode 100644 test/Model/InvoiceItemTest.php create mode 100644 test/Model/InvoiceNotFoundErrorTest.php create mode 100644 test/Model/InvoicePaymentMethodTest.php create mode 100644 test/Model/InvoiceStatusTest.php create mode 100644 test/Model/InvoiceTest.php create mode 100644 test/Model/LinkItemTest.php create mode 100644 test/Model/NotificationChannelTest.php create mode 100644 test/Model/NotificationPreferenceTest.php create mode 100644 test/Model/OverTheCounterChannelCodeTest.php create mode 100644 test/Model/OverTheCounterChannelPropertiesTest.php create mode 100644 test/Model/OverTheCounterChannelPropertiesUpdateTest.php create mode 100644 test/Model/OverTheCounterParametersTest.php create mode 100644 test/Model/OverTheCounterTest.php create mode 100644 test/Model/OverTheCounterUpdateParametersTest.php create mode 100644 test/Model/PaylaterTest.php create mode 100644 test/Model/PaylaterTypeTest.php create mode 100644 test/Model/PaymentChannelAllOfTest.php create mode 100644 test/Model/PaymentChannelListLinksInnerAllOfTest.php create mode 100644 test/Model/PaymentChannelListLinksInnerTest.php create mode 100644 test/Model/PaymentChannelListTest.php create mode 100644 test/Model/PaymentChannelTest.php create mode 100644 test/Model/PaymentMethodActionTest.php create mode 100644 test/Model/PaymentMethodAuthParametersTest.php create mode 100644 test/Model/PaymentMethodCountryTest.php create mode 100644 test/Model/PaymentMethodExpireParametersTest.php create mode 100644 test/Model/PaymentMethodListTest.php create mode 100644 test/Model/PaymentMethodParametersTest.php create mode 100644 test/Model/PaymentMethodReusabilityTest.php create mode 100644 test/Model/PaymentMethodStatusTest.php create mode 100644 test/Model/PaymentMethodTest.php create mode 100644 test/Model/PaymentMethodTypeTest.php create mode 100644 test/Model/PaymentMethodUpdateParametersTest.php create mode 100644 test/Model/PaymentRequestActionTest.php create mode 100644 test/Model/PaymentRequestAuthParametersTest.php create mode 100644 test/Model/PaymentRequestBasketItemTest.php create mode 100644 test/Model/PaymentRequestCaptureMethodTest.php create mode 100644 test/Model/PaymentRequestCardVerificationResultsTest.php create mode 100644 test/Model/PaymentRequestCardVerificationResultsThreeDeeSecureTest.php create mode 100644 test/Model/PaymentRequestChannelPropertiesTest.php create mode 100644 test/Model/PaymentRequestCountryTest.php create mode 100644 test/Model/PaymentRequestCurrencyTest.php create mode 100644 test/Model/PaymentRequestInitiatorTest.php create mode 100644 test/Model/PaymentRequestListResponseTest.php create mode 100644 test/Model/PaymentRequestParametersChannelPropertiesAllOfTest.php create mode 100644 test/Model/PaymentRequestParametersChannelPropertiesTest.php create mode 100644 test/Model/PaymentRequestParametersTest.php create mode 100644 test/Model/PaymentRequestShippingInformationTest.php create mode 100644 test/Model/PaymentRequestStatusTest.php create mode 100644 test/Model/PaymentRequestTest.php create mode 100644 test/Model/PayoutAllOfTest.php create mode 100644 test/Model/PayoutTest.php create mode 100644 test/Model/QRCodeChannelCodeTest.php create mode 100644 test/Model/QRCodeChannelPropertiesTest.php create mode 100644 test/Model/QRCodeParametersTest.php create mode 100644 test/Model/QRCodeTest.php create mode 100644 test/Model/QrCodeTest.php create mode 100644 test/Model/QrCodeTypeTest.php create mode 100644 test/Model/ReceiptNotificationTest.php create mode 100644 test/Model/RefundListTest.php create mode 100644 test/Model/RefundTest.php create mode 100644 test/Model/RetailOutletNameTest.php create mode 100644 test/Model/RetailOutletTest.php create mode 100644 test/Model/ServerErrorTest.php create mode 100644 test/Model/SimulatePaymentRequestTest.php create mode 100644 test/Model/TokenizedCardInformationTest.php create mode 100644 test/Model/TransactionResponseTest.php create mode 100644 test/Model/TransactionResponseTypeTest.php create mode 100644 test/Model/TransactionStatusesTest.php create mode 100644 test/Model/TransactionTypesTest.php create mode 100644 test/Model/TransactionsResponseTest.php create mode 100644 test/Model/UnauthorizedErrorTest.php create mode 100644 test/Model/ValidationErrorTest.php create mode 100644 test/Model/VirtualAccountAllOfTest.php create mode 100644 test/Model/VirtualAccountAlternativeDisplayTest.php create mode 100644 test/Model/VirtualAccountChannelCodeTest.php create mode 100644 test/Model/VirtualAccountChannelPropertiesPatchTest.php create mode 100644 test/Model/VirtualAccountChannelPropertiesTest.php create mode 100644 test/Model/VirtualAccountParametersTest.php create mode 100644 test/Model/VirtualAccountTest.php create mode 100644 test/Model/VirtualAccountUpdateParametersTest.php delete mode 100644 tests/TestCase.php delete mode 100644 tests/Xendit/BalanceTest.php delete mode 100644 tests/Xendit/CardlessCreditTest.php delete mode 100644 tests/Xendit/CardsTest.php delete mode 100644 tests/Xendit/CustomersTest.php delete mode 100644 tests/Xendit/DirectDebitTest.php delete mode 100644 tests/Xendit/DisbursementsChannelsTest.php delete mode 100644 tests/Xendit/DisbursementsPHPTest.php delete mode 100644 tests/Xendit/DisbursementsTest.php delete mode 100644 tests/Xendit/EWalletsTest.php delete mode 100644 tests/Xendit/InvoiceTest.php delete mode 100644 tests/Xendit/PayLaterTest.php delete mode 100644 tests/Xendit/PaymentChannelsTest.php delete mode 100644 tests/Xendit/PayoutsNewTest.php delete mode 100644 tests/Xendit/PayoutsTest.php delete mode 100644 tests/Xendit/PlatformTest.php delete mode 100644 tests/Xendit/PromotionTest.php delete mode 100644 tests/Xendit/QRCodeTest.php delete mode 100644 tests/Xendit/RecurringTest.php delete mode 100644 tests/Xendit/ReportTest.php delete mode 100644 tests/Xendit/RetailTest.php delete mode 100644 tests/Xendit/TransactionTest.php delete mode 100644 tests/Xendit/VirtualAccountTest.php diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 9e63672..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 - -[*.md] -trim_trailing_whitespace = false \ No newline at end of file diff --git a/.env.example b/.env.example deleted file mode 100644 index bdad23c..0000000 --- a/.env.example +++ /dev/null @@ -1 +0,0 @@ -SECRET_API_KEY = \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b7445f3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "composer" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/generate-release-tag.yml b/.github/workflows/generate-release-tag.yml new file mode 100644 index 0000000..344dada --- /dev/null +++ b/.github/workflows/generate-release-tag.yml @@ -0,0 +1,27 @@ +name: Generate Release Tag +on: + repository_dispatch: + types: [create-release-tag] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set the value in bash + id: parse-changelog + run: | + echo "changelog<> "$GITHUB_OUTPUT" + echo "${{ github.event.client_payload.changelog }}" | tr -s '%0A' '\n' >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + - name: Create Release + id: create-release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} + with: + tag_name: v${{ github.event.client_payload.version }} + release_name: v${{ github.event.client_payload.version }} + body: ${{ steps.parse-changelog.outputs.changelog }} + draft: false + prerelease: false \ No newline at end of file diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml deleted file mode 100644 index 17f524a..0000000 --- a/.github/workflows/php.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Continuous Integration - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - php: ['7.0', '7.1', '7.2', '7.3', '7.4'] - name: Test with php version ${{ matrix.php }} - - steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run test suite - run: vendor/bin/phpunit tests diff --git a/.gitignore b/.gitignore index ad73acb..9f1681c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,15 @@ -# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore -# Created by https://www.gitignore.io/api/visualstudiocode -# Edit at https://www.gitignore.io/?templates=visualstudiocode - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -# End of https://www.gitignore.io/api/visualstudiocode - -# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) - -# For people using composer +composer.phar /vendor/ -.idea/* - -.phpunit.result.cache -clover.xml +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock -.env +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache -composer.phar -composer-setup.php -bin/ +# PHPUnit cache +.phpunit.result.cache diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..11e69a9 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,58 @@ +.github/dependabot.yml +.github/workflows/generate-release-tag.yml +.gitignore +.php-cs-fixer.dist.php +LICENSE +README.md +composer.json +docs/Payout.yaml +docs/Payout/Channel.md +docs/Payout/ChannelAccountType.md +docs/Payout/ChannelAmountLimits.md +docs/Payout/ChannelCategory.md +docs/Payout/CreatePayoutRequest.md +docs/Payout/DigitalPayoutChannelProperties.md +docs/Payout/Error.md +docs/Payout/ErrorErrorsInner.md +docs/Payout/GetPayouts200Response.md +docs/Payout/GetPayouts200ResponseDataInner.md +docs/Payout/GetPayouts200ResponseLinks.md +docs/Payout/Payout.md +docs/Payout/PayoutAllOf.md +docs/Payout/PayoutApi.md +docs/Payout/ReceiptNotification.md +docs/header.jpg +lib/ApiException.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Model/ModelInterface.php +lib/ObjectSerializer.php +lib/Payout/Channel.php +lib/Payout/ChannelAccountType.php +lib/Payout/ChannelAmountLimits.php +lib/Payout/ChannelCategory.php +lib/Payout/CreatePayoutRequest.php +lib/Payout/DigitalPayoutChannelProperties.php +lib/Payout/Error.php +lib/Payout/ErrorErrorsInner.php +lib/Payout/GetPayouts200Response.php +lib/Payout/GetPayouts200ResponseDataInner.php +lib/Payout/GetPayouts200ResponseLinks.php +lib/Payout/Payout.php +lib/Payout/PayoutAllOf.php +lib/Payout/PayoutApi.php +lib/Payout/ReceiptNotification.php +phpunit.xml.dist +test/Api/PayoutApiTest.php +test/Model/ChannelAccountTypeTest.php +test/Model/ChannelCategoryTest.php +test/Model/ChannelTest.php +test/Model/CreatePayoutRequestTest.php +test/Model/DigitalPayoutChannelPropertiesTest.php +test/Model/ErrorErrorsInnerTest.php +test/Model/GetPayouts200ResponseDataInnerTest.php +test/Model/GetPayouts200ResponseLinksTest.php +test/Model/GetPayouts200ResponseTest.php +test/Model/PayoutAllOfTest.php +test/Model/PayoutTest.php +test/Model/ReceiptNotificationTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..cd802a1 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 0a07aaf..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,19 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 - hooks: - - id: trailing-whitespace - - repo: https://github.com/digitalpulp/pre-commit-php.git - sha: 1.3.0 - hooks: - - id: php-lint - - repo: local - hooks: - - id: phpcbf - name: phpcbf - entry: vendor/bin/phpcbf src - language: script - - id: phpcs - name: phpcs - entry: vendor/bin/phpcs src - language: script diff --git a/LICENSE b/LICENSE index bcc74c0..0d37b6c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2022 Xendit +Copyright (c) 2017-2023 Xendit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/MIGRATE.md b/MIGRATE.md deleted file mode 100644 index ab76de7..0000000 --- a/MIGRATE.md +++ /dev/null @@ -1,157 +0,0 @@ -# Migrations - -## v1.4.0 to v2.0.0 - -### New package name - -For standardization purpose, package `xendit-php-clients` will be renamed to `xendit-php`. - -To install this package with `composer`, run command: - -```bash -composer require xendit/xendit-php -``` - -To update with `composer`, run command: - -```bash -composer update xendit/xendit-php -``` - -### Instantiate API Key - -In the v1.4.0, secret API key is instantiated inside the config file. However in v2.0.0, secret API key is instantiated -with: - -```php -Xendit::setApiKey('secretKey'); -``` - -### Calling methods - -In v2.0.0, we restructured classes based on product, so it will impact on how the method is called. - -#### Create Invoice - -In v1.4.0, we used the following command to create an invoice: - -```php -$external_id = 'demo_147580196270'; -$payer_email = 'sample_email@xendit.co'; -$description = 'Trip to Bali'; -$amount = 32000; - -$response = $xenditPHPClient->createInvoice($external_id, $amount, $payer_email, $description); -``` - -In v2.0.0, we will use this command to create an invoice: - -```php -$params = ['external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000 -]; - -$response = \Xendit\Invoice::create($params); -``` - -#### Get Invoice - -In v1.4.0, to get an invoice: - -```php -$response = $xenditPHPClient->getInvoice($invoice_id); -``` - -In v2.0.0, to get an invoice: - -```php -$response = \Xendit\Invoice::retrieve($id); -``` - -#### Create Disbursement - -In v1.4.0, to create a disbursement: - -```php -$external_id = 'disb-12345678'; -$amount = 15000; -$bank_code = 'BCA'; -$account_holder_name = 'Joe'; -$account_number = '1234567890'; - -$response = $xenditPHPClient->createDisbursement($external_id, $amount, $bank_code, $account_holder_name, $account_number); -``` - -In v2.0.0, to create a disbursement: - -```php -$params = [ - 'external_id'=> 'disb-12345678', - 'amount'=> 15000, - 'bank_code'=> 'BCA', - 'account_holder_name'=> 'Joe', - 'account_number'=> '1234567890', - 'description'=>'Disbursement from Example' -]; - -$response = \Xendit\Disbursements::create($params); -``` - -#### Get Balance - -In v1.4.0, to get current balance: - -```php -$response = $xenditPHPClient->getBalance(); -``` - -In v2.0.0, to get current balance: - -```php -$response = \Xendit\Balance::getBalance('CASH'); -``` - -#### Capture Credit Card Payment - -In v1.4.0, to capture a credit card payment: - -```php -$external_id = 'ext-id'; -$token_id = 'token-id'; -$amount = 100000; - -$response = $xenditPHPClient->captureCreditCardPayment($external_id, $token_id, $amount); -``` - -In v2.0.0, to capture a credit card payment: - -```php -$captureParams = ['amount' => 100000]; - -$response = \Xendit\Cards::capture($id, $captureParams); -``` - -#### Refund Credit Card Payment - -In v1.4.0, to refund credit card payment: - -```php -$id = 'id'; -$amount = 20000; -$external_id = 'ext-id'; - -$response = $xenditPHPClient->issueCreditCardRefund($id, $amount, $external_id); -``` - -In v2.0.0, to refund credit card payment: - -```php -$refundParams = [ - 'external_id' => 'ext-id', - 'amount' => 20000 -]; - -$response = \Xendit\Cards::createRefund($id, $refundParams); -``` \ No newline at end of file diff --git a/README.md b/README.md index 04df387..801f77e 100644 --- a/README.md +++ b/README.md @@ -1,1946 +1,75 @@ -# Xendit API PHP Client +![Xendit PHP SDK](docs/header.jpg "Xendit PHP SDK") -This library is the abstraction of Xendit API for access from applications written with PHP. +# Xendit PHP SDK -- [Documentation](#documentation) -- [Installation](#installation) -- [Usage](#usage) -- [Methods' Signature and Examples](#methods-signature-and-examples) - - [Balance](#balance) - - [Get Balance](#get-balance) - - [Payment Channels](#payment-channels) - - [Get Payment Channels](#get-payment-channels) - - [Cards](#cards) - - [Create Charge](#create-charge) - - [Reverse Authorization](#reverse-authorization) - - [Capture Charge](#capture-charge) - - [Get Charge](#get-charge) - - [Create Refund](#create-refund) - - [Cardless Credit](#cardless-credit) - - [Create Cardless Credit Payment](#create-cardless-credit-payment) - - [Calculate Payment Types](#calculate-payment-types) - - [Customers](#customers) - - [Create Customer](#create-customer) - - [Get Customer by Reference ID](#get-customer-by-reference-id) - - [Direct Debit](#direct-debit) - - [Initialize linked account tokenization](#initialize-linked-account-tokenization) - - [Validate OTP for Linked Account Token](#validate-otp-for-linked-account-token) - - [Retrieve accessible accounts by linked account token](#retrieve-accessible-accounts-by-linked-account-token) - - [Unbind linked account token](#unbind-linked-account-token) - - [Create payment method](#create-payment-method) - - [Get payment methods by customer ID](#get-payment-methods-by-customer-id) - - [Create direct debit payment](#create-direct-debit-payment) - - [Validate OTP for direct debit payment](#validate-otp-for-direct-debit-payment) - - [Get direct debit payment by ID](#get-direct-debit-payment-by-id) - - [Get direct debit payment by reference ID](#get-direct-debit-payment-by-reference-id) - - [Payouts New (Disbursement)](#payouts-new) - - [Create Payouts](#create-payouts-new) - - [Get Payouts By ID / Reference](#retrieve-by-id) - - [Cancel Payouts](#cancel-payouts) - - [Get Payouts Channels](#get-payments-channels) - - [IDR Disbursements for Indonesia](#idr-disbursements-for-indonesia) - - [Create an IDR Disbursement](#create-an-idr-disbursement) - - [Create an IDR Batch Disbursement](#create-an-idr-batch-disbursement) - - [Get an IDR Disbursement by ID](#get-an-idr-disbursement-by-id) - - [Get an IDR Disbursement by External ID](#get-an-idr-disbursement-by-external-id) - - [Get an IDR Disbursement Available Banks](#get-an-idr-disbursement-available-banks) - - [PHP Disbursements for Philippines](#php-disbursements-for-philippines) - - [Create a PHP Disbursement](#create-a-php-disbursement) - - [Get a PHP Disbursement by ID](#get-a-php-disbursement-by-id) - - [Get a PHP Disbursement by Reference ID](#get-a-php-disbursement-by-reference-id) - - [Disbursement Channels](#disbursement-channels) - - [Get Disbursement Channels](#get-disbursement-channels) - - [Get Disbursement Channels By Channel Category](#get-disbursement-channels-by-channel-category) - - [Get Disbursement Channels By Channel Code](#get-disbursement-channels-by-channel-code) - - [E-Wallets](#e-wallets) - - [Create E-Wallet Charge](#create-e-wallet-charge) - - [Get E-Wallet Charge Status](#get-e-wallet-charge-status) - - [Void E-Wallet Charge](#void-e-wallet-charge) - - [Refund E-Wallet Charge](#refund-e-wallet-charge) - - [Get Refund By ID](#get-refund-by-id) - - [List Refunds](#list-refunds) - - [Invoice](#invoice) - - [Create Invoice](#create-invoice) - - [Get Invoice](#get-invoice) - - [Get All Invoice](#get-all-invoice) - - [Expire Invoice](#expire-invoice) - - [Paylater](#paylater) - - [Initiate PayLater Plans](#initiate-paylater-plans) - - [Create PayLater Charges](#create-paylater-charges) - - [Get PayLater Charge by ID](#get-paylater-charge-by-id) - - [Refund PayLater Charge](#refund-paylater-charge) - - [Get PayLater Refund by ID](#get-paylater-refund-by-id) - - [List PayLater Refunds](#list-paylater-refunds) - - [Payout Links](#payout-links) - - [Create a Payout Link](#create-payout-links) - - [Get a Payout Link](#get-payout-links) - - [Void a Payout Link](#void-payout-links) - - [QR Code](#qr-code) - - [Create a QR Code](#create-a-qr-code) - - [Get QR Code](#get-qr-code) - - [Recurring](#recurring-payments) - - [Create a Recurring Payment](#create-a-recurring-payment) - - [Get a Recurring Payment](#get-a-recurring-payment) - - [Edit a Recurring Payment](#edit-recurring-payment) - - [Pause a Recurring Payment](#pause-recurring-payment) - - [Stop a Recurring Payment](#stop-recurring-payment) - - [Resume a Recurring Payment](#resume-recurring-payment) - - [Retail Outlets](#retail-outlets) - - [Create Fixed Payment Code](#create-fixed-payment-code) - - [Update Fixed Payment Code](#update-fixed-payment-code) - - [Get Fixed Payment Code](#get-fixed-payment-code) - - [Virtual Accounts](#virtual-accounts) - - [Create Fixed Virtual Account](#create-fixed-virtual-account) - - [Get Virtual Account Bank](#get-virtual-account-bank) - - [Get Fixed Virtual Account](#get-fixed-virtual-account) - - [Update Fixed Virtual Account](#update-fixed-virtual-account) - - [Get Fixed Virtual Account Payment](#get-fixed-virtual-account-payment) - - [xenPlatform](#xenplatform) - - [Create Account](#create-account) - - [Get Account](#get-account) - - [Update Account](#update-account) - - [Create Transfers](#create-transfers) - - [Create Fee Rule](#create-fee-rule) - - [Set Callback URLs](#set-callback-urls) - - [Transaction](#transaction) - - [List of transactions](#list-of-transactions) - - [Detail of transaction](#detail-of-transaction) - - [Report](#report) - - [Generate Report](#generate-report) - - [Detail of Report](#detail-of-report) -- [Exceptions](#exceptions) - - [InvalidArgumentException](#invalidargumentexception) - - [ApiException](#apiexception) -- [Contributing](#contributing) - - [Test](#tests) - - [Running test suite](#running-test-suite) - - [Running examples](#running-examples) +The official Xendit PHP SDK provides a simple and convenient way to call Xendit's REST API +in applications written in PHP. ---- +* Package version: 3.0.0-beta.0 -## Documentation - -For the API documentation, check [Xendit API Reference](https://xendit.github.io/apireference). +# Getting Started ## Installation -Install xendit-php-clients with composer by following command: - -```bash -composer require xendit/xendit-php -``` - -or add it manually in your `composer.json` file. - -### Update from v1.4.0 to v2.0.0 - -To update xendit-php-clients with composer, use the following command: - -```bash -composer update xendit/xendit-php -``` - -To migrate, see [MIGRATE.md](MIGRATE.md) for more information. - -## Usage - -Configure package with your account's secret key obtained from [Xendit Dashboard](https://dashboard.xendit.co/settings/developers#api-keys). - -```php -Xendit::setApiKey('secretKey'); -``` - -See [example codes](./examples) for more details. - -### Use Custom HTTP Client - -A custom HTTP Client that implements [HttpClientInterface](./src/HttpClientInterface.php) can be injected like so - -```php -Xendit::setHttpClient($client); -``` - -Checkout [custom http client example](./examples/CustomHttpClient.php) for implementation reference. - -## Methods' Signature and Examples - -### Balance - -#### Get Balance - -```php -$params = array( - 'for-user-id' => '' //The sub-account user-id that you want to make this transaction for (Optional). -); -\Xendit\Balance::getBalance(string $account_type, array $params); -``` - -Usage example: - -```php -$getBalance = \Xendit\Balance::getBalance('CASH'); -var_dump($getBalance); -``` - -### Payment Channels - -#### Get Payment Channels - -GetPaymentChannels is in `maintenance mode`. Existing behavior on the endpoint will continue to work as before, but newer channels will be missing from the returned result. - -```php -\Xendit\PaymentChannels::list(); -``` - -Usage example: - -```php -$getPaymentChannels = \Xendit\PaymentChannels::list(); -var_dump($getPaymentChannels); -``` - -### Cards - -#### Create Charge - -```php -\Xendit\Cards::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'token_id' => '5e2e8231d97c174c58bcf644', - 'external_id' => 'card_' . time(), - 'authentication_id' => '5e2e8658bae82e4d54d764c0', - 'amount' => 100000, - 'card_cvn' => '123', - 'capture' => false -]; - -$createCharge = \Xendit\Cards::create($params); -var_dump($createCharge); -``` - -#### Reverse Authorization - -```php -\Xendit\Cards::reverseAuthorization(string $id, array $params); -``` - -Usage example: - -```php -$id = 'charge-id'; -$params = ['external_id' => 'ext-id']; - -$reverseAuth = \Xendit\Cards::reverseAuthorization( - $id, - $params -); -var_dump($reverseAuth); -``` - -#### Capture Charge - -```php -\Xendit\Cards::capture(string $id, array $params); -``` - -Usage example: - -```php -$id = 'charge-id'; -$params = ['amount' => 100000]; - -$captureCharge = \Xendit\Cards::capture($id, $params); -var_dump($captureCharge); -``` - -#### Get Charge - -```php -\Xendit\Cards::retrieve(string $id); -``` - -Usage example: - -```php -$id = 'charge-id'; - -$getCharge = \Xendit\Cards::retrieve($id); -var_dump($getCharge); -``` - -#### Create Refund - -```php -\Xendit\Cards::createRefund(string $id, array $params); -``` - -Usage examples - -Without idempotency key: - -```php -$params = [ - 'external_id' => 'ext-id', - 'amount' => 20000 -]; - -$refund = \Xendit\Cards::createRefund($id, $params); -var_dump($refund); -``` - -With idempotency key: - -```php -$params = [ - 'external_id' => 'ext-id', - 'amount' => 20000, - 'X-IDEMPOTENCY-KEY' => 'unique-id' -]; - -$refund = \Xendit\Cards::createRefund($id, $params); -var_dump($refund); -``` - -#### Create Promotion - -```php -\Xendit\Promotion::create(array $params); -``` - -usage examples: - -```php -$params = [ - 'reference_id' => 'reference_123', - 'description' => 'test promotion', - 'currency' => 'IDR', - 'start_time' => '2021-01-01T00:00:00.000Z', - 'end_time' => '2021-01-02T00:00:00.000Z', - 'promo_code' => 'testpromo', - 'discount_amount' => 5000 -]; - -$createPromotion = \Xendit\Promotion::create($params); -var_dump($createPromotion); -``` - -### Cardless Credit - -#### Create Cardless Credit Payment - -```php -\Xendit\CardlessCredit::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'cardless_credit_type' => 'KREDIVO', - 'external_id' => 'test-cardless-credit-02', - 'amount' => 800000, - 'payment_type' => '3_months', - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 200000, - 'type' => 'Smartphone', - 'url' => 'http=>//example.com/phone/phone_case', - 'quantity' => 2 - ], - [ - 'id' => '234567', - 'name' => 'Bluetooth Headset', - 'price' => 400000, - 'type' => 'Audio', - 'url' => 'http=>//example.com/phone/bluetooth_headset', - 'quantity' => 1 - ] - ], - 'customer_details' => [ - 'first_name' => 'customer first name', - 'last_name' => 'customer last name', - 'email' => 'customer@yourwebsite.com', - 'phone' => '081513114262' - ], - 'shipping_address' => [ - 'first_name' => 'first name', - 'last_name' => 'last name', - 'address' => 'Jalan Teknologi No. 12', - 'city' => 'Jakarta', - 'postal_code' => '12345', - 'phone' => '081513114262', - 'country_code' => 'IDN' - ], - 'redirect_url' => 'https://example.com', - 'callback_url' => 'http://example.com/callback-cardless-credit' -]; - -$createPayment = \Xendit\CardlessCredit::create($params); -var_dump($createPayment); -``` - -#### Calculate Payment Types - -```php -\Xendit\CardlessCredit::calculatePaymentTypes(array $params); -``` - -Usage example: - -```php -$params = [ - 'cardless_credit_type' => 'KREDIVO', - 'amount' => 2000000, - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 1000000, - 'type' => 'Smartphone', - 'url' => 'http://example.com/phone/phone_case', - 'quantity' => 2 - ] - ] -]; - -$calculatePaymentTypes = \Xendit\CardlessCredit::calculatePaymentTypes($params); -var_dump($calculatePaymentTypes); -``` - -### Customers - -#### Create Customer - -```php -\Xendit\Customers::createCustomer(array $params); -``` - -Usage example: - -```php -$customerParams = [ - 'reference_id' => '' . time(), - 'given_names' => 'customer 1', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'description' => 'dummy customer', - 'middle_name' => 'middle', - 'surname' => 'surname', - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'Jl. 123', - 'street_line2' => 'Jl. 456', - 'city' => 'Jakarta Selatan', - 'province' => 'DKI Jakarta', - 'state' => '-', - 'postal_code' => '12345' - ] - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -$createCustomer = \Xendit\Customers::createCustomer($customerParams); -var_dump($createCustomer); -``` - -#### Get Customer by Reference ID - -```php -\Xendit\Customers::getCustomerByReferenceID(string $reference_id); -``` - -Usage example: - -```php -$reference_id = 'ref_id'; -$getCustomer = \Xendit\Customers::getCustomerByReferenceID($reference_id); -var_dump($getCustomer); -``` - -### Direct Debit - -#### Initialize linked account tokenization - -```php -\Xendit\DirectDebit::initializeLinkedAccountTokenization(array $params); -``` - -Usage example: - -```php -$params = [ - 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', - 'channel_code' => 'DC_BRI', - 'properties' => [ - 'account_mobile_number' => '+62818555988', - 'card_last_four' => '8888', - 'card_expiry' => '06/24', - 'account_email' => 'test.email@xendit.co' - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -$initializeTokenization = \Xendit\DirectDebit::initializeLinkedAccountTokenization($params); -var_dump($initializeTokenization); -``` - -#### Validate OTP for Linked Account Token - -```php -\Xendit\DirectDebit::validateOTPForLinkedAccount(string $linked_account_token_id, array $params); -``` - -Usage example: - -```php -$params = [ - 'otp_code' => '333000' -]; - -$validateOTPForLinkedAccount = \Xendit\DirectDebit::validateOTPForLinkedAccount( - 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f', - $params -); -var_dump($validateOTPForLinkedAccount); -``` - -#### Retrieve accessible accounts by linked account token - -```php -\Xendit\DirectDebit::retrieveAccessibleLinkedAccounts(string $linked_account_token_id); -``` - -Usage example: - -```php -$retrieveAccessibleLinkedAccounts = \Xendit\DirectDebit::retrieveAccessibleLinkedAccounts( - 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f' -); -var_dump($retrieveAccessibleLinkedAccounts); -``` - -#### Unbind linked account token - -```php -\Xendit\DirectDebit::unbindLinkedAccountToken(string $linked_account_token_id); -``` - -Usage example: - -```php -$unbindLinkedAccountToken = \Xendit\DirectDebit::unbindLinkedAccountToken( - 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f' -); -var_dump($unbindLinkedAccountToken); -``` - -#### Create payment method - -```php -\Xendit\DirectDebit::createPaymentMethod(array $params); -``` - -Usage example: - -```php -$params = [ - 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', - 'type' => 'DEBIT_CARD', - 'properties' => [ - 'id' => 'la-052d3e2d-bc4d-4c98-8072-8d232a552299' - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -$createPaymentMethod = \Xendit\DirectDebit::createPaymentMethod($params); -var_dump($createPaymentMethod); -``` - -#### Get payment methods by customer ID - -```php -\Xendit\DirectDebit::getPaymentMethodsByCustomerID(string $customer_id); -``` - -Usage example: - -```php -$getPaymentMethods = \Xendit\DirectDebit::getPaymentMethodsByCustomerID('4b7b6050-0830-440a-903b-37d527dbbaa9'); -var_dump($getPaymentMethods); -``` - -#### Create direct debit payment +### Requirements -```php -\Xendit\DirectDebit::createDirectDebitPayment(array $params); -``` - -Usage example: - -```php -$params = [ - 'reference_id' => 'test-direct-debit-ref', - 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', - 'currency' => 'IDR', - 'amount' => 15000, - 'callback_url' => 'http://webhook.site/', - 'enable_otp' => true, - 'description' => 'test description', - 'basket' => [ - [ - 'reference_id' => 'basket-product-ref-id', - 'name' => 'product name', - 'category' => 'mechanics', - 'market' => 'ID', - 'price' => 50000, - 'quantity' => 5, - 'type' => 'product type', - 'sub_category' => 'product sub category', - 'description' => 'product description', - 'url' => 'https://product.url' - ] - ], - 'device' => [ - 'id' => 'device_id', - 'ip_address' => '0.0.0.0', - 'ad_id' => 'ad-id', - 'imei' => '123a456b789c' - ], - 'success_redirect_url' => 'https://success-redirect.url', - 'failure_redirect_url' => 'https://failure-redirect.url', - 'metadata' => [ - 'meta' => 'data' - ], - 'Idempotency-key' => '' . time() -]; - -$createDirectDebitPayment = \Xendit\DirectDebit::createDirectDebitPayment( - $params -); -var_dump($createDirectDebitPayment); -``` - -#### Validate OTP for direct debit payment - -```php -\Xendit\DirectDebit::validateOTPForDirectDebitPayment( - string $direct_debit_payment_id, - array $params -); -``` - -Usage example: - -```php -$params = [ - 'otp_code' => '222000' -]; - -$validateOTPForDirectDebitPayment = \Xendit\DirectDebit::validateOTPForDirectDebitPayment( - 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', - $params -); -var_dump($validateOTPForDirectDebitPayment); -``` - -#### Get direct debit payment by ID - -```php -\Xendit\DirectDebit::getDirectDebitPaymentByID( - string $direct_debit_payment_id -); -``` - -Usage example: - -```php -$getDirectDebitPaymentByID = \Xendit\DirectDebit::getDirectDebitPaymentByID( - 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c' -); -var_dump($getDirectDebitPaymentByID); -``` - -#### Get direct debit payment by reference ID - -```php -\Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( - string $reference_id -); -``` - -Usage example: - -```php -$getDirectDebitPaymentByReferenceID = \Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( - 'test-direct-debit-ref' -); -var_dump($getDirectDebitPaymentByReferenceID); -``` +PHP 7.4 and later. -### Payouts New +### Composer -```php -\Xendit\PayoutsNew::create(array $params); -``` - -#### Create Payouts New -Usage example -```php -\Xendit\PayoutsNew::create([ - 'reference_id' => 'ref-823723232', - 'channel_code' => 'ID_BRI', - 'channel_properties' => [ - 'account_number' => '0000000000', - 'account_holder_name' => 'Yanuar' - ], - 'amount' => 1000, - 'description' => 'Sample Successful Create IDR Payout', - 'currency' => 'IDR', - 'receipt_notification' => [ - 'email_to' => ['someone@example.com'], - 'email_cc' => ['someone1@example.com'], - 'email_bcc' => ['someone2@example.com'], - ], - 'metadata' => [ - 'lotto_outlet' => 24 - ] -]) -``` - -#### Retrieve By ID -```php -## Using ID -\Xendit\PayoutsNew::retrieve(string $id); - -## Using Reference ID -\Xendit\PayoutsNew::retrieveReference(string $referenceID) -``` - -#### Cancel Payouts -```php -\Xendit\PayoutsNew::cancel(string $id); -``` - -#### Get Payouts Channel -```php -\Xendit\PayoutsNew::getPayoutsChannels() -``` - -### IDR Disbursements for Indonesia +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: -#### Create an IDR Disbursement - -```php -\Xendit\Disbursements::create(array $params); +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/xendit/xendit-php.git" + } + ], + "require": { + "xendit/xendit-php": "3.0.0-beta.0" + } +} ``` -Usage examples - -Without idempotency key: +Then run `composer install` -```php -$params = [ - 'external_id' => 'disb-12345678', - 'amount' => 15000, - 'bank_code' => 'BCA', - 'account_holder_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' -]; - -$createDisbursements = \Xendit\Disbursements::create($params); -var_dump($createDisbursements); -``` +### Manual Installation -With idempotency key: +Download the files and include `autoload.php`: ```php -$params = [ - 'external_id' => 'disb-12345678', - 'amount' => 15000, - 'bank_code' => 'BCA', - 'account_holder_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example', - 'X-IDEMPOTENCY-KEY' => 'unique-id' -]; - -$createDisbursements = \Xendit\Disbursements::create($params); -var_dump($createDisbursements); + 'disb_batch-12345678', - 'disbursements' => [ - [ - 'amount' => 20000, - 'bank_code' => 'BCA', - 'bank_account_name' => 'Fadlan', - 'bank_account_number' => '1234567890', - 'description' => 'Batch Disbursement', - 'external_id' => 'disbursement-1' - ], - [ - 'amount' => 30000, - 'bank_code' => 'MANDIRI', - 'bank_account_name' => 'Lutfi', - 'bank_account_number' => '1234567891', - 'description' => 'Batch Disbursement with email notifications', - 'external_id' => 'disbursement-2', - 'email_to' => ['test+to@xendit.co'], - 'email_cc' => ['test+cc@xendit.co'], - 'email_bcc' => ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] - ] - ] -]; +use Xendit\Configuration; -$createBatchDisbursements = \Xendit\Disbursements::createBatch($batch_params); -var_dump($createBatchDisbursements); +Configuration::setXenditKey('XENDIT_API_KEY'); ``` -#### Get an IDR Disbursement by ID - -```php -\Xendit\Disbursements::retrieve(string $id, array $params); -``` +# Documentation -Usage example: +Find detailed API information and examples for each of our product’s by clicking the links below, -```php -$id = 'disbursements-id'; -$retrieveParams = [ - 'for-user-id' => 'test-reference-user-id' -] -$getDisbursements = \Xendit\Disbursements::retrieve($id, $retrieveParams); -var_dump($getDisbursements); -``` +* [Balance](docs/BalanceAndTransaction/BalanceApi.md) +* [Invoice](docs/Invoice/InvoiceApi.md) +* [PaymentMethod](docs/PaymentMethod/PaymentMethodApi.md) +* [PaymentRequest](docs/PaymentRequest/PaymentRequestApi.md) +* [Payout](docs/Payout/PayoutApi.md) +* [Refund](docs/Refund/RefundApi.md) +* [Transaction](docs/BalanceAndTransaction/TransactionApi.md) -#### Get an IDR Disbursement by External ID +All URIs are relative to *https://api.xendit.co*. For more information about our API, please refer to *https://developers.xendit.co/*. -```php -\Xendit\Disbursements::retrieveExternal(string $external_id); -``` - -Usage example: - -```php -$external_id = 'disbursements-ext-id'; -$getDisbursementsByExt = \Xendit\Disbursements::retrieveExternal($external_id); -var_dump($getDisbursementsByExt); -``` - -#### Get an IDR Disbursement Available Banks - -```php -\Xendit\Disbursements::getAvailableBanks(); -``` - -Usage example: - -```php -$getDisbursementsBanks = \Xendit\Disbursements::getAvailableBanks(); -var_dump($getDisbursementsBanks); -``` - -### PHP Disbursements for Philippines - -#### Create a PHP Disbursement - -```php -\Xendit\DisbursementsPHP::createPHPDisbursement(array $params); -``` - -Usage examples - -Without optional fields: - -```php -$params = [ - 'reference_id' => 'reference_id', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'PH_BDO', - 'account_name' => 'Test', - 'account_number' => '1234567890', - 'description' => 'PHP Disbursement from Example', - 'xendit-idempotency-key' => 'unique-id' -]; - -$createDisbursements = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursements); -``` - -With beneficiary optional field: - -```php -$params = [ - 'reference_id' => 'reference_id', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'PH_BDO', - 'account_name' => 'Test', - 'account_number' => '1234567890', - 'description' => 'PHP Disbursement from Example', - 'xendit-idempotency-key' => 'unique-id', - 'beneficiary' => [ - 'type' => 'INDIVIDUAL', - 'given_names' => 'Test Name', - 'middle_name' => 'middle_name', - 'surname' => 'surname', - 'business_name' => 'business_name', - 'street_line1' => 'street_line1', - 'street_line2' => 'street_line2', - 'city' => 'city', - 'province' => 'province', - 'state' => 'state', - 'country' => 'country', - 'zip_code' => '12345', - 'mobile_number' => '9876543210', - 'phone_number' => '987654321', - 'email' => 'email@test.com' - ] -]; - -$createDisbursementsWithbeneficiary = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursementsWithbeneficiary); -``` - -With receipt_notification optional field: - -```php -$params = [ - 'reference_id' => 'reference_id', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'PH_BDO', - 'account_name' => 'Test', - 'account_number' => '1234567890', - 'description' => 'PHP Disbursement from Example', - 'xendit-idempotency-key' => 'unique-id', - 'beneficiary' => [ - 'type' => 'INDIVIDUAL', - 'given_names' => 'Test Name', - 'middle_name' => 'middle_name', - 'surname' => 'surname', - 'business_name' => 'business_name', - 'street_line1' => 'street_line1', - 'street_line2' => 'street_line2', - 'city' => 'city', - 'province' => 'province', - 'state' => 'state', - 'country' => 'country', - 'zip_code' => '12345', - 'mobile_number' => '9876543210', - 'phone_number' => '987654321', - 'email' => 'email@test.com' - ], - 'receipt_notification' => [ - 'email_to' => ['test@test.com'], - 'email_cc' => [], - 'email_bcc' => [] - ] -]; - -$createDisbursementsWithReceipt = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursementsWithReceipt); -``` - -#### Get a PHP Disbursement by ID - -```php -\Xendit\DisbursementsPHP::getPHPDisbursementByID(string $id, array $params); -``` - -Usage example: - -```php -$id = 'php-disbursements-id'; -$retrieveParams = [ - 'for-user-id' => 'test-reference-user-id' -] -$getDisbursements = \Xendit\DisbursementsPHP::getPHPDisbursementByID($id, $retrieveParams); -var_dump($getDisbursements); -``` - -#### Get a PHP Disbursement by Reference ID - -```php -\Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID(string $reference_id); -``` - -Usage example: - -```php -$reference_id = 'reference_id'; -$getDisbursementsByRef = \Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID($reference_id); -var_dump($getDisbursementsByRef); -``` - -### Disbursement Channels - -#### Get Disbursement Channels - -```php -\Xendit\DisbursementChannels::getDisbursementChannels(); -``` - -Usage examples - -```php -$disbursementChannels = \Xendit\DisbursementChannels::getDisbursementChannels(); -var_dump($disbursementChannels); -``` - -#### Get Disbursement Channels By Channel Category - -```php -\Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory(string $channelCategory); -``` - -Usage examples - -```php -$channelCategory = 'Test'; -$getdisbursementChannelsByCategory = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory($channelCategory); -var_dump($getdisbursementChannelsByCategory); -``` - -#### Get Disbursement Channels By Channel Code - -```php -\Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode(string $channelCode); -``` - -Usage examples - -```php -$channelCode = 'Test'; -$getdisbursementChannelsByCode = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode($channelCode); -var_dump($getdisbursementChannelsByCode); -``` - -### E-Wallets - -#### Create E-Wallet Charge - -```php -\Xendit\EWallets::createEWalletCharge(array $params); -``` - -For more information about the params, please check [Xendit API Reference - E-Wallets](https://developers.xendit.co/api-reference/#create-ewallet-charge). - -Usage example: - -```php -$ewalletChargeParams = [ - 'reference_id' => 'test-reference-id', - 'currency' => 'IDR', - 'amount' => 50000, - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'channel_code' => 'ID_SHOPEEPAY', - 'channel_properties' => [ - 'success_redirect_url' => 'https://yourwebsite.com/order/123', - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -$createEWalletCharge = \Xendit\EWallets::createEWalletCharge($ewalletChargeParams); -var_dump($createEWalletCharge); -``` - -#### Get E-Wallet Charge Status - -```php -\Xendit\EWallets::getEWalletChargeStatus(string $charge_id, array $params); -``` - -Usage example: - -```php -$charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; -$eWalletStatusParam = [ - 'for-user-id' => 'test-reference-user-id' -] -$getEWalletChargeStatus = \Xendit\EWallets::getEWalletChargeStatus($charge_id, $eWalletStatusParam); -var_dump($getEWalletChargeStatus); -``` - -#### Void E-Wallet Charge - -```php -\Xendit\EWallets::voidEwalletCharge(string $charge_id,array $params); -``` - -Usage example: - -```php -$charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; -$voidEwalletChargeParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$voidEwalletCharge = \Xendit\EWallets::voidEwalletCharge($charge_id, $voidEwalletChargeParam); -var_dump($voidEwalletCharge); -``` - -#### Refund E-Wallet Charge - -```php -\Xendit\EWallets::refundEwalletCharge(string $charge_id,array $params); -``` - -Usage example: - -```php -$charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; -$refundEwalletChargeParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$refundEwalletCharge = \Xendit\EWallets::refundEwalletCharge($charge_id, $refundEwalletChargeParam); -var_dump($refundEwalletCharge); -``` - -#### Get Refund By ID - -```php -\Xendit\EWallets::getRefund(string $charge_id,string $refund_id, array $params); -``` - -Usage example: - -```php -$charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; -$refund_id = 'ewr_532as23lew2321id'; -$getRefundEwalletChargeParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$getRefundEwalletCharge = \Xendit\EWallets::getRefund($charge_id, $refund_id, $getRefundEwalletChargeParam); -var_dump($getRefundEwalletCharge); -``` - -#### List Refunds - -```php -\Xendit\EWallets::listRefund(string $charge_id, array $params); -``` - -Usage example: - -```php -$charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; -$listRefundEwalletChargeParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$listRefundEwalletCharge = \Xendit\EWallets::listRefund($charge_id, $getRefundEwalletChargeParam); -var_dump($listRefundEwalletCharge); -``` - -### Invoice - -#### Create Invoice - -```php -\Xendit\Invoice::create(array $params); -``` - -Usage example: - -```php -$params = ['external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000, - 'for-user-id' => '5c2323c67d6d305ac433ba20' -]; - -$createInvoice = \Xendit\Invoice::create($params); -var_dump($createInvoice); -``` - -#### Get Invoice - -```php -\Xendit\Invoice::retrieve(string $id, array $params); -``` - -Usage example: - -```php -$id = 'invoice-id'; -$retrieveParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -]; -$getInvoice = \Xendit\Invoice::retrieve($id, $retrieveParam); -var_dump($getInvoice); -``` - -#### Get All Invoice - -```php -\Xendit\Invoice::retrieveAll(array $params); -``` - -Usage example: - -```php -$retrieveAllParam = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -]; -$getAllInvoice = \Xendit\Invoice::retrieveAll($retrieveAllParam); -var_dump(($getAllInvoice)); -``` - -#### Expire Invoice - -```php -\Xendit\Invoice::expireInvoice(string $id, array $params); -``` - -Usage example: - -```php -$id = 'invoice-id'; -$params = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -]; -$expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); -var_dump($expireInvoice); -``` - -### Paylater - -#### Initiate PayLater Plans - -```php - -\Xendit\PayLater::initiatePayLaterPlans(array $params); -``` - -Usage example: - -```php -$params = [ - 'customer_id' => '', - 'channel_code' => 'ID_KREDIVO', - 'currency' => 'IDR', - 'amount' => 6000000, - 'order_items' => [ - [ - 'type' => 'PHYSICAL_PRODUCT', - 'reference_id' => '1533', - 'name' => 'Mobile Phone', - 'net_unit_amount' => 6000000, - 'quantity' => 1, - 'url' => '', - 'category' => 'Smartphone' - ] - ] -]; - -$payLaterPlan = \Xendit\PayLater::initiatePayLaterPlans($params); -var_dump($payLaterPlan); -``` - -#### Create Paylater Charges - -```php -\Xendit\PayLater::createPayLaterCharge(array $params); -``` - -Usage example: - -```php -$params = [ - 'plan_id' => $payLaterPlan['id'], - 'reference_id' => 'order_id_' . time(), - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'success_redirect_url' => '', - 'failure_redirect_url' => '', -]; -$payLaterCharge = \Xendit\PayLater::createPayLaterCharge($params); -var_dump($payLaterCharge); - -``` - -#### Get PayLater Charge by ID - -```php -\Xendit\PayLater::getPayLaterChargeStatus($id, array $params); -``` - -Usage example: - -```php -$params = []; // Optional (You can put for-user-id if needed) -$id = ''; -$payLaterCharge = \Xendit\PayLater::getPayLaterChargeStatus($id, $params); -var_dump($payLaterCharge); -``` - -#### Refund Paylater Charge - -```php -\Xendit\PayLater::createPayLaterRefund($id, array $params); -``` - -Usage example: - -```php -$params = []; // Optional (You can put for-user-id if needed) -$id = ''; -$payLaterCharge = \Xendit\PayLater::createPayLaterRefund($id, $params); -var_dump($payLaterCharge); -``` - -#### Create Paylater Refund - -```php -\Xendit\PayLater::createPayLaterRefund($id, array $params); -``` - -Usage example: - -```php -$params = []; // Optional (You can put for-user-id if needed) -$id = ''; -$payLaterChargeRefundCreate = \Xendit\PayLater::createPayLaterRefund($id, $params); -var_dump($payLaterChargeRefundCreate); - -``` - -#### Get PayLater Refund by ID - -```php -\Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, array $params); -``` - -Usage example: - -```php -$params = []; // Optional (You can put for-user-id if needed) -$charge_id = ''; -$refund_id = ''; -$payLaterChargeRefund = \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, $params); -var_dump($payLaterChargeRefund); - -``` - -#### List PayLater Refunds - -```php -\Xendit\PayLater::listPayLaterRefund($charge_id, array $params); -``` - -Usage example: - -```php -$params = []; // Optional (You can put for-user-id if needed) -$charge_id = ''; -$payLaterChargeRefundList = \Xendit\PayLater::listPayLaterRefund($charge_id, $params); -var_dump($payLaterChargeRefundList); - -``` - -#### Void Payout - -```php -\Xendit\Payouts::void(string $id); -``` - -Usage example: - -```php -$id = 'payout-id'; - -$voidPayout = \Xendit\Payouts::void($id); -var_dump($voidPayout); -``` - -### Payout Links - -#### Create Payout Links - -```php -\Xendit\Payouts::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'external_id' => 'payouts-123456789', - 'amount' => 50000 -]; - -$createPayout = \Xendit\Payouts::create($params); -var_dump($createPayout); -``` - -#### Get Payout Links - -```php -\Xendit\Payouts::retrieve(string $id, array $params); -``` - -Usage example: - -```php -$id = 'payout-id'; -$params = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$getPayout = \Xendit\Payouts::retrieve($id, $params); -var_dump($getPayout); -``` - -#### Void Payout Links - -```php -\Xendit\Payouts::void(string $id); -``` - -Usage example: - -```php -$id = 'payout-id'; - -$voidPayout = \Xendit\Payouts::void($id); -var_dump($voidPayout); -``` - -### QR Code - -#### Create a QR Code - -```php -\Xendit\QRCode::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'external_id' => 'demo_123456', - 'type' => 'STATIC', - 'callback_url' => 'https://webhook.site', - 'amount' => 10000, -]; - -$qr_code = \Xendit\QRCode::create($params); -var_dump($qr_code) -``` - -#### Get QR Code - -```php -\Xendit\QRCode::get(string $external_id); -``` - -Usage example: - -```php -$qr_code = \Xendit\QRCode::get('external_123'); -var_dump($qr_code); -``` - -### Recurring Payments - -#### Create a Recurring Payment - -```php -\Xendit\Recurring::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000, - 'interval' => 'MONTH', - 'interval_count' => 1 -]; - -$createRecurring = \Xendit\Recurring::create($params); -var_dump($createRecurring); -``` - -#### Get a Recurring Payment - -```php -\Xendit\Recurring::retrieve(string $id, array $params); -``` - -Usage example: - -```php -$id = 'recurring-payment-id'; -$params = [ - 'for-user-id' => 'test-reference-user-id' // OPTIONAL -] -$getRecurring = \Xendit\Recurring::retrieve($id, $params); -var_dump($getRecurring); -``` - -#### Edit Recurring Payment - -```php -\Xendit\Recurring::update(string $id, array $params); -``` - -Usage example: - -```php -$id = 'recurring-payment-id'; -$params = ['amount' => 10000]; - -$editRecurring = \Xendit\Recurring::update($id, $params); -var_dump($editRecurring); -``` - -#### Stop Recurring Payment - -```php -\Xendit\Recurring::stop(string $id); -``` - -Usage example: - -```php -$id = 'recurring-payment-id'; - -$stopRecurring = \Xendit\Recurring::stop($id); -var_dump($stopRecurring); -``` - -#### Pause Recurring Payment - -```php -\Xendit\Recurring::pause(string $id); -``` - -Usage example: - -```php -$id = 'recurring-payment-id'; - -$pauseRecurring = \Xendit\Recurring::pause($id); -var_dump($pauseRecurring); -``` - -#### Resume Recurring Payment - -```php -\Xendit\Recurring::resume(string $id); -``` - -Usage example: - -```php -$id = 'recurring-payment-id'; - -$resumeRecurring = \Xendit\Recurring::resume($id); -var_dump($resumeRecurring); -``` - -### Retail Outlets - -#### Create Fixed Payment Code - -```php -\Xendit\Retail::create(array $params); -``` - -Usage example: - -```php -$params = [ - 'external_id' => 'TEST-123456789', - 'retail_outlet_name' => 'ALFAMART', - 'name' => 'JOHN DOE', - 'expected_amount' => 25000 -]; - -$createFPC = \Xendit\Retail::create($params); -var_dump($createFPC); -``` - -#### Update Fixed Payment Code - -```php -\Xendit\Retail::update(string $id, array $params); -``` - -Usage example: - -```php -$id = 'FPC-id'; -$updateParams = ['expected_amount' => 20000]; - -$updateFPC = \Xendit\Retail::update($id, $updateParams); -var_dump($updateFPC); -``` - -#### Get Fixed Payment Code - -```php -\Xendit\Retail::retrieve(string $id); -``` - -Usage example: - -```php -$id = 'FPC-id'; -$getFPC = \Xendit\Retail::retrieve($id); -var_dump($getFPC); -``` - -### Virtual Accounts - -#### Create Fixed Virtual Account - -```php -\Xendit\VirtualAccounts::create(array $params); -``` - -Usage example: - -```php -$params = ["external_id" => "VA_fixed-12341234", - "bank_code" => "MANDIRI", - "name" => "Steve Wozniak" -]; - -$createVA = \Xendit\VirtualAccounts::create($params); -var_dump($createVA); -``` - -#### Get Virtual Account Bank - -```php -\Xendit\VirtualAccounts::getVABanks(); -``` - -Usage example: - -```php -$getVABanks = \Xendit\VirtualAccounts::getVABanks(); -var_dump($getVABanks); -``` - -#### Get Fixed Virtual Account - -```php -\Xendit\VirtualAccounts::retrieve(string $id, array $params); -``` - -Usage example: - -```php -$id = 'VA-id'; -$params = [ - 'for-user-id' => 'test-reference-user-id' //OPTIONAL -] -$getVA = \Xendit\VirtualAccounts::retrieve($id, $params); -var_dump($getVA); -``` - -#### Update Fixed Virtual Account - -```php -\Xendit\VirtualAccounts::update(string $id, array $params); -``` - -Usage example: - -```php -$id = 'VA-id'; -$updateParams = ["suggested_amount" => 1000]; - -$updateVA = \Xendit\VirtualAccounts::update($id, $updateParams); -var_dump($updateVA); -``` - -#### Get Fixed Virtual Account Payment - -```php -\Xendit\VirtualAccounts::getFVAPayment(string $paymentID); -``` - -Usage example: - -```php -$paymentID = 'payment-ID'; -$getFVAPayment = \Xendit\VirtualAccounts::getFVAPayment($paymentID); -var_dump($getFVAPayment); -``` - -### xenPlatform - -#### Create Account - -```php -\Xendit\Platform::createAccount(array $params); -``` - -Usage example: - -```php -$params = [ - 'email' => 'customer@website.com', - 'type' => 'OWNED', - 'public_profile' => ['business_name' => 'customer company'] -]; - -$createAccount = \Xendit\Platform::createAccount(array $params); -var_dump($createAccount); -``` - -#### Get Account - -```php -\Xendit\Platform::getAccount(string $account_id); -``` - -Usage example: - -```php -$getAccount = \Xendit\Platform::getAccount($accountId); -var_dump($getAccount); -``` - -#### Update Account - -```php -$updateAccount = \Xendit\Platform::updateAccount(string $account_id, array $params); -``` - -Usage example: - -```php -$updateParams = [ - 'email' => 'customer@website.com', - 'public_profile' => ['business_name' => 'customer company updated'] -]; -$updateAccount = \Xendit\Platform::updateAccount($accountId, $updateParams); -var_dump($updateAccount); -``` - -#### Create Transfers - -```php -$createTransfer = \Xendit\Platform::createTransfer(array $transferParams); -``` - -Usage example: - -```php -$transferParams = [ - 'reference' => ''.time(), - 'amount' => 50000, - 'source_user_id' => '54afeb170a2b18519b1b8768', - 'destination_user_id' => '5cafeb170a2b1851246b8768', -]; -$createTransfer = \Xendit\Platform::createTransfer($transferParams); -var_dump($createTransfer); -``` - -#### Create Fee Rule - -```php -$createFeeRule = \Xendit\Platform::createFeeRule(array $feeRuleParams); -``` - -Usage example: - -```php -$feeRuleParams = [ - 'name' => 'standard_platform_fee', - 'description' => 'Fee charged to insurance agents based in Java', - 'unit' => 'flat', - 'amount' => 6500, - 'currency' => 'IDR' -]; -$createFeeRule = \Xendit\Platform::createFeeRule($feeRuleParams); -var_dump($createFeeRule); -``` - -#### Set Callback URLs - -```php -$setCallbackUrl = \Xendit\Platform::setCallbackUrl(string $callbackType, array $callbackUrlParams); -``` - -Usage example: - -```php -$callbackUrlParams = [ - 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' -]; -$callbackType = 'invoice'; -$setCallbackUrl = \Xendit\Platform::setCallbackUrl($callbackType, $callbackUrlParams); -var_dump($setCallbackUrl); -``` - -### Transaction - -#### List of Transactions - -```php -\Xendit\Transaction::list(array $params); -``` - -Usage example: - -```php -$params = [ - 'types' => 'DISBURSEMENT' - 'for-user-id' => 'Your User Id', //Optional - 'query-param'=> 'true' //This is to enable parameters as query strings -]; - -$transactions = \Xendit\Transaction::list(array $params); -var_dump($transactions); -``` - -#### Detail of Transaction - -```php -\Xendit\Transaction::detail(string $transaction_id); -``` - -Usage example: - -```php -$detailTransaction = \Xendit\Transaction::detail(string $transaction_id); -var_dump($detailTransaction); -``` - -### Report - -#### Generate Report - -```php -\Xendit\Report::generate(array $params); -``` - -Usage example: - -```php -$params = [ - 'type' => 'TRANSACTIONS' -]; -$generate = \Xendit\Report::generate($params); -var_dump($generate); -``` - -#### Detail of Report - -```php -\Xendit\Report::detail(string $report_id); -``` - -Usage example: - -```php -$detailReport = \Xendit\Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); -var_dump($detailReport); -``` - -## Exceptions - -### InvalidArgumentException - -`InvalidArgumentException` will be thrown if the argument provided by user is not sufficient to create the request. - -For example, there are required arguments such as `external_id`, `payer_email`, `description`, and `amount` to create an invoice. If user lacks one or more arguments when attempting to create one, `InvalidArgumentException` will be thrown. - -`InvalidArgumentException` is derived from PHP's `InvalidArgumentException`. For more information about this Exception methods and properties, please check [PHP Documentation](https://www.php.net/manual/en/class.invalidargumentexception.php). - -### ApiException - -`ApiException` wraps up Xendit API error. This exception will be thrown if there are errors from Xendit API side, e.g. get fixed virtual account with invalid `id`. - -To get exception message: - -```php -try { - $getInvoice = \Xendit\Invoice::retrieve('123'); -} catch (\Xendit\Exceptions\ApiException $e) { - var_dump($e->getMessage()); -} -``` - -To get exception HTTP error code: - -```php -try { - $getInvoice = \Xendit\Invoice::retrieve('123'); -} catch (\Xendit\Exceptions\ApiException $e) { - var_dump($e->getCode()); -} -``` - -To get exception Xendit API error code: - -```php -try { - $getInvoice = \Xendit\Invoice::retrieve('123'); -} catch (\Xendit\Exceptions\ApiException $e) { - var_dump($e->getErrorCode()); -} -``` - -## Contributing - -For any requests, bugs, or comments, please open an [issue](https://github.com/xendit/xendit-php-clients/issues) or [submit a pull request](https://github.com/xendit/xendit-php-clients/pulls). - -### Installing Packages - -Before you start to code, run this command to install all of the required packages. Make sure you have `composer` installed in your computer - -```bash -composer install -``` - -### Tests - -#### Running test suite: - -```bash -vendor\bin\phpunit tests -``` - -#### Running examples: - -```bash -php examples\InvoiceExample.php -``` +Further Reading -There is a pre-commit hook to run phpcs and phpcbf. Please make sure they passed before making commits/pushes. +* [Xendit Docs](https://docs.xendit.co/) +* [Xendit API Reference](https://developers.xendit.co/) diff --git a/composer.json b/composer.json index 9be81ce..5d6849a 100644 --- a/composer.json +++ b/composer.json @@ -1,35 +1,40 @@ { "name": "xendit/xendit-php", - "description": "PHP clients for Xendit API", - "version": "2.19.0", - "license": "MIT", + "version": "3.0.0-beta.0", + "description": "Xendit PHP SDK", "keywords": [ - "xendit" + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } ], - "homepage": "https://github.com/xendit/xendit-php", - "type": "library", - "minimum-stability": "stable", "require": { - "php": ">=7.3.0", - "guzzlehttp/guzzle": ">=7.5.0", - "ext-json": "*" + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^1.7 || ^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0", + "friendsofphp/php-cs-fixer": "^3.5" }, "autoload": { - "psr-4": { - "Xendit\\": "src/" - } + "psr-4": { "Xendit\\" : "lib/" } }, "autoload-dev": { - "psr-4": { - "Xendit\\": [ - "tests/", - "tests/Xendit/" - ] - } - }, - "require-dev": { - "phpunit/phpunit": "^9", - "squizlabs/php_codesniffer": "^3.7.2", - "vlucas/phpdotenv": "^4.3" + "psr-4": { "Xendit\\Test\\" : "test/" } } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 90ff748..0000000 --- a/composer.lock +++ /dev/null @@ -1,2651 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "6f9bf57b86c7cffacac32de3f05daf29", - "packages": [ - { - "name": "guzzlehttp/guzzle", - "version": "7.5.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", - "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", - "psr/log": "^1.1 || ^2.0 || ^3.0" - }, - "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "psr-18", - "psr-7", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", - "type": "tidelift" - } - ], - "time": "2022-08-28T15:39:27+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "1.5.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", - "type": "tidelift" - } - ], - "time": "2022-08-28T14:55:35+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "2.4.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "67c26b443f348a51926030c83481b85718457d3d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", - "reference": "67c26b443f348a51926030c83481b85718457d3d", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^3.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.3" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "time": "2022-10-26T14:07:24+00:00" - }, - { - "name": "psr/http-client", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "support": { - "source": "https://github.com/php-fig/http-client/tree/master" - }, - "time": "2020-06-29T06:28:15+00:00" - }, - { - "name": "psr/http-factory", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "shasum": "" - }, - "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" - }, - "time": "2019-04-30T12:38:16+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/master" - }, - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, - "time": "2019-03-08T08:55:37+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.3-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-25T10:21:52+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2022-03-03T13:19:32+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.15.3", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" - }, - "time": "2023-01-16T22:05:37+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", - "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8", - "phpunit/phpunit": "^8.5.28 || ^9.5.21" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2022-07-30T15:51:26+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.24", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-01-26T08:26:55+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.6.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1 || ^2", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.6-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2023-02-04T13:37:15+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T12:41:17+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:10:38+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:03:51+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T06:03:37+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-02-14T08:28:10+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" - }, - { - "name": "sebastian/type", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:13:03+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.7.2", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2023-02-22T23:07:41+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v4.3.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "67a491df68208bef8c37092db11fa3885008efcf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/67a491df68208bef8c37092db11fa3885008efcf", - "reference": "67a491df68208bef8c37092db11fa3885008efcf", - "shasum": "" - }, - "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.7.3", - "symfony/polyfill-ctype": "^1.17" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.30" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v4.3.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2022-10-16T00:51:09+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.3.0", - "ext-json": "*" - }, - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/docs/BalanceAndTransaction.yaml b/docs/BalanceAndTransaction.yaml new file mode 100644 index 0000000..7c43f82 --- /dev/null +++ b/docs/BalanceAndTransaction.yaml @@ -0,0 +1,1054 @@ +openapi: 3.0.0 +info: + contact: + email: email@xendit.com + description: "# Introduction\nThis specification describes how to use the Transaction\ + \ Service V4 API. \n\n**Transaction Service** is the service that records the\ + \ customer transactions and is responsible to calculate their balance. All products\ + \ that move customer money around whether it is money-in, money-out, or transfer\ + \ will interact with the Transaction Service on its flow. Transaction Service\ + \ is the source of truth of Xendit and Customer regarding how much money that\ + \ customer has that is stored in Xendit. Transaction Service is the source that\ + \ is used for both our internal and customer financial reconciliation. Internally,\ + \ the Transaction Service data structure is similar to how double-entry accounting\ + \ works.\n\n## How Xendit teams/services do integrate with Transaction Service\ + \ V4\n\n\n**Channel product team/service** They interact with the Transaction\ + \ Service when they want to record the transactions. This transaction can be money-in\ + \ (balance added), money-out (balance deducted), transfer, refund/void/reversal,\ + \ or other kind of transaction that affects customer balance. Product team also\ + \ interacts with the Transaction Service for getting information about the transaction\ + \ or balance.\n\n**Billing/Fee team/service** They interact with Transaction Service\ + \ either as the dependency of Transaction Service for getting the correct fee\ + \ calculation/settings. Or using Transaction Service for getting the transaction/fee\ + \ information to calculate the bill for the customer.\n\n**NUX team/service**\ + \ They interact with the Transaction Service to set up the customer ledger_account\ + \ that is used to record their transactions.\n\n**Finance team/service** They\ + \ interact with the Transaction Service to get the transaction and balance data\ + \ for each customer to do reconciliation.\n\n**Dashboard/API team/service** They\ + \ interact with the Transaction Service as a proxy to show the data to the Customer.\n\ + \n## Prerequisites\n\nBefore staring to use **Transaction Service API** you need\ + \ to complete a few things:\n1. Find out **Base URL** for the API. Every endpoint\ + \ definition in this document contains list of available servers (local, staging,\ + \ production)\n2. Set up ledger accounts using business id and currency. **Ledger\ + \ Account** represents the account of the customer that will be used to associate\ + \ with ledger lines. Each business may have at least 1 ledger account group (a\ + \ group consists of a few accounts of types such as cash, liability, holding),\ + \ and the money movement of their ledger will revolve around those ledger accounts.\ + \ **Ledger Lines** that show a debit or credit transaction for a ledger account.\ + \ We’re using the double-entry principle in accounting where we should post 2\ + \ lines every time we make a transaction, 1 to debit an account and 1 to credit\ + \ another account. See how to call Create cash, liability, holding, and tax account for a business (api/ledger-accounts/setup)\ + \ section of this document\n3. To be able to create payments with fee/VAT the\ + \ Product rate settings and VAT rate settings should be created using Transaction\ + \ Fee Service. See Fee Service Documentation for details about how to create Product/VAT rate\ + \ settings.\n\n\n## Transaction flows\n\nTo integrate with the Transaction Service\ + \ you should decide what types of transaction flows your integration will be using.\ + \ Transaction flow is set by the transaction `type` during transaction creation\n\ + \n1. Money In flows\n 1. Payment from credit card\n\n\n `type: CREDIT_CARD_PAYMENT`\n\ + \t\t\n\t\t\n 3. Payment from other sources without fee/VAT\n\n\n `type:\ + \ DEPOSIT, FOREX_DEPOSIT, ISSUING_FUNDING_REFUND, BNPL_PARTNER_SETTLEMENT_CREDIT,\ + \ PROMO_FEE_CASHBACK, PROMO_VAT_CASHBACK, BATCH_VA_PAYMENT`\n\t\t\n\t\t\n 4.\ + \ Payment from other sources with fee/VAT\n\n\n `type: VA_PAYMENT, IM_ESCROW_VA_PAYMENT,\ + \ IM_DEPOSIT, RO_PAYMENT, EWALLET_PAYMENT, CARDLESS_CREDIT_PAYMENT, IM_REMITTANCE_VA_PAYMENT,\ + \ PAYLATER_PAYMENT, INVOICE, QR_CODE_PAYMENT, DIRECT_DEBIT_PAYMENT, DIRECT_BANK_TRANSFER,\ + \ ACH_PAYMENT, CRYPTO_PAYMENT`\n\t\t\n\t\t\n 5. Billing deposit from cash\n\ + \n\n `type: BILLING_DEPOSIT`\n\t\t\n\t\t\n 6. Billing deposit from other\ + \ sources\n\n\n `type: BILLING_DIRECT_DEPOSIT, BILLING_VA_DIRECT_DEPOSIT`\n\ + \t\t\n\t\t\n2. Money out flows\n 1. Instant payment\n\n\n `type: simple\ + \ money out types`\n\t\t\t\t\n `status: COMPLETED`\n\t\t\n\t\t\n 2.\ + \ Simple payment without fee/VAT\n\n\n `type: CHARGEBACK_DEDUCTION, FRAUD_DEDUCTION,\ + \ LOAN_REPAYMENT, FOREX_DEDUCTION, BNPL_PARTNER_SETTLEMENT_DEBIT, WITHDRAWAL`\n\ + \n\n 3. Simple payment with fee/VAT\n\n\n `type: ISSUING_FUNDING, BATCH_DISBURSEMENT,\ + \ CASH_DISBURSEMENT, DISBURSEMENT, REMITTANCE, REMITTANCE_PAYOUT, TAX_DISBURSEMENT`\n\ + \t\t\n\t\t\n 4. Billing withdraw to cash\n\n\n `type: BILLING_WITHDRAWAL`\n\ + \t\t\n\t\t\n 4. Billing withdraw to other destinations\n\n\n `type:\ + \ BILL_PAYMENT`\n\t\t\n\t\t\n3. Reversal flow\n\n Some of transactions could\ + \ be reversed. See Reversible / non reversible transaction types section of this document. To\ + \ reverse transaction you should call Update transaction (/api/transactions/:id) endpoint with the transaction\ + \ status `REVERSED`.\n\t\t\n4. Void/Cancellation Flow\n\n Transaction in the\ + \ `PENDING_SETTLEMENT` status could be canceled. To do that you should call Update transaction (/api/transactions/:id)\ + \ endpoint with the transaction status `VOIDED`.\n\t\t\n\t\t\n5. Switcher flow\n\ + \n Switchers are transactions that do not affect the customer balance. These\ + \ are transactions that goes directly to the customers’ account and simply passes\ + \ through Xendit. Therefore, it will not impact the customer balance and we will\ + \ only charge Fee and VAT. To create switcher flow you should set `is_switcher_payment`\ + \ field to `true`.\n\n\n\n\t\t\n## Instant/non instant settlement\n\nTransactions\ + \ can be performed instantly (instant settlement) or with delay (non instant settlement).\ + \ Some of the transaction types are only instantly processed, some of them support\ + \ both instant and non instant settlement and some of them have only non instant\ + \ settlement. If settlement is instant than balance will be changed instantly.\ + \ In opposite case the transaction status has to be set into PENDING_SETTLEMENT\ + \ and settlement date should be provided. \n\n1. Instant settlement Money In transaction\ + \ types\n\n `DEPOSIT, BATCH_VA_PAYMENT, FOREX_DEPOSIT, IM_DEPOSIT, CARDLESS_CREDIT_PAYMENT,\ + \ ISSUING_FUNDING_REFUND, BNPL_PARTNER_SETTLEMENT_CREDIT, PROMO_FEE_CASHBACK,\ + \ PROMO_VAT_CASHBACK, REMITTANCE_VA_PAYMENT_CLAIM`\n\t\t\n2. Both instant and\ + \ non instant Money In transaction types\n\n `DIRECT_DEBIT_PAYMENT, DIRECT_BANK_TRANSFER,\ + \ ACH_PAYMENT, RO_PAYMENT, EWALLET_PAYMENT, QR_CODE_PAYMENT, VA_PAYMENT, INVOICE,\ + \ PAYLATER_PAYMENT`\n\n3. Non Instant settlement Money In transaction types\n\n\ + \ `CREDIT_CARD_PAYMENT`\n\t\t\n4. Instant settlement Money Out transaction\ + \ types\n\n `LOAN_REPAYMENT, FOREX_DEDUCTION, BILL_PAYMENT, ISSUING_FUNDING,\ + \ BNPL_PARTNER_SETTLEMENT_DEBIT, FRAUD_DEDUCTION`\n\n5. Both instant and non instant\ + \ settlement supported Money Out transaction types\n\n `CHARGEBACK_DEDUCTION`\n\ + \n6. Non Instant settlement Money Out transaction types\n\n All other money\ + \ out types are non instant settlement\n\n## Reversible / non reversible transaction\ + \ types\n\nSome transactions can be reversed. Here are the list of transaction\ + \ types that could be reversed: \n\n`CASH_DISBURSEMENT, DISBURSEMENT, BATCH_DISBURSEMENT,\ + \ REMITTANCE, REMITTANCE_PAYOUT, TAX_DISBURSEMENT, WITHDRAWAL, DEPOSIT, FOREX_DEPOSIT,\ + \ FOREX_DEDUCTION, VA_PAYMENT, BATCH_VA_PAYMENT, IM_REMITTANCE_VA_PAYMENT, IM_ESCROW_VA_PAYMENT,\ + \ IM_DEPOSIT, REMITTANCE_VA_PAYMENT, REMITTANCE_VA_PAYMENT_CLAIM, RO_PAYMENT,\ + \ CARDLESS_CREDIT_PAYMENT, PAYLATER_PAYMENT, INVOICE, QR_CODE_PAYMENT, CREDIT_CARD_PAYMENT,\ + \ EWALLET_PAYMENT, DIRECT_DEBIT_PAYMENT, DIRECT_BANK_TRANSFER, ACH_PAYMENT, CHARGEBACK_DEDUCTION,\ + \ FRAUD_DEDUCTION, LOAN_REPAYMENT, ISSUING_FUNDING, ISSUING_FUNDING_REFUND, BNPL_PARTNER_SETTLEMENT_DEBIT,\ + \ BNPL_PARTNER_SETTLEMENT_CREDIT, BILLING_DEPOSIT, BILLING_DIRECT_DEPOSIT, BILLING_VA_DIRECT_DEPOSIT,\ + \ BILLING_WITHDRAWAL, BILL_PAYMENT, PROMO_FEE_CASHBACK, PROMO_VAT_CASHBACK`\n\n\ + \ \n## How to create transaction\n\nAfter you created or already have the `BUSINESS_CASH`\ + \ ledger account ID (See Prerequisites\ + \ section) and you know what transaction flows are going to be used you can create\ + \ the new transaction using POST request to the Create a new transaction (/api/transactions) endpoint\n\n## How to update\ + \ transaction\n\nTo update transaction you should do PATCH request to the Update transaction (/api/transactions/::id)\ + \ endpoint\n\n\n" + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: Transaction Service V4 API + version: 3.4.1 + x-logo: + url: https://dashboard.xendit.co/assets/images/xendit-blue-logo.svg +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /balance: + get: + description: "Retrieves balance for your business, defaults to CASH type" + operationId: getBalance + parameters: + - description: The selected balance type + explode: true + in: query + name: account_type + required: false + schema: + default: CASH + enum: + - CASH + - HOLDING + - TAX + example: CASH + type: string + style: form + - description: Currency for filter for customers with multi currency accounts + explode: true + in: query + name: currency + required: false + schema: + example: IDR + type: string + style: form + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5dbf20d7c8eb0c0896f811b6 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Balance' + description: success + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "invalid input, object invalid" + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ServerError' + description: Errors + summary: "Retrieves balances for a business, default to CASH type" + tags: + - balance + /transactions: + get: + description: Get a list of all transactions based on filter and search parameters. + operationId: getAllTransactions + parameters: + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5dbf20d7c8eb0c0896f811b6 + type: string + style: simple + - description: Transaction types that will be included in the result. Default + is to include all transaction types + example: + - DISBURSEMENT + - PAYMENT + explode: true + in: query + name: types + required: false + schema: + items: + $ref: '#/components/schemas/TransactionTypes' + type: array + style: form + - description: Status of the transaction. Default is to include all status. + example: + - SUCCESS + - PENDING + explode: true + in: query + name: statuses + required: false + schema: + items: + $ref: '#/components/schemas/TransactionStatuses' + type: array + style: form + - description: Payment channels in which the transaction is carried out. Default + is to include all channels. + example: + - BANK + - INVOICE + explode: true + in: query + name: channel_categories + required: false + schema: + items: + $ref: '#/components/schemas/ChannelsCategories' + type: array + style: form + - description: To filter the result for transactions with matching reference + given (case sensitive) + example: ref23232 + explode: true + in: query + name: reference_id + required: false + schema: + type: string + style: form + - description: To filter the result for transactions with matching product_id + (a.k.a payment_id) given (case sensitive) + example: d290f1ee-6c54-4b01-90e6-d701748f0701 + explode: true + in: query + name: product_id + required: false + schema: + type: string + style: form + - description: "Account identifier of transaction. The format will be different\ + \ from each channel. For example, on `BANK` channel it will be account number\ + \ and on `CARD` it will be masked card number." + example: 123123123 + explode: true + in: query + name: account_identifier + required: false + schema: + type: string + style: form + - description: Specific transaction amount to search for + example: 100 + explode: true + in: query + name: amount + required: false + schema: + type: number + style: form + - explode: true + in: query + name: currency + required: false + schema: + $ref: '#/components/schemas/Currency' + style: form + - description: Filter time of transaction by created date. If not specified + will list all dates. + explode: true + in: query + name: created + required: false + schema: + $ref: '#/components/schemas/DateRangeFilter' + style: deepObject + - description: Filter time of transaction by updated date. If not specified + will list all dates. + explode: true + in: query + name: updated + required: false + schema: + $ref: '#/components/schemas/DateRangeFilter' + style: deepObject + - description: number of items in the result per page. Another name for "results_per_page" + example: 10 + explode: true + in: query + name: limit + required: false + schema: + default: 10 + maximum: 50 + type: number + style: form + - explode: true + in: query + name: after_id + required: false + schema: + $ref: '#/components/schemas/TransactionId' + style: form + - explode: true + in: query + name: before_id + required: false + schema: + $ref: '#/components/schemas/TransactionId' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionsResponse' + description: List of transaction object + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "invalid input, object invalid" + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ServerError' + description: Errors + summary: Get a list of transactions + tags: + - transaction + /transactions/{id}: + get: + description: Get single specific transaction by transaction id. + operationId: getTransactionByID + parameters: + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5dbf20d7c8eb0c0896f811b6 + type: string + style: simple + - explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/TransactionId' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionResponse' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "invalid input, object invalid" + default: + content: + application/json: + schema: + $ref: '#/components/schemas/ServerError' + description: Errors + summary: Get a transaction based on its id + tags: + - transaction +components: + parameters: + TransactionTypes: + description: Transaction types that will be included in the result. Default + is to include all transaction types + example: + - DISBURSEMENT + - PAYMENT + explode: true + in: query + name: types + required: false + schema: + items: + $ref: '#/components/schemas/TransactionTypes' + type: array + style: form + TransactionStatuses: + description: Status of the transaction. Default is to include all status. + example: + - SUCCESS + - PENDING + explode: true + in: query + name: statuses + required: false + schema: + items: + $ref: '#/components/schemas/TransactionStatuses' + type: array + style: form + ChannelsCategories: + description: Payment channels in which the transaction is carried out. Default + is to include all channels. + example: + - BANK + - INVOICE + explode: true + in: query + name: channel_categories + required: false + schema: + items: + $ref: '#/components/schemas/ChannelsCategories' + type: array + style: form + ReferenceId: + description: To filter the result for transactions with matching reference given + (case sensitive) + example: ref23232 + explode: true + in: query + name: reference_id + required: false + schema: + type: string + style: form + ProductId: + description: To filter the result for transactions with matching product_id + (a.k.a payment_id) given (case sensitive) + example: d290f1ee-6c54-4b01-90e6-d701748f0701 + explode: true + in: query + name: product_id + required: false + schema: + type: string + style: form + AccountIdentifier: + description: "Account identifier of transaction. The format will be different\ + \ from each channel. For example, on `BANK` channel it will be account number\ + \ and on `CARD` it will be masked card number." + example: 123123123 + explode: true + in: query + name: account_identifier + required: false + schema: + type: string + style: form + Amount: + description: Specific transaction amount to search for + example: 100 + explode: true + in: query + name: amount + required: false + schema: + type: number + style: form + Limit: + description: number of items in the result per page. Another name for "results_per_page" + example: 10 + explode: true + in: query + name: limit + required: false + schema: + default: 10 + maximum: 50 + type: number + style: form + schemas: + Balance: + description: The balance remaining in your account + example: + balance: 123000.12 + properties: + balance: + example: 123000.12 + type: number + required: + - balance + type: object + LinkItem: + example: + method: GET + rel: next + href: /transactions?types=PAYMENT&statuses=SUCCESS&channel_categories=EWALLET&channel_categories=RETAIL_OUTLET&limit=2&after_id=txn_a765a3f0-34c0-41ee-8686-bca11835ebdc + properties: + href: + description: "URI of target, this will be to the next link." + example: /transactions?types=PAYMENT&statuses=SUCCESS&channel_categories=EWALLET&channel_categories=RETAIL_OUTLET&limit=2&after_id=txn_a765a3f0-34c0-41ee-8686-bca11835ebdc + type: string + rel: + description: The relationship between source and target. The value will + be `next`. + example: next + type: string + method: + description: "The HTTP method, the value will be `GET`." + example: GET + type: string + required: + - href + - method + - rel + type: object + TransactionsResponse: + description: Returns an array of Transaction Objects. Returns empty array when + there is no result. + example: + data: + - amount: 150.21 + settlement_status: PENDING + reference_id: My custom reference + created: 2016-08-29T09:12:33.001Z + fee: + third_party_withholding_tax: 10 + value_added_tax: 1 + xendit_withholding_tax: 10 + xendit_fee: 10 + status: PENDING + account_identifier: "123123123" + channel_code: BCA + type: null + channel_category: INVOICE + estimated_settlement_time: 2016-08-29T09:12:33.001Z + cashflow: MONEY_IN + product_id: d290f1ee-6c54-4b01-90e6-d701748f0851 + currency: IDR + id: txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 + business_id: 5fc9f5b246f820517e38c84d + updated: 2016-08-29T09:12:33.001Z + status: SUCCESS + - amount: 150.21 + settlement_status: PENDING + reference_id: My custom reference + created: 2016-08-29T09:12:33.001Z + fee: + third_party_withholding_tax: 10 + value_added_tax: 1 + xendit_withholding_tax: 10 + xendit_fee: 10 + status: PENDING + account_identifier: "123123123" + channel_code: BCA + type: null + channel_category: INVOICE + estimated_settlement_time: 2016-08-29T09:12:33.001Z + cashflow: MONEY_IN + product_id: d290f1ee-6c54-4b01-90e6-d701748f0851 + currency: IDR + id: txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 + business_id: 5fc9f5b246f820517e38c84d + updated: 2016-08-29T09:12:33.001Z + status: SUCCESS + links: + - method: GET + rel: next + href: /transactions?types=PAYMENT&statuses=SUCCESS&channel_categories=EWALLET&channel_categories=RETAIL_OUTLET&limit=2&after_id=txn_a765a3f0-34c0-41ee-8686-bca11835ebdc + - method: GET + rel: next + href: /transactions?types=PAYMENT&statuses=SUCCESS&channel_categories=EWALLET&channel_categories=RETAIL_OUTLET&limit=2&after_id=txn_a765a3f0-34c0-41ee-8686-bca11835ebdc + has_more: true + properties: + has_more: + description: Indicates whether there are more items to be queried with `after_id` + of the last item from the current result. Use the `links` to follow to + the next result. + type: boolean + links: + description: The links to the next page based on LinkItem if there is next + result. + items: + $ref: '#/components/schemas/LinkItem' + type: array + data: + items: + $ref: '#/components/schemas/TransactionResponse' + type: array + required: + - data + - has_more + type: object + DateRangeFilter: + properties: + gte: + description: Start time of transaction. If not specified will list all dates. + example: 2020-08-29T17:00:00Z + format: date-time + type: string + lte: + description: End time of transaction. If not specified will list all dates. + example: 2020-08-29T17:00:00Z + format: date-time + type: string + type: object + TransactionId: + description: The unique id of a transaction. It will have `txn_` as prefix + example: txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 + pattern: "^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + type: string + Currency: + enum: + - IDR + - PHP + - USD + - JPY + - VND + - SGD + - AED + - AFN + - ALL + - AMD + - ANG + - AOA + - ARS + - AUD + - AWG + - AZN + - BAM + - BBD + - BDT + - BGN + - BHD + - BIF + - BMD + - BND + - BOB + - BRL + - BSD + - BTN + - BWP + - BYN + - BZD + - CAD + - CDF + - CHF + - CLP + - CNY + - COP + - CRC + - CUC + - CUP + - CVE + - CZK + - DJF + - DKK + - DOP + - DZD + - EGP + - ERN + - ETB + - EUR + - FJD + - FKP + - GBP + - GEL + - GGP + - GHS + - GIP + - GMD + - GNF + - GTQ + - GYD + - HKD + - HNL + - HRK + - HTG + - HUF + - ILS + - IMP + - INR + - IQD + - IRR + - ISK + - JEP + - JMD + - JOD + - KES + - KGS + - KHR + - KMF + - KPW + - KRW + - KWD + - KYD + - KZT + - LAK + - LBP + - LKR + - LRD + - LSL + - LYD + - MAD + - MDL + - MGA + - MKD + - MMK + - MNT + - MOP + - MRU + - MUR + - MVR + - MWK + - MXN + - MYR + - MZN + - NAD + - NGN + - NIO + - NOK + - NPR + - NZD + - OMR + - PAB + - PEN + - PGK + - PKR + - PLN + - PYG + - QAR + - RON + - RSD + - RUB + - RWF + - SAR + - SBD + - SCR + - SDG + - SEK + - SHP + - SLL + - SOS + - SPL + - SRD + - STN + - SVC + - SYP + - SZL + - THB + - TJS + - TMT + - TND + - TOP + - TRY + - TTD + - TVD + - TWD + - TZS + - UAH + - UGX + - UYU + - UZS + - VEF + - VUV + - WST + - XAF + - XCD + - XDR + - XOF + - XPF + - YER + - ZAR + - ZMW + - ZWD + example: IDR + type: string + ValidationError: + properties: + status_code: + example: 400 + type: number + error: + example: API_VALIDATION_ERROR + type: string + message: + example: \"from\" is required. \"status\" is required. \"currency\" is required + type: string + validation: + example: + source: query + keys: + - from + - status + - currency + nullable: true + type: object + required: + - error + - message + - status_code + type: object + ServerError: + properties: + status_code: + example: 500 + type: number + error: + example: Internal Server Error + type: string + message: + example: An internal server error occurred + type: string + required: + - error + - message + - status_code + type: object + TransactionTypes: + enum: + - BATCH_DISBURSEMENT + - DISBURSEMENT + - PAYMENT + - REMITTANCE + - REMITTANCE_PAYOUT + - REMITTANCE_COLLECTION + - TRANSFER + - PLATFORM_FEE + - REFUND + - CASHBACK + - TOPUP + - WITHDRAWAL + - OTHER + example: DISBURSEMENT + type: string + ChannelsCategories: + enum: + - BANK + - CARDLESS_CREDIT + - PAYLATER + - CARDS + - CASH + - DIRECT_DEBIT + - EWALLET + - INVOICE + - QR_CODE + - RETAIL_OUTLET + - VIRTUAL_ACCOUNT + - XENPLATFORM + - DIRECT_BANK_TRANSFER + - OTHER + example: INVOICE + type: string + TransactionResponse: + example: + amount: 150.21 + settlement_status: PENDING + reference_id: My custom reference + created: 2016-08-29T09:12:33.001Z + fee: + third_party_withholding_tax: 10 + value_added_tax: 1 + xendit_withholding_tax: 10 + xendit_fee: 10 + status: PENDING + account_identifier: "123123123" + channel_code: BCA + type: null + channel_category: INVOICE + estimated_settlement_time: 2016-08-29T09:12:33.001Z + cashflow: MONEY_IN + product_id: d290f1ee-6c54-4b01-90e6-d701748f0851 + currency: IDR + id: txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 + business_id: 5fc9f5b246f820517e38c84d + updated: 2016-08-29T09:12:33.001Z + status: SUCCESS + properties: + id: + description: The unique id of a transaction. It will have `txn_` as prefix + example: txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 + pattern: "^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + type: string + product_id: + description: The product_id of the transaction. Product id will have a different + prefix for each product. You can use this id to match the transaction + from this API to each product API. + example: d290f1ee-6c54-4b01-90e6-d701748f0851 + type: string + type: + $ref: '#/components/schemas/TransactionResponse_type' + status: + $ref: '#/components/schemas/TransactionStatuses' + channel_category: + $ref: '#/components/schemas/ChannelsCategories' + channel_code: + description: "The channel of the transaction that is used. See [channel\ + \ codes](https://docs.xendit.co/xendisburse/channel-codes) for the list\ + \ of available per channel categories." + example: BCA + nullable: true + type: string + account_identifier: + description: Account identifier of transaction. The format will be different + from each channel. + example: "123123123" + nullable: true + type: string + reference_id: + description: customer supplied reference/external_id + example: My custom reference + type: string + currency: + $ref: '#/components/schemas/Currency' + amount: + description: The transaction amount. The number of decimal places will be + different for each currency according to ISO 4217. + example: 150.21 + type: number + cashflow: + description: "Representing whether the transaction is money in or money\ + \ out For transfer, the transfer out side it will shows up as money out\ + \ and on transfer in side in will shows up as money-in. Available values\ + \ are `MONEY_IN` for money in and `MONEY_OUT` for money out." + enum: + - MONEY_IN + - MONEY_OUT + type: string + settlement_status: + description: The settlement status of the transaction. `PENDING` - Transaction + amount has not been settled to merchant's balance. `SETTLED` - Transaction + has been settled to merchant's balance + enum: + - PENDING + - SETTLED + nullable: true + type: string + estimated_settlement_time: + description: "Estimated settlement time will only apply to money-in transactions.\ + \ For money-out transaction, the value will be `NULL`. Estimated settlement\ + \ time in which transaction amount will be settled to merchant's balance." + example: 2016-08-29T09:12:33.001Z + format: date-time + nullable: true + type: string + business_id: + description: The id of business where this transaction belong to + example: 5fc9f5b246f820517e38c84d + type: string + fee: + $ref: '#/components/schemas/FeeResponse' + created: + description: Transaction created timestamp (UTC+0) + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + updated: + description: Transaction updated timestamp (UTC+0) + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + required: + - account_identifier + - amount + - business_id + - cashflow + - channel_category + - channel_code + - created + - currency + - fee + - id + - product_id + - reference_id + - status + - type + - updated + type: object + FeeResponse: + example: + third_party_withholding_tax: 10 + value_added_tax: 1 + xendit_withholding_tax: 10 + xendit_fee: 10 + status: PENDING + properties: + xendit_fee: + description: Amount of the Xendit fee for this transaction. + example: 10 + type: number + value_added_tax: + description: Amount of the VAT for this transaction. + example: 1 + type: number + xendit_withholding_tax: + description: "Amount of the Xendit Withholding Tax for this transaction\ + \ if applicable. See [Tax Documentation](https://docs.xendit.co/fees-and-vat#vat)\ + \ for more information." + example: 10 + type: number + third_party_withholding_tax: + description: | + Amount of the 3rd Party Withholding Tax for this transaction if applicable. 3rd party example: Bank + example: 10 + type: number + status: + enum: + - PENDING + - COMPLETED + - CANCELED + - REVERSED + type: string + required: + - value_added_tax + - xendit_fee + type: object + TransactionStatuses: + enum: + - SUCCESS + - PENDING + - FAILED + - REVERSED + - VOIDED + example: SUCCESS + type: string + TransactionResponse_type: + anyOf: + - $ref: '#/components/schemas/TransactionTypes' + - type: string + description: The type of the transactions. diff --git a/docs/BalanceAndTransaction/Balance.md b/docs/BalanceAndTransaction/Balance.md new file mode 100644 index 0000000..4dbd5b4 --- /dev/null +++ b/docs/BalanceAndTransaction/Balance.md @@ -0,0 +1,14 @@ +# # Balance + + +```php +use Xendit\BalanceAndTransaction\Balance; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**balance** | **float** | | 123000.12 | + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/BalanceApi.md b/docs/BalanceAndTransaction/BalanceApi.md new file mode 100644 index 0000000..7806ba5 --- /dev/null +++ b/docs/BalanceAndTransaction/BalanceApi.md @@ -0,0 +1,65 @@ +# Xendit\BalanceApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getBalance()**](BalanceApi.md#getBalance) | **GET** /balance | Retrieves balances for a business, default to CASH type | + + +## `getBalance()` + +```php +getBalance($account_type, $currency, $for_user_id): \BalanceAndTransaction\Balance +``` + +Retrieves balances for a business, default to CASH type + +Retrieves balance for your business, defaults to CASH type + +### Example + +```php +getBalance($account_type, $currency, $for_user_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BalanceApi->getBalance: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_type** | **string**| The selected balance type | [optional] [default to 'CASH'] | +| **currency** | **string**| Currency for filter for customers with multi currency accounts | [optional] | +| **for_user_id** | **string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information | [optional] | + +### Return type + +[**\Xendit\BalanceAndTransaction\Balance**](Balance.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/ChannelsCategories.md b/docs/BalanceAndTransaction/ChannelsCategories.md new file mode 100644 index 0000000..fb1f73c --- /dev/null +++ b/docs/BalanceAndTransaction/ChannelsCategories.md @@ -0,0 +1,13 @@ +# # ChannelsCategories + + +```php +use Xendit\BalanceAndTransaction\ChannelsCategories; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/Currency.md b/docs/BalanceAndTransaction/Currency.md new file mode 100644 index 0000000..2491b9d --- /dev/null +++ b/docs/BalanceAndTransaction/Currency.md @@ -0,0 +1,13 @@ +# # Currency + + +```php +use Xendit\BalanceAndTransaction\Currency; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/DateRangeFilter.md b/docs/BalanceAndTransaction/DateRangeFilter.md new file mode 100644 index 0000000..41ec4e1 --- /dev/null +++ b/docs/BalanceAndTransaction/DateRangeFilter.md @@ -0,0 +1,15 @@ +# # DateRangeFilter + + +```php +use Xendit\BalanceAndTransaction\DateRangeFilter; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**gte** | **\DateTime** | Start time of transaction. If not specified will list all dates. | 2020-08-29T17:00Z | [optional] +**lte** | **\DateTime** | End time of transaction. If not specified will list all dates. | 2020-08-29T17:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/FeeResponse.md b/docs/BalanceAndTransaction/FeeResponse.md new file mode 100644 index 0000000..4a7fe76 --- /dev/null +++ b/docs/BalanceAndTransaction/FeeResponse.md @@ -0,0 +1,18 @@ +# # FeeResponse + + +```php +use Xendit\BalanceAndTransaction\FeeResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**xendit_fee** | **float** | Amount of the Xendit fee for this transaction. | 10 | +**value_added_tax** | **float** | Amount of the VAT for this transaction. | 1 | +**xendit_withholding_tax** | **float** | Amount of the Xendit Withholding Tax for this transaction if applicable. See [Tax Documentation](https://docs.xendit.co/fees-and-vat#vat) for more information. | 10 | [optional] +**third_party_withholding_tax** | **float** | Amount of the 3rd Party Withholding Tax for this transaction if applicable. 3rd party example: Bank | 10 | [optional] +**status** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/LinkItem.md b/docs/BalanceAndTransaction/LinkItem.md new file mode 100644 index 0000000..7401f1e --- /dev/null +++ b/docs/BalanceAndTransaction/LinkItem.md @@ -0,0 +1,16 @@ +# # LinkItem + + +```php +use Xendit\BalanceAndTransaction\LinkItem; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**href** | **string** | URI of target, this will be to the next link. | /transactions?types=PAYMENT&statuses=SUCCESS&channel_categories=EWALLET&channel_categories=RETAIL_OUTLET&limit=2&after_id=txn_a765a3f0-34c0-41ee-8686-bca11835ebdc | +**rel** | **string** | The relationship between source and target. The value will be `next`. | next | +**method** | **string** | The HTTP method, the value will be `GET`. | GET | + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/ServerError.md b/docs/BalanceAndTransaction/ServerError.md new file mode 100644 index 0000000..ae55475 --- /dev/null +++ b/docs/BalanceAndTransaction/ServerError.md @@ -0,0 +1,16 @@ +# # ServerError + + +```php +use Xendit\BalanceAndTransaction\ServerError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**status_code** | **float** | | 500 | +**error** | **string** | | Internal Server Error | +**message** | **string** | | An internal server error occurred | + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionApi.md b/docs/BalanceAndTransaction/TransactionApi.md new file mode 100644 index 0000000..90ea861 --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionApi.md @@ -0,0 +1,143 @@ +# Xendit\TransactionApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAllTransactions()**](TransactionApi.md#getAllTransactions) | **GET** /transactions | Get a list of transactions | +| [**getTransactionByID()**](TransactionApi.md#getTransactionByID) | **GET** /transactions/{id} | Get a transaction based on its id | + + +## `getAllTransactions()` + +```php +getAllTransactions($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id): \BalanceAndTransaction\TransactionsResponse +``` + +Get a list of transactions + +Get a list of all transactions based on filter and search parameters. + +### Example + +```php + new \Xendit\BalanceAndTransaction\DateRangeFilter()); // DateRangeFilter | Filter time of transaction by created date. If not specified will list all dates. +$updated = array('key' => new \Xendit\BalanceAndTransaction\DateRangeFilter()); // DateRangeFilter | Filter time of transaction by updated date. If not specified will list all dates. +$limit = 10; // float | number of items in the result per page. Another name for \"results_per_page\" +$after_id = "'after_id_example'"; // string +$before_id = "'before_id_example'"; // string + +try { + $result = $apiInstance->getAllTransactions($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionApi->getAllTransactions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **for_user_id** | **string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information | [optional] | +| **types** | [**TransactionTypes**](TransactionTypes.md)| Transaction types that will be included in the result. Default is to include all transaction types | [optional] | +| **statuses** | [**TransactionStatuses**](TransactionStatuses.md)| Status of the transaction. Default is to include all status. | [optional] | +| **channel_categories** | [**ChannelsCategories**](ChannelsCategories.md)| Payment channels in which the transaction is carried out. Default is to include all channels. | [optional] | +| **reference_id** | **string**| To filter the result for transactions with matching reference given (case sensitive) | [optional] | +| **product_id** | **string**| To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) | [optional] | +| **account_identifier** | **string**| Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. | [optional] | +| **amount** | **float**| Specific transaction amount to search for | [optional] | +| **currency** | [**Currency**](Currency.md)| | [optional] | +| **created** | [**DateRangeFilter**](DateRangeFilter.md)| Filter time of transaction by created date. If not specified will list all dates. | [optional] | +| **updated** | [**DateRangeFilter**](DateRangeFilter.md)| Filter time of transaction by updated date. If not specified will list all dates. | [optional] | +| **limit** | **float**| number of items in the result per page. Another name for \"results_per_page\" | [optional] [default to 10] | +| **after_id** | **string**| | [optional] | +| **before_id** | **string**| | [optional] | + +### Return type + +[**\Xendit\BalanceAndTransaction\TransactionsResponse**](TransactionsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getTransactionByID()` + +```php +getTransactionByID($id, $for_user_id): \BalanceAndTransaction\TransactionResponse +``` + +Get a transaction based on its id + +Get single specific transaction by transaction id. + +### Example + +```php +getTransactionByID($id, $for_user_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionApi->getTransactionByID: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| | | +| **for_user_id** | **string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information | [optional] | + +### Return type + +[**\Xendit\BalanceAndTransaction\TransactionResponse**](TransactionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionResponse.md b/docs/BalanceAndTransaction/TransactionResponse.md new file mode 100644 index 0000000..9cc963d --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionResponse.md @@ -0,0 +1,30 @@ +# # TransactionResponse + + +```php +use Xendit\BalanceAndTransaction\TransactionResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | The unique id of a transaction. It will have `txn_` as prefix | txn_438e4b61-7c4c-4dbb-bbba-94a896bff333 | +**product_id** | **string** | The product_id of the transaction. Product id will have a different prefix for each product. You can use this id to match the transaction from this API to each product API. | d290f1ee-6c54-4b01-90e6-d701748f0851 | +**type** | [**TransactionResponseType**](TransactionResponseType.md) | | null | +**status** | [**TransactionStatuses**](TransactionStatuses.md) | | null | +**channel_category** | [**ChannelsCategories**](ChannelsCategories.md) | | null | +**channel_code** | **string** | The channel of the transaction that is used. See [channel codes](https://docs.xendit.co/xendisburse/channel-codes) for the list of available per channel categories. | BCA | +**account_identifier** | **string** | Account identifier of transaction. The format will be different from each channel. | 123123123 | +**reference_id** | **string** | customer supplied reference/external_id | My custom reference | +**currency** | [**Currency**](Currency.md) | | null | +**amount** | **float** | The transaction amount. The number of decimal places will be different for each currency according to ISO 4217. | 150.21 | +**cashflow** | **string** | Representing whether the transaction is money in or money out For transfer, the transfer out side it will shows up as money out and on transfer in side in will shows up as money-in. Available values are `MONEY_IN` for money in and `MONEY_OUT` for money out. | null | +**settlement_status** | **string** | The settlement status of the transaction. `PENDING` - Transaction amount has not been settled to merchant's balance. `SETTLED` - Transaction has been settled to merchant's balance | null | [optional] +**estimated_settlement_time** | **\DateTime** | Estimated settlement time will only apply to money-in transactions. For money-out transaction, the value will be `NULL`. Estimated settlement time in which transaction amount will be settled to merchant's balance. | 2016-08-29T09:12:33.001Z | [optional] +**business_id** | **string** | The id of business where this transaction belong to | 5fc9f5b246f820517e38c84d | +**fee** | [**FeeResponse**](FeeResponse.md) | | null | +**created** | **\DateTime** | Transaction created timestamp (UTC+0) | 2016-08-29T09:12:33.001Z | +**updated** | **\DateTime** | Transaction updated timestamp (UTC+0) | 2016-08-29T09:12:33.001Z | + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionResponseType.md b/docs/BalanceAndTransaction/TransactionResponseType.md new file mode 100644 index 0000000..cd21a32 --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionResponseType.md @@ -0,0 +1,13 @@ +# # TransactionResponseType + + +```php +use Xendit\BalanceAndTransaction\TransactionResponseType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionStatuses.md b/docs/BalanceAndTransaction/TransactionStatuses.md new file mode 100644 index 0000000..d44953a --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionStatuses.md @@ -0,0 +1,13 @@ +# # TransactionStatuses + + +```php +use Xendit\BalanceAndTransaction\TransactionStatuses; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionTypes.md b/docs/BalanceAndTransaction/TransactionTypes.md new file mode 100644 index 0000000..69e2348 --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionTypes.md @@ -0,0 +1,13 @@ +# # TransactionTypes + + +```php +use Xendit\BalanceAndTransaction\TransactionTypes; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/TransactionsResponse.md b/docs/BalanceAndTransaction/TransactionsResponse.md new file mode 100644 index 0000000..433809c --- /dev/null +++ b/docs/BalanceAndTransaction/TransactionsResponse.md @@ -0,0 +1,16 @@ +# # TransactionsResponse + + +```php +use Xendit\BalanceAndTransaction\TransactionsResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**has_more** | **bool** | Indicates whether there are more items to be queried with `after_id` of the last item from the current result. Use the `links` to follow to the next result. | null | +**links** | [**array**](LinkItem.md) | The links to the next page based on LinkItem if there is next result. | null | [optional] +**data** | [**array**](TransactionResponse.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/BalanceAndTransaction/ValidationError.md b/docs/BalanceAndTransaction/ValidationError.md new file mode 100644 index 0000000..d0bd576 --- /dev/null +++ b/docs/BalanceAndTransaction/ValidationError.md @@ -0,0 +1,17 @@ +# # ValidationError + + +```php +use Xendit\BalanceAndTransaction\ValidationError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**status_code** | **float** | | 400 | +**error** | **string** | | API_VALIDATION_ERROR | +**message** | **string** | | \"from\" is required. \"status\" is required. \"currency\" is required | +**validation** | **object** | | {"source":"query","keys":["from","status","currency"]} | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice.yaml b/docs/Invoice.yaml new file mode 100644 index 0000000..cbc3a09 --- /dev/null +++ b/docs/Invoice.yaml @@ -0,0 +1,1401 @@ +openapi: 3.0.0 +info: + description: xendit-invoice-service descriptions + title: xendit-invoice-service + version: 1.4.2 +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /v2/invoices/: + post: + operationId: createInvoice + requestBody: + content: + application/json: + examples: + Create Invoice Request: + value: + external_id: test1234 + description: Test Invoice + amount: 10000 + invoice_duration: 172800 + currency: IDR + reminder_time: 1 + schema: + $ref: '#/components/schemas/CreateInvoiceRequest' + required: true + responses: + "200": + content: + application/json: + examples: + Successfully created Invoice: + $ref: '#/components/examples/InvoiceExample' + value: null + schema: + $ref: '#/components/schemas/Invoice' + description: OK + "400": + content: + application/json: + examples: + Maximum Transfer Amount Error: + value: + error_code: MAXIMUM_TRANSFER_AMOUNT_ERROR + message: "The maximum amount for using this payment is ${currency}\ + \ 5,000,000" + No Collections Method Error: + value: + error_code: NO_COLLECTION_METHODS_ERROR + message: Could not create invoice without any active payment channels + Email Format Error: + summary: EMAIL_FORMAT_ERROR + value: + error_code: EMAIL_FORMAT_ERROR + message: Customer email format is invalid + Unavailable Payment Error: + value: + error_code: UNAVAILABLE_PAYMENT_METHOD_ERROR + message: The payment method choices did not match with the available + one on this business + Unsupported Currency Error: + value: + error_code: UNSUPPORTED_CURRENCY + message: The payment currency request is not supported for this + payment channel + Currency Mismatch Error: + summary: Invoice settings not found for this currency' + value: + error_code: MISMATCH_CURRENCY_ERROR + message: "" + Invalid Remind Time Error: + value: + error_code: INVALID_REMINDER_TIME + message: The reminder time is invalid + Invoice Amount Mismatch: + value: + error_code: INVOICE_AMOUNT_MISMATCHED_CLOSED_VA_EXPECTED_AMOUNT + message: Could not create invoice due to invoice amount is not + match with Closed VA expected amount." + schema: + $ref: '#/components/schemas/BadRequestError' + description: Bad request + "401": + content: + application/json: + examples: + Invalid API Key: + $ref: '#/components/examples/InvalidApiKeyExample' + value: null + schema: + $ref: '#/components/schemas/UnauthorizedError' + description: Unauthorized + "403": + content: + application/json: + examples: + Access Suspended: + $ref: '#/components/examples/AccessSuspendedErrorExample' + value: null + schema: + $ref: '#/components/schemas/ForbiddenError' + description: Forbidden + "404": + content: + application/json: + examples: + Callback Virtual Account Error: + value: + error_code: CALLBACK_VIRTUAL_ACCOUNT_NOT_FOUND_ERROR + message: Could not find callback virtual account + Unique Account Number Error: + value: + error_code: UNIQUE_ACCOUNT_NUMBER_UNAVAILABLE_ERROR + message: There is no available virtual account in your non-fixed + virtual account range + Payment Code Not Available: + value: + error_code: PAYMENT_CODE_NOT_AVAILABLE_ERROR + message: No more vacant space for convenience store code + schema: + $ref: '#/components/schemas/InvoiceNotFoundError' + description: Not found + security: + - {} + summary: Create an invoice + tags: + - invoice + /v2/invoices/{invoice_id}: + get: + operationId: getInvoiceById + parameters: + - description: Invoice ID + explode: false + in: path + name: invoice_id + required: true + schema: + example: 62efe4c33e45294d63f585f2 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Invoice' + description: OK + "401": + content: + application/json: + examples: + Invalid API Key: + $ref: '#/components/examples/InvalidApiKeyExample' + value: null + schema: + $ref: '#/components/schemas/UnauthorizedError' + description: Unauthorized + "404": + content: + application/json: + examples: + Invoice not found: + $ref: '#/components/examples/InvoiceNotFoundErrorExample' + value: null + schema: + $ref: '#/components/schemas/InvoiceError404ResponseDefinition' + description: Not found + "500": + content: + application/json: + examples: + Internal Server error: + $ref: '#/components/examples/ServerErrorExample' + value: null + schema: + $ref: '#/components/schemas/ServerError' + description: Internal server error + security: + - {} + summary: Get invoice by invoice id + tags: + - invoice + /v2/invoices: + get: + operationId: getInvoices + parameters: + - explode: true + in: query + name: external_id + required: false + schema: + example: test-external + type: string + style: form + - explode: true + in: query + name: statuses + required: false + schema: + example: + - PENDING + - SETTLED + items: + enum: + - PENDING + - PAID + - SETTLED + - EXPIRED + type: string + type: array + style: form + - explode: true + in: query + name: limit + required: false + schema: + example: 10 + type: number + style: form + - explode: true + in: query + name: created_after + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: created_before + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: paid_after + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: paid_before + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: expired_after + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: expired_before + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: last_invoice + required: false + schema: + example: 62efe4c33e45294d63f585f2 + type: string + style: form + - explode: true + in: query + name: client_types + required: false + schema: + example: + - API_GATEWAY + - DASHBOARD + items: + enum: + - API_GATEWAY + - DASHBOARD + - INTEGRATION + - ON_DEMAND + - RECURRING + - MOBILE + type: string + type: array + style: form + - explode: true + in: query + name: payment_channels + required: false + schema: + example: + - BNI + - BRI + items: + type: string + type: array + style: form + - explode: true + in: query + name: on_demand_link + required: false + schema: + example: test-link + type: string + style: form + - explode: true + in: query + name: recurring_payment_id + required: false + schema: + example: 62efe4c33e45294d63f585f2 + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Invoice' + type: array + description: OK + "401": + content: + application/json: + examples: + INVALID_API_KEY: + summary: INVALID_API_KEY + value: + error_code: INVALID_API_KEY + message: Your API key is invalid + schema: + $ref: '#/components/schemas/UnauthorizedError' + description: Unauthorized + "500": + content: + application/json: + examples: + Internal Server error: + $ref: '#/components/examples/ServerErrorExample' + value: null + schema: + $ref: '#/components/schemas/ServerError' + description: Internal server error + security: + - {} + summary: Get all Invoices + tags: + - invoice + /invoices/{invoice_id}/expire!: + post: + operationId: expireInvoice + parameters: + - description: Invoice ID to be expired + explode: false + in: path + name: invoice_id + required: true + schema: + example: 5f4708b7bd394b0400b96276 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + Successfully expire Invoice: + $ref: '#/components/examples/InvoiceExample' + value: null + schema: + $ref: '#/components/schemas/Invoice' + description: OK + "404": + content: + application/json: + examples: + Invoice not found: + $ref: '#/components/examples/InvoiceNotFoundErrorExample' + value: null + schema: + $ref: '#/components/schemas/InvoiceNotFoundError' + description: Not found + "500": + content: + application/json: + examples: + Internal Server error: + $ref: '#/components/examples/ServerErrorExample' + value: null + schema: + $ref: '#/components/schemas/ServerError' + description: Internal server error + security: + - {} + summary: Manually expire an invoice + tags: + - invoice +components: + examples: + InvoiceExample: + summary: Example of Invoice + value: + id: 64e44c42cf6ba3554184a337 + external_id: invoice-1692683329 + user_id: 5f4708b7bd394b0400b96276 + status: PENDING + merchant_name: Boxify + merchant_profile_picture_url: https://xnd-companies.s3.amazonaws.com/prod/1633484308963_880.jpg + amount: 1800000 + payer_email: customer@domain.com + description: "Invoice Demo #123" + expiry_date: 2023-08-22T07:48:50.150Z + invoice_url: https://checkout-staging.xendit.co/v2/64e44c42cf6ba3554184a337 + available_banks: + - bank_code: MANDIRI + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BRI + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BNI + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: PERMATA + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BCA + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BSI + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BJB + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: CIMB + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: SAHABAT_SAMPOERNA + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + - bank_code: BNC + collection_type: POOL + transfer_amount: 1800000 + bank_branch: Virtual Account + account_holder_name: BOXIFY + available_retail_outlets: + - retail_outlet_name: ALFAMART + - retail_outlet_name: INDOMARET + available_ewallets: + - ewallet_type: OVO + - ewallet_type: DANA + - ewallet_type: SHOPEEPAY + - ewallet_type: LINKAJA + - ewallet_type: ASTRAPAY + - ewallet_type: NEXCASH + - ewallet_type: JENIUSPAY + available_qr_codes: + - qr_code_type: QRIS + available_direct_debits: + - direct_debit_type: DD_BRI + - direct_debit_type: DD_BCA_KLIKPAY + - direct_debit_type: DD_MANDIRI + available_paylaters: + - paylater_type: KREDIVO + - paylater_type: UANGME + - paylater_type: AKULAKU + - paylater_type: ATOME + should_exclude_credit_card: false + should_send_email: false + created: 2023-08-22T05:48:51.105Z + updated: 2023-08-22T05:48:51.105Z + currency: IDR + reminder_date: 2023-08-22T06:48:50.150Z + customer_notification_preference: + invoice_created: + - email + invoice_paid: + - email + InvalidApiKeyExample: + summary: Example of Invalid API Key error + value: + error_code: INVALID_API_KEY + message: Your API key is invalid + AccessSuspendedErrorExample: + summary: Example of Access Suspended error + value: + error_code: ACCESS_SUSPENDED + message: "Access to API has been suspended temporarily due to indication of\ + \ fraudulent activities. If you believe this is inaccurate, kindly contact\ + \ our Customer Success for resolution." + InvoiceNotFoundErrorExample: + summary: Example of Invoice not found error + value: + error_code: INVOICE_NOT_FOUND_ERROR + message: Invoice not found. + ServerErrorExample: + summary: Example of Server Error + value: + error_code: INTERNAL_SERVER_ERROR + message: Something unxpected happened. + schemas: + UnauthorizedError: + description: An error object used to indicate unauthorized access to an invoice-related + resource. + properties: + error_code: + description: The specific error code associated with the unauthorized access. + enum: + - INVALID_API_KEY + type: string + message: + description: A human-readable error message providing additional context + about the unauthorized access. + type: string + required: + - error_code + - message + type: object + ForbiddenError: + description: An error object used to indicate a 403 Forbidden response related + to invoice operations. + properties: + error_code: + description: The specific error code indicating that access to the invoice + operation is suspended. + enum: + - ACCESS_SUSPENDED + type: string + message: + description: A human-readable error message providing additional context + about the 403 Forbidden response. + type: string + required: + - error_code + - message + type: object + InvoiceError404ResponseDefinition: + description: "An error object used to indicate that the requested resource,\ + \ in this case, an invoice, was not found." + properties: + error_code: + description: The specific error code indicating that the requested invoice + was not found. + enum: + - INVOICE_NOT_FOUND_ERROR + type: string + message: + description: A human-readable error message providing additional context + about the resource not being found. + type: string + required: + - error_code + - message + type: object + Datetime: + description: Representing a date and time in ISO 8601 format. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + NotificationChannel: + description: Representing a notification channel for sending messages. + enum: + - email + - sms + - whatsapp + - viber + type: string + InvoiceStatus: + description: Representing the status of an invoice. + enum: + - PENDING + - COMPLETING + - PAID + - SETTLED + - EXPIRED + - REMINDER + type: string + InvoiceCurrency: + description: Representing the currency used for an invoice. + enum: + - IDR + - USD + - PHP + type: string + InvoiceClientType: + description: Representing the client type or source of an invoice. + enum: + - DASHBOARD + - API_GATEWAY + - INTEGRATION + - ON_DEMAND + - RECURRING + - MOBILE + - STOREFRONT + type: string + InvoicePaymentMethod: + description: Representing the payment method used for an invoice. + enum: + - POOL + - CALLBACK_VIRTUAL_ACCOUNT + - CREDIT_CARD + - RETAIL_OUTLET + - QR_CODE + - QRIS + - EWALLET + - DIRECT_DEBIT + - BANK_TRANSFER + - PAYLATER + type: string + BankCode: + description: Representing the available bank channels used for invoice-related + transactions. + enum: + - BCA + - BNI + - BRI + - MANDIRI + - PERMATA + - BSI + - BJB + type: string + RetailOutletName: + description: Representing the available retail outlet channels used for invoice-related + transactions. + enum: + - ALFAMART + - INDOMARET + - 7ELEVEN + - CEBUANA + - DP_ECPAY_LOAN + - DP_MLHUILLIER + - DP_PALAWAN + - DP_ECPAY_SCHOOL + - LBC + type: string + EwalletType: + description: Representing the available eWallet channels used for invoice-related + transactions. + enum: + - OVO + - DANA + - LINKAJA + - PAYMAYA + - SHOPEEPAY + - GCASH + - GRABPAY + type: string + QrCodeType: + description: Representing the available QR Code channels used for invoice-related + transactions. + enum: + - QRIS + - PROMPTPAY + type: string + DirectDebitType: + description: Representing the available Direct Debit channels used for invoice-related + transactions. + enum: + - BA_BRI + - DC_BRI + - DD_BRI + - DD_MANDIRI + - BA_BPI + - DC_BPI + - DD_BPI + - BA_UBP + - DC_UBP + - DD_UBP + - BCA_KLIKPAY + - BA_BCA_KLIKPAY + - DC_BCA_KLIKPAY + - DD_BCA_KLIKPAY + type: string + PaylaterType: + description: Representing the available paylater channels used for invoice-related + transactions. + enum: + - KREDIVO + - AKULAKU + - UANGME + - BILLEASE + - CASHALO + - ATOME + type: string + AddressObject: + description: An object representing an address with various properties. + example: + country: country + province: province + city: city + street_line2: street_line2 + street_line1: street_line1 + state: state + postal_code: postal_code + properties: + country: + description: The country where the address is located. + nullable: true + type: string + street_line1: + description: The first line of the street address. + nullable: true + type: string + street_line2: + description: The second line of the street address. + nullable: true + type: string + city: + description: The city or locality within the address. + nullable: true + type: string + province: + description: The province or region within the country. + nullable: true + type: string + state: + description: The state or administrative division within the country. + nullable: true + type: string + postal_code: + description: The postal code or ZIP code for the address. + nullable: true + type: string + type: object + CustomerObject: + description: "An object representing a customer with various properties, including\ + \ addresses." + example: + addresses: + - country: country + province: province + city: city + street_line2: street_line2 + street_line1: street_line1 + state: state + postal_code: postal_code + - country: country + province: province + city: city + street_line2: street_line2 + street_line1: street_line1 + state: state + postal_code: postal_code + surname: surname + phone_number: phone_number + id: id + given_names: given_names + mobile_number: mobile_number + customer_id: customer_id + email: email + properties: + id: + description: The unique identifier for the customer. + nullable: true + type: string + phone_number: + description: The customer's phone number. + nullable: true + type: string + given_names: + description: The customer's given names or first names. + nullable: true + type: string + surname: + description: The customer's surname or last name. + nullable: true + type: string + email: + description: The customer's email address. + nullable: true + type: string + mobile_number: + description: The customer's mobile phone number. + nullable: true + type: string + customer_id: + description: An additional identifier for the customer. + nullable: true + type: string + addresses: + description: An array of addresses associated with the customer. + items: + $ref: '#/components/schemas/AddressObject' + nullable: true + type: array + type: object + NotificationPreference: + description: An object representing notification preferences for different invoice + events. + example: + invoice_expired: + - null + - null + invoice_paid: + - null + - null + invoice_reminder: + - null + - null + invoice_created: + - null + - null + properties: + invoice_created: + description: Notification channels for when an invoice is created. + items: + $ref: '#/components/schemas/NotificationChannel' + type: array + invoice_reminder: + description: Notification channels for invoice reminders. + items: + $ref: '#/components/schemas/NotificationChannel' + type: array + invoice_expired: + description: Notification channels for expired invoices. + items: + $ref: '#/components/schemas/NotificationChannel' + type: array + invoice_paid: + description: Notification channels for when an invoice is paid. + items: + $ref: '#/components/schemas/NotificationChannel' + type: array + type: object + Bank: + description: An object representing bank details for invoices. + example: + bank_code: null + bank_branch: bank_branch + bank_account_number: bank_account_number + transfer_amount: 6.027456183070403 + account_holder_name: account_holder_name + collection_type: collection_type + properties: + bank_code: + $ref: '#/components/schemas/BankCode' + collection_type: + description: The collection type for the bank details. + type: string + bank_branch: + description: The branch of the bank. + type: string + bank_account_number: + description: The bank account number. + type: string + account_holder_name: + description: The name of the account holder. + type: string + transfer_amount: + description: The transfer amount. + type: number + required: + - account_holder_name + - bank_code + - collection_type + type: object + RetailOutlet: + description: An object representing retail outlet details for invoices. + example: + retail_outlet_name: null + transfer_amount: 1.4658129805029452 + merchant_name: merchant_name + payment_code: payment_code + properties: + retail_outlet_name: + $ref: '#/components/schemas/RetailOutletName' + payment_code: + description: The payment code. + type: string + transfer_amount: + description: The transfer amount. + type: number + merchant_name: + description: The name of the merchant. + type: string + required: + - retail_outlet_name + type: object + Ewallet: + description: An object representing e-wallet details for invoices. + example: + ewallet_type: null + properties: + ewallet_type: + $ref: '#/components/schemas/EwalletType' + required: + - ewallet_type + type: object + QrCode: + description: An object representing QR code details for invoices. + example: + qr_code_type: null + properties: + qr_code_type: + $ref: '#/components/schemas/QrCodeType' + required: + - qr_code_type + type: object + DirectDebit: + description: An object representing direct debit details for invoices. + example: + direct_debit_type: null + properties: + direct_debit_type: + $ref: '#/components/schemas/DirectDebitType' + required: + - direct_debit_type + type: object + Paylater: + description: An object representing paylater details for invoices. + example: + paylater_type: null + should_exclude: true + properties: + paylater_type: + $ref: '#/components/schemas/PaylaterType' + should_exclude: + description: Indicates whether this paylater option should be excluded. + type: boolean + required: + - paylater_type + type: object + InvoiceItem: + description: An object representing an item within an invoice. + example: + quantity: 0.5637376656633328 + reference_id: reference_id + price: 5.962133916683182 + name: name + category: category + url: url + properties: + name: + description: The name of the item. + type: string + price: + description: The price of the item. + type: number + quantity: + description: The quantity of the item. Must be greater than or equal to + 0. + exclusiveMinimum: true + minimum: 0 + type: number + reference_id: + description: The reference ID of the item. + type: string + url: + description: The URL associated with the item. + type: string + category: + description: The category of the item. + type: string + required: + - name + - price + - quantity + type: object + InvoiceFee: + description: An object representing internal details for a fee associated with + an invoice. + example: + type: type + value: 2.3021358869347655 + properties: + type: + description: The type of fee. + type: string + value: + description: The value or amount of the fee. + type: number + required: + - type + - value + type: object + Invoice: + description: An object representing details for an invoice. + example: + is_high: true + available_paylaters: + - paylater_type: null + should_exclude: true + - paylater_type: null + should_exclude: true + fees: + - type: type + value: 2.3021358869347655 + - type: type + value: 2.3021358869347655 + payer_email: payer_email + reminder_date: 2016-08-29T09:12:33.001Z + description: description + external_id: external_id + client_type: null + locale: locale + should_send_email: true + customer_notification_preference: + invoice_expired: + - null + - null + invoice_paid: + - null + - null + invoice_reminder: + - null + - null + invoice_created: + - null + - null + currency: null + id: id + failure_redirect_url: failure_redirect_url + payment_method: null + amount: 0.8008281904610115 + available_banks: + - bank_code: null + bank_branch: bank_branch + bank_account_number: bank_account_number + transfer_amount: 6.027456183070403 + account_holder_name: account_holder_name + collection_type: collection_type + - bank_code: null + bank_branch: bank_branch + bank_account_number: bank_account_number + transfer_amount: 6.027456183070403 + account_holder_name: account_holder_name + collection_type: collection_type + available_ewallets: + - ewallet_type: null + - ewallet_type: null + available_retail_outlets: + - retail_outlet_name: null + transfer_amount: 1.4658129805029452 + merchant_name: merchant_name + payment_code: payment_code + - retail_outlet_name: null + transfer_amount: 1.4658129805029452 + merchant_name: merchant_name + payment_code: payment_code + created: 2016-08-29T09:12:33.001Z + expiry_date: 2016-08-29T09:12:33.001Z + merchant_name: merchant_name + available_qr_codes: + - qr_code_type: null + - qr_code_type: null + available_direct_debits: + - direct_debit_type: null + - direct_debit_type: null + merchant_profile_picture_url: merchant_profile_picture_url + should_authenticate_credit_card: true + user_id: user_id + success_redirect_url: success_redirect_url + should_exclude_credit_card: true + updated: 2016-08-29T09:12:33.001Z + items: + - quantity: 0.5637376656633328 + reference_id: reference_id + price: 5.962133916683182 + name: name + category: category + url: url + - quantity: 0.5637376656633328 + reference_id: reference_id + price: 5.962133916683182 + name: name + category: category + url: url + invoice_url: invoice_url + status: null + fixed_va: true + customer: + addresses: + - country: country + province: province + city: city + street_line2: street_line2 + street_line1: street_line1 + state: state + postal_code: postal_code + - country: country + province: province + city: city + street_line2: street_line2 + street_line1: street_line1 + state: state + postal_code: postal_code + surname: surname + phone_number: phone_number + id: id + given_names: given_names + mobile_number: mobile_number + customer_id: customer_id + email: email + properties: + id: + description: The unique identifier for the invoice. + type: string + external_id: + description: The external identifier for the invoice. + type: string + user_id: + description: The user ID associated with the invoice. + type: string + is_high: + description: Indicates if it's a high-value invoice. + type: boolean + payer_email: + description: The email address of the payer. + type: string + description: + description: A description of the invoice. + type: string + payment_method: + $ref: '#/components/schemas/InvoicePaymentMethod' + status: + $ref: '#/components/schemas/InvoiceStatus' + merchant_name: + description: The name of the merchant. + type: string + merchant_profile_picture_url: + description: The URL of the merchant's profile picture. + type: string + locale: + description: The locale or language used for the invoice. + type: string + amount: + description: The total amount of the invoice. + type: number + expiry_date: + description: Representing a date and time in ISO 8601 format. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + invoice_url: + description: The URL to view the invoice. + type: string + available_banks: + description: An array of available banks for payment. + items: + $ref: '#/components/schemas/Bank' + type: array + available_retail_outlets: + description: An array of available retail outlets for payment. + items: + $ref: '#/components/schemas/RetailOutlet' + type: array + available_ewallets: + description: An array of available e-wallets for payment. + items: + $ref: '#/components/schemas/Ewallet' + type: array + available_qr_codes: + description: An array of available QR codes for payment. + items: + $ref: '#/components/schemas/QrCode' + type: array + available_direct_debits: + description: An array of available direct debit options for payment. + items: + $ref: '#/components/schemas/DirectDebit' + type: array + available_paylaters: + description: An array of available pay-later options for payment. + items: + $ref: '#/components/schemas/Paylater' + type: array + should_exclude_credit_card: + description: Indicates whether credit card payments should be excluded. + type: boolean + should_send_email: + description: Indicates whether email notifications should be sent. + type: boolean + client_type: + $ref: '#/components/schemas/InvoiceClientType' + created: + description: Representing a date and time in ISO 8601 format. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + updated: + description: Representing a date and time in ISO 8601 format. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + success_redirect_url: + description: The URL to redirect to on successful payment. + type: string + failure_redirect_url: + description: The URL to redirect to on payment failure. + type: string + should_authenticate_credit_card: + description: Indicates whether credit card authentication is required. + type: boolean + currency: + $ref: '#/components/schemas/InvoiceCurrency' + items: + description: An array of items included in the invoice. + items: + $ref: '#/components/schemas/InvoiceItem' + type: array + fixed_va: + description: Indicates whether the virtual account is fixed. + type: boolean + reminder_date: + description: Representing a date and time in ISO 8601 format. + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + customer: + $ref: '#/components/schemas/CustomerObject' + customer_notification_preference: + $ref: '#/components/schemas/NotificationPreference' + fees: + description: An array of fees associated with the invoice. + items: + $ref: '#/components/schemas/InvoiceFee' + type: array + required: + - amount + - available_banks + - available_direct_debits + - available_ewallets + - available_paylaters + - available_qr_codes + - available_retail_outlets + - client_type + - created + - expiry_date + - external_id + - invoice_url + - is_high + - merchant_name + - merchant_profile_picture_url + - should_send_email + - status + - status_updated + - updated + - user_id + type: object + CreateInvoiceRequest: + description: An object representing for an invoice creation request. + example: + external_id: invoice-external-id-1 + amount: 10000 + description: Payment for PSN subscription + client_type: API_GATEWAY + properties: + external_id: + description: The external ID of the invoice. + type: string + amount: + description: The invoice amount. + type: number + payer_email: + description: The email address of the payer. + type: string + description: + description: A description of the payment. + type: string + client_type: + description: The client type (internal use). + type: string + invoice_duration: + description: The duration of the invoice. + type: string + callback_virtual_account_id: + description: The ID of the callback virtual account. + type: string + should_send_email: + description: Indicates whether email notifications should be sent. + type: boolean + customer: + $ref: '#/components/schemas/CustomerObject' + customer_notification_preference: + $ref: '#/components/schemas/NotificationPreference' + success_redirect_url: + description: The URL to redirect to on successful payment. + type: string + failure_redirect_url: + description: The URL to redirect to on payment failure. + type: string + payment_methods: + description: An array of available payment methods. + items: + type: string + type: array + mid_label: + description: The middle label. + type: string + should_authenticate_credit_card: + description: Indicates whether credit card authentication is required. + type: boolean + currency: + description: The currency of the invoice. + type: string + reminder_time: + description: The reminder time. + type: number + local: + description: The local. + type: string + reminder_time_unit: + description: The unit of the reminder time. + type: string + items: + description: An array of items included in the invoice. + items: + $ref: '#/components/schemas/InvoiceItem' + type: array + fees: + description: An array of fees associated with the invoice. + items: + $ref: '#/components/schemas/InvoiceFee' + type: array + required: + - amount + - external_id + type: object + BadRequestError: + description: Response definition for a 400 Bad Request error when creating an + invoice. + properties: + error_code: + description: The error code indicating the type of error that occurred. + enum: + - MAXIMUM_TRANSFER_AMOUNT_ERROR + - NO_COLLECTION_METHODS_ERROR + - EMAIL_FORMAT_ERROR + - UNAVAILABLE_PAYMENT_METHOD_ERROR + - UNSUPPORTED_CURRENCY + - MISMATCH_CURRENCY_ERROR + - INVALID_REMINDER_TIME + type: string + message: + description: A human-readable error message that provides additional information + about the error. + type: string + required: + - error_code + - message + type: object + InvoiceNotFoundError: + description: Response definition for a 404 Not Found error when creating an + invoice. + properties: + error_code: + description: The error code indicating the type of error that occurred. + enum: + - CALLBACK_VIRTUAL_ACCOUNT_NOT_FOUND_ERROR + - UNIQUE_ACCOUNT_NUMBER_UNAVAILABLE_ERROR + - PAYMENT_CODE_NOT_AVAILABLE_ERROR + type: string + message: + description: A human-readable error message that provides additional information + about the error. + type: string + required: + - error_code + - message + type: object + ServerError: + properties: + error_code: + enum: + - SERVER_ERROR + type: string + message: + type: string + required: + - error_code + - message + type: object + securitySchemes: + ApiKeyAuth: + in: header + name: x-api-key + type: apiKey diff --git a/docs/Invoice/AddressObject.md b/docs/Invoice/AddressObject.md new file mode 100644 index 0000000..aaf25f9 --- /dev/null +++ b/docs/Invoice/AddressObject.md @@ -0,0 +1,20 @@ +# # AddressObject + + +```php +use Xendit\Invoice\AddressObject; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**country** | **string** | The country where the address is located. | null | [optional] +**street_line1** | **string** | The first line of the street address. | null | [optional] +**street_line2** | **string** | The second line of the street address. | null | [optional] +**city** | **string** | The city or locality within the address. | null | [optional] +**province** | **string** | The province or region within the country. | null | [optional] +**state** | **string** | The state or administrative division within the country. | null | [optional] +**postal_code** | **string** | The postal code or ZIP code for the address. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/BadRequestError.md b/docs/Invoice/BadRequestError.md new file mode 100644 index 0000000..06a5319 --- /dev/null +++ b/docs/Invoice/BadRequestError.md @@ -0,0 +1,15 @@ +# # BadRequestError + + +```php +use Xendit\Invoice\BadRequestError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | The error code indicating the type of error that occurred. | null | +**message** | **string** | A human-readable error message that provides additional information about the error. | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/Bank.md b/docs/Invoice/Bank.md new file mode 100644 index 0000000..23c43d2 --- /dev/null +++ b/docs/Invoice/Bank.md @@ -0,0 +1,19 @@ +# # Bank + + +```php +use Xendit\Invoice\Bank; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**bank_code** | [**BankCode**](BankCode.md) | | null | +**collection_type** | **string** | The collection type for the bank details. | null | +**bank_branch** | **string** | The branch of the bank. | null | [optional] +**bank_account_number** | **string** | The bank account number. | null | [optional] +**account_holder_name** | **string** | The name of the account holder. | null | +**transfer_amount** | **float** | The transfer amount. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/BankCode.md b/docs/Invoice/BankCode.md new file mode 100644 index 0000000..fc72db4 --- /dev/null +++ b/docs/Invoice/BankCode.md @@ -0,0 +1,13 @@ +# # BankCode + + +```php +use Xendit\Invoice\BankCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/CreateInvoiceRequest.md b/docs/Invoice/CreateInvoiceRequest.md new file mode 100644 index 0000000..a2b0cd4 --- /dev/null +++ b/docs/Invoice/CreateInvoiceRequest.md @@ -0,0 +1,34 @@ +# # CreateInvoiceRequest + + +```php +use Xendit\Invoice\CreateInvoiceRequest; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**external_id** | **string** | The external ID of the invoice. | null | +**amount** | **float** | The invoice amount. | null | +**payer_email** | **string** | The email address of the payer. | null | [optional] +**description** | **string** | A description of the payment. | null | [optional] +**client_type** | **string** | The client type (internal use). | null | [optional] +**invoice_duration** | **string** | The duration of the invoice. | null | [optional] +**callback_virtual_account_id** | **string** | The ID of the callback virtual account. | null | [optional] +**should_send_email** | **bool** | Indicates whether email notifications should be sent. | null | [optional] +**customer** | [**CustomerObject**](CustomerObject.md) | | null | [optional] +**customer_notification_preference** | [**NotificationPreference**](NotificationPreference.md) | | null | [optional] +**success_redirect_url** | **string** | The URL to redirect to on successful payment. | null | [optional] +**failure_redirect_url** | **string** | The URL to redirect to on payment failure. | null | [optional] +**payment_methods** | **string[]** | An array of available payment methods. | null | [optional] +**mid_label** | **string** | The middle label. | null | [optional] +**should_authenticate_credit_card** | **bool** | Indicates whether credit card authentication is required. | null | [optional] +**currency** | **string** | The currency of the invoice. | null | [optional] +**reminder_time** | **float** | The reminder time. | null | [optional] +**local** | **string** | The local. | null | [optional] +**reminder_time_unit** | **string** | The unit of the reminder time. | null | [optional] +**items** | [**array**](InvoiceItem.md) | An array of items included in the invoice. | null | [optional] +**fees** | [**array**](InvoiceFee.md) | An array of fees associated with the invoice. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/CustomerObject.md b/docs/Invoice/CustomerObject.md new file mode 100644 index 0000000..c698d6b --- /dev/null +++ b/docs/Invoice/CustomerObject.md @@ -0,0 +1,21 @@ +# # CustomerObject + + +```php +use Xendit\Invoice\CustomerObject; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier for the customer. | null | [optional] +**phone_number** | **string** | The customer's phone number. | null | [optional] +**given_names** | **string** | The customer's given names or first names. | null | [optional] +**surname** | **string** | The customer's surname or last name. | null | [optional] +**email** | **string** | The customer's email address. | null | [optional] +**mobile_number** | **string** | The customer's mobile phone number. | null | [optional] +**customer_id** | **string** | An additional identifier for the customer. | null | [optional] +**addresses** | [**array**](AddressObject.md) | An array of addresses associated with the customer. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/DirectDebit.md b/docs/Invoice/DirectDebit.md new file mode 100644 index 0000000..531249a --- /dev/null +++ b/docs/Invoice/DirectDebit.md @@ -0,0 +1,14 @@ +# # DirectDebit + + +```php +use Xendit\Invoice\DirectDebit; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**direct_debit_type** | [**DirectDebitType**](DirectDebitType.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/DirectDebitType.md b/docs/Invoice/DirectDebitType.md new file mode 100644 index 0000000..75ca4e6 --- /dev/null +++ b/docs/Invoice/DirectDebitType.md @@ -0,0 +1,13 @@ +# # DirectDebitType + + +```php +use Xendit\Invoice\DirectDebitType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/Ewallet.md b/docs/Invoice/Ewallet.md new file mode 100644 index 0000000..1c29ef4 --- /dev/null +++ b/docs/Invoice/Ewallet.md @@ -0,0 +1,14 @@ +# # Ewallet + + +```php +use Xendit\Invoice\Ewallet; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**ewallet_type** | [**EwalletType**](EwalletType.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/EwalletType.md b/docs/Invoice/EwalletType.md new file mode 100644 index 0000000..a83f003 --- /dev/null +++ b/docs/Invoice/EwalletType.md @@ -0,0 +1,13 @@ +# # EwalletType + + +```php +use Xendit\Invoice\EwalletType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/ForbiddenError.md b/docs/Invoice/ForbiddenError.md new file mode 100644 index 0000000..9c28310 --- /dev/null +++ b/docs/Invoice/ForbiddenError.md @@ -0,0 +1,15 @@ +# # ForbiddenError + + +```php +use Xendit\Invoice\ForbiddenError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | The specific error code indicating that access to the invoice operation is suspended. | null | +**message** | **string** | A human-readable error message providing additional context about the 403 Forbidden response. | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/Invoice.md b/docs/Invoice/Invoice.md new file mode 100644 index 0000000..61e0822 --- /dev/null +++ b/docs/Invoice/Invoice.md @@ -0,0 +1,48 @@ +# # Invoice + + +```php +use Xendit\Invoice\Invoice; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier for the invoice. | null | [optional] +**external_id** | **string** | The external identifier for the invoice. | null | +**user_id** | **string** | The user ID associated with the invoice. | null | +**is_high** | **bool** | Indicates if it's a high-value invoice. | null | +**payer_email** | **string** | The email address of the payer. | null | [optional] +**description** | **string** | A description of the invoice. | null | [optional] +**payment_method** | [**InvoicePaymentMethod**](InvoicePaymentMethod.md) | | null | [optional] +**status** | [**InvoiceStatus**](InvoiceStatus.md) | | null | +**merchant_name** | **string** | The name of the merchant. | null | +**merchant_profile_picture_url** | **string** | The URL of the merchant's profile picture. | null | +**locale** | **string** | The locale or language used for the invoice. | null | [optional] +**amount** | **float** | The total amount of the invoice. | null | +**expiry_date** | **\DateTime** | Representing a date and time in ISO 8601 format. | 2016-08-29T09:12:33.001Z | +**invoice_url** | **string** | The URL to view the invoice. | null | +**available_banks** | [**array**](Bank.md) | An array of available banks for payment. | null | +**available_retail_outlets** | [**array**](RetailOutlet.md) | An array of available retail outlets for payment. | null | +**available_ewallets** | [**array**](Ewallet.md) | An array of available e-wallets for payment. | null | +**available_qr_codes** | [**array**](QrCode.md) | An array of available QR codes for payment. | null | +**available_direct_debits** | [**array**](DirectDebit.md) | An array of available direct debit options for payment. | null | +**available_paylaters** | [**array**](Paylater.md) | An array of available pay-later options for payment. | null | +**should_exclude_credit_card** | **bool** | Indicates whether credit card payments should be excluded. | null | [optional] +**should_send_email** | **bool** | Indicates whether email notifications should be sent. | null | +**client_type** | [**InvoiceClientType**](InvoiceClientType.md) | | null | +**created** | **\DateTime** | Representing a date and time in ISO 8601 format. | 2016-08-29T09:12:33.001Z | +**updated** | **\DateTime** | Representing a date and time in ISO 8601 format. | 2016-08-29T09:12:33.001Z | +**success_redirect_url** | **string** | The URL to redirect to on successful payment. | null | [optional] +**failure_redirect_url** | **string** | The URL to redirect to on payment failure. | null | [optional] +**should_authenticate_credit_card** | **bool** | Indicates whether credit card authentication is required. | null | [optional] +**currency** | [**InvoiceCurrency**](InvoiceCurrency.md) | | null | [optional] +**items** | [**array**](InvoiceItem.md) | An array of items included in the invoice. | null | [optional] +**fixed_va** | **bool** | Indicates whether the virtual account is fixed. | null | [optional] +**reminder_date** | **\DateTime** | Representing a date and time in ISO 8601 format. | 2016-08-29T09:12:33.001Z | [optional] +**customer** | [**CustomerObject**](CustomerObject.md) | | null | [optional] +**customer_notification_preference** | [**NotificationPreference**](NotificationPreference.md) | | null | [optional] +**fees** | [**array**](InvoiceFee.md) | An array of fees associated with the invoice. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceApi.md b/docs/Invoice/InvoiceApi.md new file mode 100644 index 0000000..8fb0f3f --- /dev/null +++ b/docs/Invoice/InvoiceApi.md @@ -0,0 +1,241 @@ +# Xendit\InvoiceApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createInvoice()**](InvoiceApi.md#createInvoice) | **POST** /v2/invoices/ | Create an invoice | +| [**expireInvoice()**](InvoiceApi.md#expireInvoice) | **POST** /invoices/{invoice_id}/expire! | Manually expire an invoice | +| [**getInvoiceById()**](InvoiceApi.md#getInvoiceById) | **GET** /v2/invoices/{invoice_id} | Get invoice by invoice id | +| [**getInvoices()**](InvoiceApi.md#getInvoices) | **GET** /v2/invoices | Get all Invoices | + + +## `createInvoice()` + +```php +createInvoice($create_invoice_request): \Invoice\Invoice +``` + +Create an invoice + +### Example + +```php +createInvoice($create_invoice_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InvoiceApi->createInvoice: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **create_invoice_request** | [**CreateInvoiceRequest**](CreateInvoiceRequest.md)| | | + +### Return type + +[**\Xendit\Invoice\Invoice**](Invoice.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `expireInvoice()` + +```php +expireInvoice($invoice_id): \Invoice\Invoice +``` + +Manually expire an invoice + +### Example + +```php +expireInvoice($invoice_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InvoiceApi->expireInvoice: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **invoice_id** | **string**| Invoice ID to be expired | | + +### Return type + +[**\Xendit\Invoice\Invoice**](Invoice.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getInvoiceById()` + +```php +getInvoiceById($invoice_id): \Invoice\Invoice +``` + +Get invoice by invoice id + +### Example + +```php +getInvoiceById($invoice_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InvoiceApi->getInvoiceById: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **invoice_id** | **string**| Invoice ID | | + +### Return type + +[**\Xendit\Invoice\Invoice**](Invoice.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getInvoices()` + +```php +getInvoices($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id): \Invoice\Invoice[] +``` + +Get all Invoices + +### Example + +```php +getInvoices($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InvoiceApi->getInvoices: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **external_id** | **string**| | [optional] | +| **statuses** | **string[]**| | [optional] | +| **limit** | **float**| | [optional] | +| **created_after** | **\DateTime**| | [optional] | +| **created_before** | **\DateTime**| | [optional] | +| **paid_after** | **\DateTime**| | [optional] | +| **paid_before** | **\DateTime**| | [optional] | +| **expired_after** | **\DateTime**| | [optional] | +| **expired_before** | **\DateTime**| | [optional] | +| **last_invoice** | **string**| | [optional] | +| **client_types** | **string[]**| | [optional] | +| **payment_channels** | **string[]**| | [optional] | +| **on_demand_link** | **string**| | [optional] | +| **recurring_payment_id** | **string**| | [optional] | + +### Return type + +[**\Xendit\Invoice\Invoice[]**](Invoice.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceClientType.md b/docs/Invoice/InvoiceClientType.md new file mode 100644 index 0000000..b8e86b2 --- /dev/null +++ b/docs/Invoice/InvoiceClientType.md @@ -0,0 +1,13 @@ +# # InvoiceClientType + + +```php +use Xendit\Invoice\InvoiceClientType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceCurrency.md b/docs/Invoice/InvoiceCurrency.md new file mode 100644 index 0000000..192b372 --- /dev/null +++ b/docs/Invoice/InvoiceCurrency.md @@ -0,0 +1,13 @@ +# # InvoiceCurrency + + +```php +use Xendit\Invoice\InvoiceCurrency; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceError404ResponseDefinition.md b/docs/Invoice/InvoiceError404ResponseDefinition.md new file mode 100644 index 0000000..74bfcfe --- /dev/null +++ b/docs/Invoice/InvoiceError404ResponseDefinition.md @@ -0,0 +1,15 @@ +# # InvoiceError404ResponseDefinition + + +```php +use Xendit\Invoice\InvoiceError404ResponseDefinition; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | The specific error code indicating that the requested invoice was not found. | null | +**message** | **string** | A human-readable error message providing additional context about the resource not being found. | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceFee.md b/docs/Invoice/InvoiceFee.md new file mode 100644 index 0000000..608dcef --- /dev/null +++ b/docs/Invoice/InvoiceFee.md @@ -0,0 +1,15 @@ +# # InvoiceFee + + +```php +use Xendit\Invoice\InvoiceFee; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | **string** | The type of fee. | null | +**value** | **float** | The value or amount of the fee. | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceItem.md b/docs/Invoice/InvoiceItem.md new file mode 100644 index 0000000..f267728 --- /dev/null +++ b/docs/Invoice/InvoiceItem.md @@ -0,0 +1,19 @@ +# # InvoiceItem + + +```php +use Xendit\Invoice\InvoiceItem; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**name** | **string** | The name of the item. | null | +**price** | **float** | The price of the item. | null | +**quantity** | **float** | The quantity of the item. Must be greater than or equal to 0. | null | +**reference_id** | **string** | The reference ID of the item. | null | [optional] +**url** | **string** | The URL associated with the item. | null | [optional] +**category** | **string** | The category of the item. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceNotFoundError.md b/docs/Invoice/InvoiceNotFoundError.md new file mode 100644 index 0000000..5d7410b --- /dev/null +++ b/docs/Invoice/InvoiceNotFoundError.md @@ -0,0 +1,15 @@ +# # InvoiceNotFoundError + + +```php +use Xendit\Invoice\InvoiceNotFoundError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | The error code indicating the type of error that occurred. | null | +**message** | **string** | A human-readable error message that provides additional information about the error. | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoicePaymentMethod.md b/docs/Invoice/InvoicePaymentMethod.md new file mode 100644 index 0000000..6562fad --- /dev/null +++ b/docs/Invoice/InvoicePaymentMethod.md @@ -0,0 +1,13 @@ +# # InvoicePaymentMethod + + +```php +use Xendit\Invoice\InvoicePaymentMethod; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/InvoiceStatus.md b/docs/Invoice/InvoiceStatus.md new file mode 100644 index 0000000..c0ad780 --- /dev/null +++ b/docs/Invoice/InvoiceStatus.md @@ -0,0 +1,13 @@ +# # InvoiceStatus + + +```php +use Xendit\Invoice\InvoiceStatus; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/NotificationChannel.md b/docs/Invoice/NotificationChannel.md new file mode 100644 index 0000000..8a0891d --- /dev/null +++ b/docs/Invoice/NotificationChannel.md @@ -0,0 +1,13 @@ +# # NotificationChannel + + +```php +use Xendit\Invoice\NotificationChannel; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/NotificationPreference.md b/docs/Invoice/NotificationPreference.md new file mode 100644 index 0000000..3c8faf5 --- /dev/null +++ b/docs/Invoice/NotificationPreference.md @@ -0,0 +1,17 @@ +# # NotificationPreference + + +```php +use Xendit\Invoice\NotificationPreference; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**invoice_created** | [**array**](NotificationChannel.md) | Notification channels for when an invoice is created. | null | [optional] +**invoice_reminder** | [**array**](NotificationChannel.md) | Notification channels for invoice reminders. | null | [optional] +**invoice_expired** | [**array**](NotificationChannel.md) | Notification channels for expired invoices. | null | [optional] +**invoice_paid** | [**array**](NotificationChannel.md) | Notification channels for when an invoice is paid. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/Paylater.md b/docs/Invoice/Paylater.md new file mode 100644 index 0000000..8e3c907 --- /dev/null +++ b/docs/Invoice/Paylater.md @@ -0,0 +1,15 @@ +# # Paylater + + +```php +use Xendit\Invoice\Paylater; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**paylater_type** | [**PaylaterType**](PaylaterType.md) | | null | +**should_exclude** | **bool** | Indicates whether this paylater option should be excluded. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/PaylaterType.md b/docs/Invoice/PaylaterType.md new file mode 100644 index 0000000..374d35f --- /dev/null +++ b/docs/Invoice/PaylaterType.md @@ -0,0 +1,13 @@ +# # PaylaterType + + +```php +use Xendit\Invoice\PaylaterType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/QrCode.md b/docs/Invoice/QrCode.md new file mode 100644 index 0000000..b34e898 --- /dev/null +++ b/docs/Invoice/QrCode.md @@ -0,0 +1,14 @@ +# # QrCode + + +```php +use Xendit\Invoice\QrCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**qr_code_type** | [**QrCodeType**](QrCodeType.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/QrCodeType.md b/docs/Invoice/QrCodeType.md new file mode 100644 index 0000000..9b68142 --- /dev/null +++ b/docs/Invoice/QrCodeType.md @@ -0,0 +1,13 @@ +# # QrCodeType + + +```php +use Xendit\Invoice\QrCodeType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/RetailOutlet.md b/docs/Invoice/RetailOutlet.md new file mode 100644 index 0000000..6ca8d89 --- /dev/null +++ b/docs/Invoice/RetailOutlet.md @@ -0,0 +1,17 @@ +# # RetailOutlet + + +```php +use Xendit\Invoice\RetailOutlet; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**retail_outlet_name** | [**RetailOutletName**](RetailOutletName.md) | | null | +**payment_code** | **string** | The payment code. | null | [optional] +**transfer_amount** | **float** | The transfer amount. | null | [optional] +**merchant_name** | **string** | The name of the merchant. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/RetailOutletName.md b/docs/Invoice/RetailOutletName.md new file mode 100644 index 0000000..6bbeced --- /dev/null +++ b/docs/Invoice/RetailOutletName.md @@ -0,0 +1,13 @@ +# # RetailOutletName + + +```php +use Xendit\Invoice\RetailOutletName; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/ServerError.md b/docs/Invoice/ServerError.md new file mode 100644 index 0000000..80b7318 --- /dev/null +++ b/docs/Invoice/ServerError.md @@ -0,0 +1,15 @@ +# # ServerError + + +```php +use Xendit\Invoice\ServerError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | +**message** | **string** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/Invoice/UnauthorizedError.md b/docs/Invoice/UnauthorizedError.md new file mode 100644 index 0000000..e72604e --- /dev/null +++ b/docs/Invoice/UnauthorizedError.md @@ -0,0 +1,15 @@ +# # UnauthorizedError + + +```php +use Xendit\Invoice\UnauthorizedError; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | The specific error code associated with the unauthorized access. | null | +**message** | **string** | A human-readable error message providing additional context about the unauthorized access. | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod.yaml b/docs/PaymentMethod.yaml new file mode 100644 index 0000000..cceb6dd --- /dev/null +++ b/docs/PaymentMethod.yaml @@ -0,0 +1,2367 @@ +openapi: 3.0.0 +info: + description: This API is used for Payment Method Service v2 + title: Payment Method Service v2 + version: 2.86.1 +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /v2/payment_methods: + get: + description: Get all payment methods by filters + operationId: getAllPaymentMethods + parameters: + - explode: true + in: query + name: id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: type + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: status + required: false + schema: + items: + $ref: '#/components/schemas/PaymentMethodStatus' + type: array + style: form + - explode: true + in: query + name: reusability + required: false + schema: + $ref: '#/components/schemas/PaymentMethodReusability' + style: form + - explode: true + in: query + name: customer_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: reference_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: after_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: before_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethodList' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Get all payment methods by filters + tags: + - payment_method + post: + description: This endpoint initiates creation of payment method + operationId: createPaymentMethod + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethodParameters' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethod' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_409_response' + description: Request causes conflict + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Creates payment method + tags: + - payment_method + /v2/payment_methods/{paymentMethodId}: + get: + description: Get payment method by ID + operationId: getPaymentMethodByID + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethod' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Get payment method by ID + tags: + - payment_method + patch: + description: This endpoint is used to toggle the ```status``` of an e-Wallet + or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This + is also used to update the details of an Over-the-Counter or a Virtual Account + payment method. + operationId: patchPaymentMethod + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethodUpdateParameters' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethod' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Patch payment methods + tags: + - payment_method + /v2/payment_methods/{paymentMethodId}/expire: + post: + description: This endpoint expires a payment method and performs unlinking if + necessary + operationId: expirePaymentMethod + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethodExpireParameters' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethod' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Expires a payment method + tags: + - payment_method + /v2/payment_methods/{paymentMethodId}/auth: + post: + description: This endpoint validates a payment method linking OTP + operationId: authPaymentMethod + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethodAuthParameters' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentMethod' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_409_response' + description: Request causes conflict + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Validate a payment method's linking OTP + tags: + - payment_method + /v2/payment_methods/{paymentMethodId}/payments: + get: + description: Returns payments with matching PaymentMethodID. + operationId: getPaymentsByPaymentMethodId + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + - explode: true + in: query + name: payment_request_id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: payment_method_id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: reference_id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: payment_method_type + required: false + schema: + items: + $ref: '#/components/schemas/PaymentMethodType' + type: array + style: form + - explode: true + in: query + name: channel_code + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: status + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: currency + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: "created[gte]" + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: "created[lte]" + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: "updated[gte]" + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: "updated[lte]" + required: false + schema: + $ref: '#/components/schemas/Datetime' + style: form + - explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: after_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: before_id + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + type: object + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Returns payments with matching PaymentMethodID. + tags: + - payment_method + /v2/payment_methods/channels: + get: + description: Get all payment channels + operationId: getAllPaymentChannels + parameters: + - explode: true + in: query + name: is_activated + required: false + schema: + default: true + enum: + - true + - false + type: boolean + style: form + - explode: true + in: query + name: type + required: false + schema: + example: DIRECT_DEBIT + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentChannelList' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Get all payment channels + tags: + - payment_method + /v2/payment_methods/{paymentMethodId}/payments/simulate: + post: + description: Makes payment with matching PaymentMethodID. + operationId: simulatePayment + parameters: + - explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/simulatePayment_request' + responses: + "200": + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + summary: Makes payment with matching PaymentMethodID. + tags: + - payment_method +components: + parameters: + PaymentMethodID: + explode: false + in: path + name: paymentMethodId + required: true + schema: + example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + responses: + InternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_default_response' + description: Internal server error + StatusBadRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_400_response' + description: Bad request + StatusForbidden: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_403_response' + description: Forbidden due to permissions + StatusNotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllPaymentMethods_404_response' + description: Data not found + StatusConflict: + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_409_response' + description: Request causes conflict + StatusServiceUnavailable: + content: + application/json: + schema: + $ref: '#/components/schemas/createPaymentMethod_503_response' + description: Service is unavailable due to dependencies + schemas: + PaymentMethodStatus: + enum: + - ACTIVE + - EXPIRED + - INACTIVE + - PENDING + - REQUIRES_ACTION + - FAILED + type: string + PaymentMethodReusability: + enum: + - MULTIPLE_USE + - ONE_TIME_USE + type: string + PaymentMethodType: + enum: + - CARD + - CRYPTOCURRENCY + - DIRECT_BANK_TRANSFER + - DIRECT_DEBIT + - EWALLET + - OVER_THE_COUNTER + - QR_CODE + - VIRTUAL_ACCOUNT + type: string + PaymentMethodCountry: + enum: + - PH + - ID + - VN + - TH + - MY + type: string + PaymentMethodAction: + example: + method: method + url_type: url_type + action: action + url: url + properties: + action: + type: string + method: + type: string + url: + type: string + url_type: + type: string + type: object + Object: + nullable: true + type: object + BillingInformation: + description: Billing Information + example: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + nullable: true + properties: + country: + maxLength: 2 + type: string + street_line1: + maxLength: 255 + nullable: true + type: string + street_line2: + maxLength: 255 + nullable: true + type: string + city: + maxLength: 255 + nullable: true + type: string + province_state: + maxLength: 255 + nullable: true + type: string + postal_code: + maxLength: 255 + nullable: true + type: string + required: + - country + type: object + Datetime: + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + EWalletChannelCode: + description: EWallet Channel Code + enum: + - GCASH + - GRABPAY + - PAYMAYA + - OVO + - DANA + - LINKAJA + - SHOPEEPAY + - SAKUKU + - NEXCASH + - ASTRAPAY + - JENIUSPAY + - APPOTA + - MOMO + - VNPTWALLET + - VIETTELPAY + - ZALOPAY + example: PAYMAYA + type: string + EWalletChannelProperties: + description: EWallet Channel Properties + example: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + nullable: false + properties: + success_return_url: + description: URL where the end-customer is redirected if the authorization + is successful + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + failure_return_url: + description: URL where the end-customer is redirected if the authorization + failed + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + cancel_return_url: + description: URL where the end-customer is redirected if the authorization + cancelled + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + mobile_number: + description: Mobile number of customer in E.164 format (e.g. +628123123123). + For OVO one time payment use only. + example: +628123123123 + type: string + redeem_points: + description: "REDEEM_NONE will not use any point, REDEEM_ALL will use all\ + \ available points before cash balance is used. For OVO and ShopeePay\ + \ tokenized payment use only." + example: REDEEM_NONE + type: string + cashtag: + description: Available for JENIUSPAY only + example: $abc1234 + pattern: "^[$][a-zA-Z0-9_]{3,15}$" + type: string + type: object + EWalletAccount: + description: EWallet Account Properties + example: + name: John Peter Doe + account_details: +63(2)123456XXXX + balance: null + point_balance: null + nullable: false + properties: + name: + description: Name of the eWallet account holder. The value is null if unavailableName + of the eWallet account holder. The value is null if unavailable + nullable: true + type: string + account_details: + description: Identifier from eWallet provider e.g. phone number. The value + is null if unavailable + nullable: true + type: string + balance: + description: The main balance amount on eWallet account provided from eWallet + provider. The value is null if unavailable + format: double + nullable: true + type: number + point_balance: + description: The point balance amount on eWallet account. Applicable only + on some eWallet provider that has point system. The value is null if unavailabl + format: double + nullable: true + type: number + type: object + EWalletParameters: + example: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + channel_code: PAYMAYA + account: + name: John Peter Doe + account_details: +63(2)123456XXXX + balance: null + point_balance: null + properties: + channel_code: + $ref: '#/components/schemas/EWalletChannelCode' + channel_properties: + $ref: '#/components/schemas/EWalletChannelProperties' + account: + $ref: '#/components/schemas/EWalletAccount' + required: + - channel_code + type: object + EWallet: + allOf: + - $ref: '#/components/schemas/EWalletParameters' + description: Ewallet Payment Method Details + nullable: true + type: object + DirectDebitChannelCode: + description: Direct Debit Channel Code + enum: + - BCA_KLIKPAY + - BCA_ONEKLIK + - BDO + - BPI + - BRI + - BNI + - CHINABANK + - CIMBNIAGA + - MTB + - RCBC + - UBP + - MANDIRI + - BBL + - SCB + - KTB + - BAY + - KBANK_MB + - BAY_MB + - KTB_MB + - BBL_MB + - SCB_MB + - BDO_EPAY + - AUTODEBIT_UBP + - AFFIN_FPX + - AGRO_FPX + - ALLIANCE_FPX + - AMBANK_FPX + - ISLAM_FPX + - MUAMALAT_FPX + - BOC_FPX + - RAKYAT_FPX + - BSN_FPX + - CIMB_FPX + - HLB_FPX + - HSBC_FPX + - KFH_FPX + - MAYB2E_FPX + - MAYB2U_FPX + - OCBC_FPX + - PUBLIC_FPX + - RHB_FPX + - SCH_FPX + - UOB_FPX + - AFFIN_FPX_BUSINESS + - AGRO_FPX_BUSINESS + - ALLIANCE_FPX_BUSINESS + - AMBANK_FPX_BUSINESS + - ISLAM_FPX_BUSINESS + - MUAMALAT_FPX_BUSINESS + - BNP_FPX_BUSINESS + - CIMB_FPX_BUSINESS + - CITIBANK_FPX_BUSINESS + - DEUTSCHE_FPX_BUSINESS + - HLB_FPX_BUSINESS + - HSBC_FPX_BUSINESS + - RAKYAT_FPX_BUSINESS + - KFH_FPX_BUSINESS + - MAYB2E_FPX_BUSINESS + - OCBC_FPX_BUSINESS + - PUBLIC_FPX_BUSINESS + - RHB_FPX_BUSINESS + - SCH_FPX_BUSINESS + - UOB_FPX_BUSINESS + example: BRI + type: string + DirectDebitChannelProperties: + description: Direct Debit Channel Properties + example: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + nullable: true + properties: + success_return_url: + format: uri + type: string + failure_return_url: + format: uri + nullable: true + type: string + mobile_number: + description: Mobile number of the customer registered to the partner channel + example: +62818555988 + nullable: true + type: string + card_last_four: + description: Last four digits of the debit card + example: "8888" + nullable: true + type: string + card_expiry: + description: Expiry month and year of the debit card (in MM/YY format) + example: 06/24 + nullable: true + type: string + email: + description: Email address of the customer that is registered to the partner + channel + example: test.email@xendit.co + nullable: true + type: string + identity_document_number: + description: Identity number of the customer registered to the partner channel + example: "1234567891113" + nullable: true + type: string + require_auth: + nullable: true + type: boolean + type: object + DirectDebitParameters: + example: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + channel_code: BRI + properties: + channel_code: + $ref: '#/components/schemas/DirectDebitChannelCode' + channel_properties: + $ref: '#/components/schemas/DirectDebitChannelProperties' + required: + - channel_code + - channel_properties + type: object + DirectDebitType: + enum: + - DEBIT_CARD + - BANK_ACCOUNT + - BANK_REDIRECT + type: string + DirectDebitBankAccount: + nullable: true + properties: + masked_bank_account_number: + example: 233eca40ff303ba15bf39052ca3102c6 + nullable: true + type: string + bank_account_hash: + example: 233eca40ff303ba15bf39052ca3102c6 + nullable: true + type: string + mobile_number: + description: Mobile number of the customer registered to the partner channel + example: +62818555988 + nullable: true + type: string + identity_document_number: + description: Identity number of the customer registered to the partner channel + example: "1234567891113" + nullable: true + type: string + type: object + DirectDebitDebitCard: + nullable: true + properties: + mobile_number: + description: Mobile number of the customer registered to the partner channel + example: +62818555988 + nullable: true + type: string + card_last_four: + description: Last four digits of the debit card + example: "8888" + nullable: true + type: string + card_expiry: + description: Expiry month and year of the debit card (in MM/YY format) + example: 06/24 + nullable: true + type: string + email: + description: Email address of the customer that is registered to the partner + channel + example: test.email@xendit.co + nullable: true + type: string + type: object + DirectDebit: + allOf: + - $ref: '#/components/schemas/DirectDebitParameters' + - $ref: '#/components/schemas/DirectDebit_allOf' + description: Direct Debit Payment Method Details + nullable: true + type: object + OverTheCounterChannelCode: + description: Over The Counter Channel Code + enum: + - 7ELEVEN + - 7ELEVEN_CLIQQ + - CEBUANA + - ECPAY + - PALAWAN + - MLHUILLIER + - ECPAY_DRAGONLOAN + - LBC + - ECPAY_SCHOOL + - RD_PAWNSHOP + - CVM + - USSC + - SM_BILLS + - ROBINSONS_BILLS + - ALFAMART + - INDOMARET + example: 7ELEVEN_CLIQQ + type: string + OverTheCounterChannelProperties: + description: Over The Counter Channel Properties + example: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + nullable: false + properties: + payment_code: + description: "The payment code that you want to assign, e.g 12345. If you\ + \ do not send one, one will be picked at random." + example: "12345" + type: string + customer_name: + description: Name of customer. + example: Rika Sutanto + type: string + expires_at: + description: The time when the payment code will be expired. The minimum + is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date + will be 2 days from payment code generated. + example: 2022-01-01T00:00:00Z + format: date-time + type: string + required: + - customer_name + type: object + OverTheCounterParameters: + example: + amount: 0.8008281904610115 + currency: currency + channel_properties: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + channel_code: 7ELEVEN_CLIQQ + properties: + amount: + format: double + nullable: true + type: number + currency: + type: string + channel_code: + $ref: '#/components/schemas/OverTheCounterChannelCode' + channel_properties: + $ref: '#/components/schemas/OverTheCounterChannelProperties' + required: + - channel_code + - channel_properties + type: object + OverTheCounter: + allOf: + - $ref: '#/components/schemas/OverTheCounterParameters' + description: Over The Counter Payment Method Details + nullable: true + type: object + CardChannelProperties: + description: Card Channel Properties + example: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + nullable: true + properties: + skip_three_d_secure: + description: This field value is only being used for reusability = MULTIPLE_USE. + To indicate whether to perform 3DS during the linking phase. Defaults + to false. + example: false + nullable: true + type: boolean + success_return_url: + description: URL where the end-customer is redirected if the authorization + is successful + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + nullable: true + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + failure_return_url: + description: URL where the end-customer is redirected if the authorization + failed + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + nullable: true + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + cardonfile_type: + description: Type of “credential-on-file” / “card-on-file” payment being + made. Indicate that this payment uses a previously linked Payment Method + for charging. + enum: + - MERCHANT_UNSCHEDULED + - CUSTOMER_UNSCHEDULED + - RECURRING + example: RECURRING + nullable: true + type: string + type: object + TokenizedCardInformation: + description: Tokenized Card Information + example: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: network + nullable: false + properties: + token_id: + type: string + masked_card_number: + description: 1st 6 and last 4 digits of the card + type: string + cardholder_name: + description: Cardholder name is optional but recommended for 3DS 2 / AVS + verification + nullable: true + type: string + expiry_month: + description: Card expiry month in MM format + type: string + expiry_year: + description: Card expiry month in YY format + type: string + fingerprint: + description: "Xendit-generated identifier for the unique card number. Multiple\ + \ payment method objects can be created for the same account - e.g. if\ + \ the user first creates a one-time payment request, and then later on\ + \ creates a multiple-use payment method using the same account. The\ + \ fingerprint helps to identify the unique account being used." + type: string + type: + description: Whether the card is a credit or debit card + type: string + network: + description: "Card network - VISA, MASTERCARD, JCB, AMEX, DISCOVER, BCA" + type: string + country: + description: Country where the card was issued ISO 3166-1 Alpha-2 + type: string + issuer: + description: "Issuer of the card, most often an issuing bank For example,\ + \ “BCA”, “MANDIRI”" + type: string + required: + - country + - expiry_month + - expiry_year + - fingerprint + - issuer + - masked_card_number + - network + - token_id + - type + type: object + CardVerificationResultsThreeDSecure: + example: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + three_d_secure_flow: + enum: + - CHALLENGE + - FRICTIONLESS + nullable: true + type: string + eci_code: + nullable: true + type: string + three_d_secure_result: + nullable: true + type: string + three_d_secure_result_reason: + nullable: true + type: string + three_d_secure_version: + nullable: true + type: string + type: object + CardVerificationResults: + example: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + three_d_secure: + $ref: '#/components/schemas/CardVerificationResultsThreeDSecure' + cvv_result: + nullable: true + type: string + address_verification_result: + nullable: true + type: string + required: + - three_d_secure + type: object + Card: + description: Card Payment Method Details + example: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: network + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + currency: + nullable: true + type: string + channel_properties: + $ref: '#/components/schemas/CardChannelProperties' + card_information: + $ref: '#/components/schemas/TokenizedCardInformation' + card_verification_results: + $ref: '#/components/schemas/CardVerificationResults' + required: + - channel_properties + - currency + type: object + QRCodeChannelCode: + description: QR Code Channel Code + enum: + - QRIS + - DANA + - RCBC + - PROMPTPAY + - LINKAJA + example: QRIS + nullable: true + type: string + QRCodeChannelProperties: + description: QR Code Channel Properties + example: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52 045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + nullable: true + properties: + qr_string: + description: "QR string to be rendered for display to end users. QR string\ + \ to image rendering are commonly available in software libraries (e.g\ + \ Nodejs, PHP, Java)" + example: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52 045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + type: string + expires_at: + example: 2022-01-01T00:00:00Z + format: date-time + type: string + type: object + QRCodeParameters: + example: + amount: 5.637376656633329 + currency: currency + channel_properties: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52 045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + channel_code: QRIS + properties: + amount: + format: double + nullable: true + type: number + currency: + type: string + channel_code: + $ref: '#/components/schemas/QRCodeChannelCode' + channel_properties: + $ref: '#/components/schemas/QRCodeChannelProperties' + type: object + QRCode: + allOf: + - $ref: '#/components/schemas/QRCodeParameters' + description: QR Code Payment Method Details + nullable: true + type: object + VirtualAccountChannelCode: + description: Virtual Account Channel Code + enum: + - BCA + - BJB + - BNI + - BRI + - MANDIRI + - PERMATA + - BSI + - CIMB + - SAHABAT_SAMPOERNA + - ARTAJASA + - PV + - VIETCAPITAL + - WOORI + - MSB + example: BCA + type: string + VirtualAccountChannelProperties: + description: Virtual Account Channel Properties + example: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + nullable: false + properties: + customer_name: + description: Name of customer. + example: Rika Sutanto + type: string + virtual_account_number: + description: "You can assign specific Virtual Account number using this\ + \ parameter. If you do not send one, one will be picked at random. Make\ + \ sure the number you specify is within your Virtual Account range." + example: "262159999999999" + type: string + expires_at: + description: "The date and time in ISO 8601 UTC+0 when the virtual account\ + \ number will be expired. Default: The default expiration date will be\ + \ 31 years from creation date." + example: 2022-01-01T00:00:00Z + format: date-time + type: string + suggested_amount: + description: "The suggested amount you want to assign. Note: Suggested amounts\ + \ is the amounts that can see as a suggestion, but user can still put\ + \ any numbers (only supported for Mandiri and BRI)" + example: 100000 + format: double + type: number + type: object + VirtualAccountParameters: + example: + amount: 6.027456183070403 + min_amount: 1.1465812980502945 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 1.5962133916683183 + currency: currency + channel_properties: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + channel_code: BCA + properties: + amount: + format: double + nullable: true + type: number + min_amount: + format: double + minimum: 1 + nullable: true + type: number + max_amount: + format: double + minimum: 1 + nullable: true + type: number + currency: + type: string + channel_code: + $ref: '#/components/schemas/VirtualAccountChannelCode' + channel_properties: + $ref: '#/components/schemas/VirtualAccountChannelProperties' + alternative_display_types: + description: "For payments in Vietnam only, alternative display requested\ + \ for the virtual account" + items: + enum: + - QR_STRING + type: string + type: array + required: + - channel_code + - channel_properties + type: object + VirtualAccountAlternativeDisplay: + description: Alternative Display Object + properties: + type: + description: Type of the alternative display + enum: + - QR_STRING + readOnly: true + type: string + data: + description: Data payload of the given alternative display + type: string + type: object + VirtualAccount: + allOf: + - $ref: '#/components/schemas/VirtualAccountParameters' + - $ref: '#/components/schemas/VirtualAccount_allOf' + description: Virtual Account Payment Method Details + nullable: true + type: object + PaymentMethod: + example: + billing_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + country: null + metadata: "{}" + failure_code: failure_code + reference_id: reference_id + created: 2016-08-29T09:12:33.001Z + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + customer_id: customer_id + business_id: business_id + actions: + - method: method + url_type: url_type + action: action + url: url + - method: method + url_type: url_type + action: action + url: url + updated: 2016-08-29T09:12:33.001Z + card: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: network + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + customer: "{}" + status: null + nullable: false + properties: + id: + type: string + business_id: + type: string + type: + $ref: '#/components/schemas/PaymentMethodType' + country: + $ref: '#/components/schemas/PaymentMethodCountry' + customer_id: + nullable: true + type: string + customer: + nullable: true + type: object + reference_id: + type: string + description: + nullable: true + type: string + status: + $ref: '#/components/schemas/PaymentMethodStatus' + reusability: + $ref: '#/components/schemas/PaymentMethodReusability' + actions: + items: + $ref: '#/components/schemas/PaymentMethodAction' + type: array + metadata: + nullable: true + type: object + billing_information: + $ref: '#/components/schemas/BillingInformation' + failure_code: + nullable: true + type: string + created: + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + updated: + example: 2016-08-29T09:12:33.001Z + format: date-time + type: string + ewallet: + $ref: '#/components/schemas/EWallet' + direct_debit: + $ref: '#/components/schemas/DirectDebit' + over_the_counter: + $ref: '#/components/schemas/OverTheCounter' + card: + $ref: '#/components/schemas/Card' + qr_code: + $ref: '#/components/schemas/QRCode' + virtual_account: + $ref: '#/components/schemas/VirtualAccount' + required: + - id + type: object + PaymentMethodList: + example: + data: + - billing_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + country: null + metadata: "{}" + failure_code: failure_code + reference_id: reference_id + created: 2016-08-29T09:12:33.001Z + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + customer_id: customer_id + business_id: business_id + actions: + - method: method + url_type: url_type + action: action + url: url + - method: method + url_type: url_type + action: action + url: url + updated: 2016-08-29T09:12:33.001Z + card: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: network + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + customer: "{}" + status: null + - billing_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + country: null + metadata: "{}" + failure_code: failure_code + reference_id: reference_id + created: 2016-08-29T09:12:33.001Z + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + customer_id: customer_id + business_id: business_id + actions: + - method: method + url_type: url_type + action: action + url: url + - method: method + url_type: url_type + action: action + url: url + updated: 2016-08-29T09:12:33.001Z + card: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: network + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + customer: "{}" + status: null + has_more: true + nullable: false + properties: + data: + items: + $ref: '#/components/schemas/PaymentMethod' + type: array + has_more: + type: boolean + required: + - data + type: object + CardParameters: + example: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + cvv: cvv + card_number: card_number + cardholder_name: cardholder_name + expiry_year: expiry_year + properties: + currency: + type: string + channel_properties: + $ref: '#/components/schemas/CardChannelProperties' + card_information: + $ref: '#/components/schemas/CardParameters_card_information' + required: + - currency + type: object + PaymentMethodParameters: + example: + billing_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + country: country + metadata: "{}" + reference_id: reference_id + over_the_counter: + amount: 0.8008281904610115 + currency: currency + channel_properties: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + channel_code: 7ELEVEN_CLIQQ + reusability: null + description: description + type: null + direct_debit: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + channel_code: BRI + ewallet: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + channel_code: PAYMAYA + account: + name: John Peter Doe + account_details: +63(2)123456XXXX + balance: null + point_balance: null + virtual_account: + amount: 6.027456183070403 + min_amount: 1.1465812980502945 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 1.5962133916683183 + currency: currency + channel_properties: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + channel_code: BCA + qr_code: + amount: 5.637376656633329 + currency: currency + channel_properties: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52 045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + channel_code: QRIS + customer_id: customer_id + card: + currency: currency + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + cvv: cvv + card_number: card_number + cardholder_name: cardholder_name + expiry_year: expiry_year + nullable: false + properties: + type: + $ref: '#/components/schemas/PaymentMethodType' + country: + nullable: true + type: string + reusability: + $ref: '#/components/schemas/PaymentMethodReusability' + customer_id: + nullable: true + type: string + reference_id: + type: string + description: + nullable: true + type: string + card: + $ref: '#/components/schemas/CardParameters' + direct_debit: + $ref: '#/components/schemas/DirectDebitParameters' + ewallet: + $ref: '#/components/schemas/EWalletParameters' + over_the_counter: + $ref: '#/components/schemas/OverTheCounterParameters' + virtual_account: + $ref: '#/components/schemas/VirtualAccountParameters' + qr_code: + $ref: '#/components/schemas/QRCodeParameters' + metadata: + nullable: true + type: object + billing_information: + $ref: '#/components/schemas/BillingInformation' + required: + - reusability + - type + type: object + OverTheCounterChannelPropertiesUpdate: + description: Over The Counter Channel properties that can be updated + example: + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + nullable: false + properties: + customer_name: + description: Name of customer. + example: Rika Sutanto + type: string + expires_at: + description: The time when the payment code will be expired. The minimum + is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date + will be 2 days from payment code generated. + example: 2022-01-01T00:00:00Z + format: date-time + type: string + type: object + OverTheCounterUpdateParameters: + example: + amount: 0.8008281904610115 + channel_properties: + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + properties: + amount: + format: double + nullable: true + type: number + channel_properties: + $ref: '#/components/schemas/OverTheCounterChannelPropertiesUpdate' + type: object + VirtualAccountChannelPropertiesPatch: + description: Virtual Account Channel Properties + example: + expires_at: 2022-01-01T00:00:00Z + suggested_amount: 100000 + nullable: false + properties: + expires_at: + description: "The date and time in ISO 8601 UTC+0 when the virtual account\ + \ number will be expired. Default: The default expiration date will be\ + \ 31 years from creation date." + example: 2022-01-01T00:00:00Z + format: date-time + type: string + suggested_amount: + description: "The suggested amount you want to assign. Note: Suggested amounts\ + \ is the amounts that can see as a suggestion, but user can still put\ + \ any numbers (only supported for Mandiri and BRI)" + example: 100000 + format: double + minimum: 1 + type: number + type: object + VirtualAccountUpdateParameters: + example: + amount: 6.027456183070403 + min_amount: 1.1465812980502945 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 1.5962133916683183 + channel_properties: + expires_at: 2022-01-01T00:00:00Z + suggested_amount: 100000 + properties: + amount: + format: double + nullable: true + type: number + min_amount: + format: double + minimum: 1 + nullable: true + type: number + max_amount: + format: double + minimum: 1 + nullable: true + type: number + channel_properties: + $ref: '#/components/schemas/VirtualAccountChannelPropertiesPatch' + alternative_display_types: + description: "For payments in Vietnam only, alternative display requested\ + \ for the virtual account" + items: + enum: + - QR_STRING + type: string + type: array + type: object + PaymentMethodUpdateParameters: + example: + reference_id: reference_id + over_the_counter: + amount: 0.8008281904610115 + channel_properties: + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + virtual_account: + amount: 6.027456183070403 + min_amount: 1.1465812980502945 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 1.5962133916683183 + channel_properties: + expires_at: 2022-01-01T00:00:00Z + suggested_amount: 100000 + description: description + reusability: null + status: null + properties: + description: + type: string + reference_id: + type: string + reusability: + $ref: '#/components/schemas/PaymentMethodReusability' + status: + $ref: '#/components/schemas/PaymentMethodStatus' + over_the_counter: + $ref: '#/components/schemas/OverTheCounterUpdateParameters' + virtual_account: + $ref: '#/components/schemas/VirtualAccountUpdateParameters' + type: object + PaymentMethodExpireParameters: + example: + failure_return_url: failure_return_url + success_return_url: success_return_url + nullable: true + properties: + success_return_url: + description: URL where the end customer is redirected if the unlinking authorization + is successful. + nullable: true + type: string + failure_return_url: + description: URL where the end customer is redirected if the unlinking authorization + is failed. + nullable: true + type: string + type: object + PaymentMethodAuthParameters: + example: + auth_code: auth_code + nullable: false + properties: + auth_code: + maxLength: 6 + minLength: 6 + type: string + required: + - auth_code + type: object + ChannelProperty: + allOf: + - $ref: '#/components/schemas/ChannelProperty_allOf' + ChannelAmountLimits: + allOf: + - $ref: '#/components/schemas/ChannelAmountLimits_allOf' + PaymentChannel: + allOf: + - $ref: '#/components/schemas/PaymentChannel_allOf' + PaymentChannelList: + example: + data: + - null + - null + links: + - null + - null + has_more: true + properties: + data: + description: Array of resources that match the provided filters + items: + $ref: '#/components/schemas/PaymentChannel' + type: array + links: + description: Array of objects that can be used to assist on navigating through + the data + items: + $ref: '#/components/schemas/PaymentChannelList_links_inner' + type: array + has_more: + description: Indicates whether there are more items in the list + type: boolean + type: object + getAllPaymentMethods_400_response: + properties: + error_code: + enum: + - API_VALIDATION_ERROR + - NOT_SUPPORTED_BY_CHANNEL + - EXPIRED_OTP_ERROR + - INVALID_ACCOUNT_DETAILS + - INVALID_OTP_ERROR + - INVALID_PAYMENT_METHOD + - MAX_OTP_ATTEMPTS_ERROR + - CUSTOMER_NOT_FOUND_ERROR + - ACCOUNT_ACCESS_BLOCKED + - MAX_ACCOUNT_LINKING + - INACTIVE_PAYMENT_METHOD + - PAYMENT_METHOD_NOT_SUPPORTED + - INCORRECT_AMOUNT + - DUPLICATED_FIXED_PAYMENT_INSTRUMENT + type: string + message: + example: An internal server error occurred + type: string + type: object + getAllPaymentMethods_403_response: + properties: + error_code: + enum: + - UNAUTHORIZED + - CHANNEL_NOT_ACTIVATED + type: string + message: + example: An internal server error occurred + type: string + type: object + getAllPaymentMethods_404_response: + properties: + error_code: + enum: + - DATA_NOT_FOUND + type: string + message: + example: An internal server error occurred + type: string + type: object + getAllPaymentMethods_default_response: + properties: + error_code: + type: string + message: + example: An internal server error occurred + type: string + type: object + createPaymentMethod_409_response: + properties: + error_code: + enum: + - PAYMENT_METHOD_ALREADY_ACTIVE + - PAYMENT_METHOD_ALREADY_FAILED + - DUPLICATE_ERROR + - IDEMPOTENCY_ERROR + type: string + message: + example: An internal server error occurred + type: string + type: object + createPaymentMethod_503_response: + properties: + error_code: + enum: + - CHANNEL_UNAVAILABLE + - OTP_DELIVERY_ERROR + type: string + message: + example: An internal server error occurred + type: string + type: object + simulatePayment_request: + properties: + amount: + format: double + nullable: false + type: number + type: object + DirectDebit_allOf: + properties: + type: + $ref: '#/components/schemas/DirectDebitType' + bank_account: + $ref: '#/components/schemas/DirectDebitBankAccount' + debit_card: + $ref: '#/components/schemas/DirectDebitDebitCard' + required: + - type + type: object + example: null + VirtualAccount_allOf: + properties: + alternative_displays: + items: + $ref: '#/components/schemas/VirtualAccountAlternativeDisplay' + type: array + type: object + example: null + CardParameters_card_information: + description: Card Information + example: + expiry_month: expiry_month + cvv: cvv + card_number: card_number + cardholder_name: cardholder_name + expiry_year: expiry_year + nullable: false + properties: + card_number: + type: string + expiry_month: + description: Card expiry month in MM format + type: string + expiry_year: + description: Card expiry month in YY format + type: string + cardholder_name: + description: Cardholder name + nullable: true + type: string + cvv: + nullable: true + type: string + required: + - card_number + - expiry_month + - expiry_year + type: object + ChannelProperty_allOf: + description: Objects that enumerate the parameters needed as `channel_properties` + when creating a Payment Method + properties: + name: + description: The corresponding parameter name + type: string + type: + description: Data type of the parameter + type: string + is_required: + description: Indicates whether or not the parameter is required + type: boolean + type: object + example: null + ChannelAmountLimits_allOf: + description: Contains objects of the support currencies and its respective limits + per transaction + properties: + currency: + description: Currency supported by the payment channel + type: string + min_limit: + description: The minimum allowed transaction amount for the payment channel + type: number + max_limit: + description: The minimum allowed transaction amount for the payment channel + type: number + type: object + example: null + PaymentChannel_allOf: + properties: + channel_code: + description: The specific Xendit code used to identify the partner channel + example: BPI + type: string + type: + description: The payment method type + example: DIRECT_DEBIT + type: string + country: + description: The country where the channel operates in ISO 3166-2 country + code + example: PH + type: string + channel_name: + description: Official parter name of the payment channel + example: Bank of the Philippine Islands + type: string + channel_properties: + items: + $ref: '#/components/schemas/ChannelProperty' + type: array + logo_url: + description: "If available, this contains a URL to the logo of the partner\ + \ channel" + type: string + amount_limits: + items: + $ref: '#/components/schemas/ChannelAmountLimits' + type: array + type: object + example: null + PaymentChannelList_links_inner_allOf: + properties: + href: + description: Target URI that should contain a target to Internationalized + Resource Identifiers (IRI) + example: /v2/payment_methods/channels?is_activated=true + type: string + rel: + description: The link relation type described how the current context (source) + is related to target resource + enum: + - first + - last + - next + - prev + example: next + type: string + method: + description: The HTTP method to be used to call `href` + example: GET + type: string + type: object + PaymentChannelList_links_inner: + allOf: + - $ref: '#/components/schemas/PaymentChannelList_links_inner_allOf' diff --git a/docs/PaymentMethod/BillingInformation.md b/docs/PaymentMethod/BillingInformation.md new file mode 100644 index 0000000..6b96d19 --- /dev/null +++ b/docs/PaymentMethod/BillingInformation.md @@ -0,0 +1,19 @@ +# # BillingInformation + + +```php +use Xendit\PaymentMethod\BillingInformation; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**country** | **string** | | null | +**street_line1** | **string** | | null | [optional] +**street_line2** | **string** | | null | [optional] +**city** | **string** | | null | [optional] +**province_state** | **string** | | null | [optional] +**postal_code** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/Card.md b/docs/PaymentMethod/Card.md new file mode 100644 index 0000000..94c8bfe --- /dev/null +++ b/docs/PaymentMethod/Card.md @@ -0,0 +1,17 @@ +# # Card + + +```php +use Xendit\PaymentMethod\Card; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**currency** | **string** | | null | +**channel_properties** | [**CardChannelProperties**](CardChannelProperties.md) | | null | +**card_information** | [**TokenizedCardInformation**](TokenizedCardInformation.md) | | null | [optional] +**card_verification_results** | [**CardVerificationResults**](CardVerificationResults.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CardChannelProperties.md b/docs/PaymentMethod/CardChannelProperties.md new file mode 100644 index 0000000..9c92362 --- /dev/null +++ b/docs/PaymentMethod/CardChannelProperties.md @@ -0,0 +1,17 @@ +# # CardChannelProperties + + +```php +use Xendit\PaymentMethod\CardChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**skip_three_d_secure** | **bool** | This field value is only being used for reusability = MULTIPLE_USE. To indicate whether to perform 3DS during the linking phase. Defaults to false. | false | [optional] +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cardonfile_type** | **string** | Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. | RECURRING | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CardParameters.md b/docs/PaymentMethod/CardParameters.md new file mode 100644 index 0000000..33d68cf --- /dev/null +++ b/docs/PaymentMethod/CardParameters.md @@ -0,0 +1,16 @@ +# # CardParameters + + +```php +use Xendit\PaymentMethod\CardParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**currency** | **string** | | null | +**channel_properties** | [**CardChannelProperties**](CardChannelProperties.md) | | null | [optional] +**card_information** | [**CardParametersCardInformation**](CardParametersCardInformation.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CardParametersCardInformation.md b/docs/PaymentMethod/CardParametersCardInformation.md new file mode 100644 index 0000000..c2c295a --- /dev/null +++ b/docs/PaymentMethod/CardParametersCardInformation.md @@ -0,0 +1,18 @@ +# # CardParametersCardInformation + + +```php +use Xendit\PaymentMethod\CardParametersCardInformation; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**card_number** | **string** | | null | +**expiry_month** | **string** | Card expiry month in MM format | null | +**expiry_year** | **string** | Card expiry month in YY format | null | +**cardholder_name** | **string** | Cardholder name | null | [optional] +**cvv** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CardVerificationResults.md b/docs/PaymentMethod/CardVerificationResults.md new file mode 100644 index 0000000..14aefa5 --- /dev/null +++ b/docs/PaymentMethod/CardVerificationResults.md @@ -0,0 +1,16 @@ +# # CardVerificationResults + + +```php +use Xendit\PaymentMethod\CardVerificationResults; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure** | [**CardVerificationResultsThreeDSecure**](CardVerificationResultsThreeDSecure.md) | | null | +**cvv_result** | **string** | | null | [optional] +**address_verification_result** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CardVerificationResultsThreeDSecure.md b/docs/PaymentMethod/CardVerificationResultsThreeDSecure.md new file mode 100644 index 0000000..d30d0f8 --- /dev/null +++ b/docs/PaymentMethod/CardVerificationResultsThreeDSecure.md @@ -0,0 +1,18 @@ +# # CardVerificationResultsThreeDSecure + + +```php +use Xendit\PaymentMethod\CardVerificationResultsThreeDSecure; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure_flow** | **string** | | null | [optional] +**eci_code** | **string** | | null | [optional] +**three_d_secure_result** | **string** | | null | [optional] +**three_d_secure_result_reason** | **string** | | null | [optional] +**three_d_secure_version** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/ChannelAmountLimits.md b/docs/PaymentMethod/ChannelAmountLimits.md new file mode 100644 index 0000000..ff9bb09 --- /dev/null +++ b/docs/PaymentMethod/ChannelAmountLimits.md @@ -0,0 +1,16 @@ +# # ChannelAmountLimits + + +```php +use Xendit\PaymentMethod\ChannelAmountLimits; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**currency** | **string** | Currency supported by the payment channel | null | [optional] +**min_limit** | **float** | The minimum allowed transaction amount for the payment channel | null | [optional] +**max_limit** | **float** | The minimum allowed transaction amount for the payment channel | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/ChannelAmountLimitsAllOf.md b/docs/PaymentMethod/ChannelAmountLimitsAllOf.md new file mode 100644 index 0000000..ca8e6b3 --- /dev/null +++ b/docs/PaymentMethod/ChannelAmountLimitsAllOf.md @@ -0,0 +1,16 @@ +# # ChannelAmountLimitsAllOf + + +```php +use Xendit\PaymentMethod\ChannelAmountLimitsAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**currency** | **string** | Currency supported by the payment channel | null | [optional] +**min_limit** | **float** | The minimum allowed transaction amount for the payment channel | null | [optional] +**max_limit** | **float** | The minimum allowed transaction amount for the payment channel | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/ChannelProperty.md b/docs/PaymentMethod/ChannelProperty.md new file mode 100644 index 0000000..310a001 --- /dev/null +++ b/docs/PaymentMethod/ChannelProperty.md @@ -0,0 +1,16 @@ +# # ChannelProperty + + +```php +use Xendit\PaymentMethod\ChannelProperty; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**name** | **string** | The corresponding parameter name | null | [optional] +**type** | **string** | Data type of the parameter | null | [optional] +**is_required** | **bool** | Indicates whether or not the parameter is required | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/ChannelPropertyAllOf.md b/docs/PaymentMethod/ChannelPropertyAllOf.md new file mode 100644 index 0000000..f2bd555 --- /dev/null +++ b/docs/PaymentMethod/ChannelPropertyAllOf.md @@ -0,0 +1,16 @@ +# # ChannelPropertyAllOf + + +```php +use Xendit\PaymentMethod\ChannelPropertyAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**name** | **string** | The corresponding parameter name | null | [optional] +**type** | **string** | Data type of the parameter | null | [optional] +**is_required** | **bool** | Indicates whether or not the parameter is required | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CreatePaymentMethod409Response.md b/docs/PaymentMethod/CreatePaymentMethod409Response.md new file mode 100644 index 0000000..89589b6 --- /dev/null +++ b/docs/PaymentMethod/CreatePaymentMethod409Response.md @@ -0,0 +1,15 @@ +# # CreatePaymentMethod409Response + + +```php +use Xendit\PaymentMethod\CreatePaymentMethod409Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/CreatePaymentMethod503Response.md b/docs/PaymentMethod/CreatePaymentMethod503Response.md new file mode 100644 index 0000000..845e9e2 --- /dev/null +++ b/docs/PaymentMethod/CreatePaymentMethod503Response.md @@ -0,0 +1,15 @@ +# # CreatePaymentMethod503Response + + +```php +use Xendit\PaymentMethod\CreatePaymentMethod503Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebit.md b/docs/PaymentMethod/DirectDebit.md new file mode 100644 index 0000000..e5e3e26 --- /dev/null +++ b/docs/PaymentMethod/DirectDebit.md @@ -0,0 +1,18 @@ +# # DirectDebit + + +```php +use Xendit\PaymentMethod\DirectDebit; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**DirectDebitChannelCode**](DirectDebitChannelCode.md) | | null | +**channel_properties** | [**DirectDebitChannelProperties**](DirectDebitChannelProperties.md) | | null | +**type** | [**DirectDebitType**](DirectDebitType.md) | | null | +**bank_account** | [**DirectDebitBankAccount**](DirectDebitBankAccount.md) | | null | [optional] +**debit_card** | [**DirectDebitDebitCard**](DirectDebitDebitCard.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitAllOf.md b/docs/PaymentMethod/DirectDebitAllOf.md new file mode 100644 index 0000000..706eaaa --- /dev/null +++ b/docs/PaymentMethod/DirectDebitAllOf.md @@ -0,0 +1,16 @@ +# # DirectDebitAllOf + + +```php +use Xendit\PaymentMethod\DirectDebitAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | [**DirectDebitType**](DirectDebitType.md) | | null | +**bank_account** | [**DirectDebitBankAccount**](DirectDebitBankAccount.md) | | null | [optional] +**debit_card** | [**DirectDebitDebitCard**](DirectDebitDebitCard.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitBankAccount.md b/docs/PaymentMethod/DirectDebitBankAccount.md new file mode 100644 index 0000000..1f2283f --- /dev/null +++ b/docs/PaymentMethod/DirectDebitBankAccount.md @@ -0,0 +1,17 @@ +# # DirectDebitBankAccount + + +```php +use Xendit\PaymentMethod\DirectDebitBankAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**masked_bank_account_number** | **string** | | 233eca40ff303ba15bf39052ca3102c6 | [optional] +**bank_account_hash** | **string** | | 233eca40ff303ba15bf39052ca3102c6 | [optional] +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**identity_document_number** | **string** | Identity number of the customer registered to the partner channel | 1234567891113 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitChannelCode.md b/docs/PaymentMethod/DirectDebitChannelCode.md new file mode 100644 index 0000000..004eaba --- /dev/null +++ b/docs/PaymentMethod/DirectDebitChannelCode.md @@ -0,0 +1,13 @@ +# # DirectDebitChannelCode + + +```php +use Xendit\PaymentMethod\DirectDebitChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitChannelProperties.md b/docs/PaymentMethod/DirectDebitChannelProperties.md new file mode 100644 index 0000000..ed3761c --- /dev/null +++ b/docs/PaymentMethod/DirectDebitChannelProperties.md @@ -0,0 +1,21 @@ +# # DirectDebitChannelProperties + + +```php +use Xendit\PaymentMethod\DirectDebitChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | | null | [optional] +**failure_return_url** | **string** | | null | [optional] +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**card_last_four** | **string** | Last four digits of the debit card | 8888 | [optional] +**card_expiry** | **string** | Expiry month and year of the debit card (in MM/YY format) | 06/24 | [optional] +**email** | **string** | Email address of the customer that is registered to the partner channel | test.email@xendit.co | [optional] +**identity_document_number** | **string** | Identity number of the customer registered to the partner channel | 1234567891113 | [optional] +**require_auth** | **bool** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitDebitCard.md b/docs/PaymentMethod/DirectDebitDebitCard.md new file mode 100644 index 0000000..be230b2 --- /dev/null +++ b/docs/PaymentMethod/DirectDebitDebitCard.md @@ -0,0 +1,17 @@ +# # DirectDebitDebitCard + + +```php +use Xendit\PaymentMethod\DirectDebitDebitCard; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**card_last_four** | **string** | Last four digits of the debit card | 8888 | [optional] +**card_expiry** | **string** | Expiry month and year of the debit card (in MM/YY format) | 06/24 | [optional] +**email** | **string** | Email address of the customer that is registered to the partner channel | test.email@xendit.co | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitParameters.md b/docs/PaymentMethod/DirectDebitParameters.md new file mode 100644 index 0000000..70530a7 --- /dev/null +++ b/docs/PaymentMethod/DirectDebitParameters.md @@ -0,0 +1,15 @@ +# # DirectDebitParameters + + +```php +use Xendit\PaymentMethod\DirectDebitParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**DirectDebitChannelCode**](DirectDebitChannelCode.md) | | null | +**channel_properties** | [**DirectDebitChannelProperties**](DirectDebitChannelProperties.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/DirectDebitType.md b/docs/PaymentMethod/DirectDebitType.md new file mode 100644 index 0000000..6b58856 --- /dev/null +++ b/docs/PaymentMethod/DirectDebitType.md @@ -0,0 +1,13 @@ +# # DirectDebitType + + +```php +use Xendit\PaymentMethod\DirectDebitType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/EWallet.md b/docs/PaymentMethod/EWallet.md new file mode 100644 index 0000000..1fcafff --- /dev/null +++ b/docs/PaymentMethod/EWallet.md @@ -0,0 +1,16 @@ +# # EWallet + + +```php +use Xendit\PaymentMethod\EWallet; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**EWalletChannelCode**](EWalletChannelCode.md) | | null | +**channel_properties** | [**EWalletChannelProperties**](EWalletChannelProperties.md) | | null | [optional] +**account** | [**EWalletAccount**](EWalletAccount.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/EWalletAccount.md b/docs/PaymentMethod/EWalletAccount.md new file mode 100644 index 0000000..8a1d761 --- /dev/null +++ b/docs/PaymentMethod/EWalletAccount.md @@ -0,0 +1,17 @@ +# # EWalletAccount + + +```php +use Xendit\PaymentMethod\EWalletAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**name** | **string** | Name of the eWallet account holder. The value is null if unavailableName of the eWallet account holder. The value is null if unavailable | null | [optional] +**account_details** | **string** | Identifier from eWallet provider e.g. phone number. The value is null if unavailable | null | [optional] +**balance** | **float** | The main balance amount on eWallet account provided from eWallet provider. The value is null if unavailable | null | [optional] +**point_balance** | **float** | The point balance amount on eWallet account. Applicable only on some eWallet provider that has point system. The value is null if unavailabl | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/EWalletChannelCode.md b/docs/PaymentMethod/EWalletChannelCode.md new file mode 100644 index 0000000..2669500 --- /dev/null +++ b/docs/PaymentMethod/EWalletChannelCode.md @@ -0,0 +1,13 @@ +# # EWalletChannelCode + + +```php +use Xendit\PaymentMethod\EWalletChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/EWalletChannelProperties.md b/docs/PaymentMethod/EWalletChannelProperties.md new file mode 100644 index 0000000..e7d13f5 --- /dev/null +++ b/docs/PaymentMethod/EWalletChannelProperties.md @@ -0,0 +1,19 @@ +# # EWalletChannelProperties + + +```php +use Xendit\PaymentMethod\EWalletChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cancel_return_url** | **string** | URL where the end-customer is redirected if the authorization cancelled | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**mobile_number** | **string** | Mobile number of customer in E.164 format (e.g. +628123123123). For OVO one time payment use only. | +628123123123 | [optional] +**redeem_points** | **string** | REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. | REDEEM_NONE | [optional] +**cashtag** | **string** | Available for JENIUSPAY only | $abc1234 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/EWalletParameters.md b/docs/PaymentMethod/EWalletParameters.md new file mode 100644 index 0000000..8958cc8 --- /dev/null +++ b/docs/PaymentMethod/EWalletParameters.md @@ -0,0 +1,16 @@ +# # EWalletParameters + + +```php +use Xendit\PaymentMethod\EWalletParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**EWalletChannelCode**](EWalletChannelCode.md) | | null | +**channel_properties** | [**EWalletChannelProperties**](EWalletChannelProperties.md) | | null | [optional] +**account** | [**EWalletAccount**](EWalletAccount.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/GetAllPaymentMethods400Response.md b/docs/PaymentMethod/GetAllPaymentMethods400Response.md new file mode 100644 index 0000000..a393146 --- /dev/null +++ b/docs/PaymentMethod/GetAllPaymentMethods400Response.md @@ -0,0 +1,15 @@ +# # GetAllPaymentMethods400Response + + +```php +use Xendit\PaymentMethod\GetAllPaymentMethods400Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/GetAllPaymentMethods403Response.md b/docs/PaymentMethod/GetAllPaymentMethods403Response.md new file mode 100644 index 0000000..7118b6a --- /dev/null +++ b/docs/PaymentMethod/GetAllPaymentMethods403Response.md @@ -0,0 +1,15 @@ +# # GetAllPaymentMethods403Response + + +```php +use Xendit\PaymentMethod\GetAllPaymentMethods403Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/GetAllPaymentMethods404Response.md b/docs/PaymentMethod/GetAllPaymentMethods404Response.md new file mode 100644 index 0000000..3c92421 --- /dev/null +++ b/docs/PaymentMethod/GetAllPaymentMethods404Response.md @@ -0,0 +1,15 @@ +# # GetAllPaymentMethods404Response + + +```php +use Xendit\PaymentMethod\GetAllPaymentMethods404Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/GetAllPaymentMethodsDefaultResponse.md b/docs/PaymentMethod/GetAllPaymentMethodsDefaultResponse.md new file mode 100644 index 0000000..3054ed5 --- /dev/null +++ b/docs/PaymentMethod/GetAllPaymentMethodsDefaultResponse.md @@ -0,0 +1,15 @@ +# # GetAllPaymentMethodsDefaultResponse + + +```php +use Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounter.md b/docs/PaymentMethod/OverTheCounter.md new file mode 100644 index 0000000..e048996 --- /dev/null +++ b/docs/PaymentMethod/OverTheCounter.md @@ -0,0 +1,17 @@ +# # OverTheCounter + + +```php +use Xendit\PaymentMethod\OverTheCounter; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**OverTheCounterChannelCode**](OverTheCounterChannelCode.md) | | null | +**channel_properties** | [**OverTheCounterChannelProperties**](OverTheCounterChannelProperties.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounterChannelCode.md b/docs/PaymentMethod/OverTheCounterChannelCode.md new file mode 100644 index 0000000..7c2be77 --- /dev/null +++ b/docs/PaymentMethod/OverTheCounterChannelCode.md @@ -0,0 +1,13 @@ +# # OverTheCounterChannelCode + + +```php +use Xendit\PaymentMethod\OverTheCounterChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounterChannelProperties.md b/docs/PaymentMethod/OverTheCounterChannelProperties.md new file mode 100644 index 0000000..88fd30e --- /dev/null +++ b/docs/PaymentMethod/OverTheCounterChannelProperties.md @@ -0,0 +1,16 @@ +# # OverTheCounterChannelProperties + + +```php +use Xendit\PaymentMethod\OverTheCounterChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**payment_code** | **string** | The payment code that you want to assign, e.g 12345. If you do not send one, one will be picked at random. | 12345 | [optional] +**customer_name** | **string** | Name of customer. | Rika Sutanto | +**expires_at** | **\DateTime** | The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. | 2022-01-01T00:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounterChannelPropertiesUpdate.md b/docs/PaymentMethod/OverTheCounterChannelPropertiesUpdate.md new file mode 100644 index 0000000..2c13047 --- /dev/null +++ b/docs/PaymentMethod/OverTheCounterChannelPropertiesUpdate.md @@ -0,0 +1,15 @@ +# # OverTheCounterChannelPropertiesUpdate + + +```php +use Xendit\PaymentMethod\OverTheCounterChannelPropertiesUpdate; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**customer_name** | **string** | Name of customer. | Rika Sutanto | [optional] +**expires_at** | **\DateTime** | The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. | 2022-01-01T00:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounterParameters.md b/docs/PaymentMethod/OverTheCounterParameters.md new file mode 100644 index 0000000..714a96e --- /dev/null +++ b/docs/PaymentMethod/OverTheCounterParameters.md @@ -0,0 +1,17 @@ +# # OverTheCounterParameters + + +```php +use Xendit\PaymentMethod\OverTheCounterParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**OverTheCounterChannelCode**](OverTheCounterChannelCode.md) | | null | +**channel_properties** | [**OverTheCounterChannelProperties**](OverTheCounterChannelProperties.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/OverTheCounterUpdateParameters.md b/docs/PaymentMethod/OverTheCounterUpdateParameters.md new file mode 100644 index 0000000..3aafae4 --- /dev/null +++ b/docs/PaymentMethod/OverTheCounterUpdateParameters.md @@ -0,0 +1,15 @@ +# # OverTheCounterUpdateParameters + + +```php +use Xendit\PaymentMethod\OverTheCounterUpdateParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**channel_properties** | [**OverTheCounterChannelPropertiesUpdate**](OverTheCounterChannelPropertiesUpdate.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentChannel.md b/docs/PaymentMethod/PaymentChannel.md new file mode 100644 index 0000000..b88a310 --- /dev/null +++ b/docs/PaymentMethod/PaymentChannel.md @@ -0,0 +1,20 @@ +# # PaymentChannel + + +```php +use Xendit\PaymentMethod\PaymentChannel; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | **string** | The specific Xendit code used to identify the partner channel | BPI | [optional] +**type** | **string** | The payment method type | DIRECT_DEBIT | [optional] +**country** | **string** | The country where the channel operates in ISO 3166-2 country code | PH | [optional] +**channel_name** | **string** | Official parter name of the payment channel | Bank of the Philippine Islands | [optional] +**channel_properties** | [**array**](ChannelProperty.md) | | null | [optional] +**logo_url** | **string** | If available, this contains a URL to the logo of the partner channel | null | [optional] +**amount_limits** | [**array**](ChannelAmountLimits.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentChannelAllOf.md b/docs/PaymentMethod/PaymentChannelAllOf.md new file mode 100644 index 0000000..f3ea1fa --- /dev/null +++ b/docs/PaymentMethod/PaymentChannelAllOf.md @@ -0,0 +1,20 @@ +# # PaymentChannelAllOf + + +```php +use Xendit\PaymentMethod\PaymentChannelAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | **string** | The specific Xendit code used to identify the partner channel | BPI | [optional] +**type** | **string** | The payment method type | DIRECT_DEBIT | [optional] +**country** | **string** | The country where the channel operates in ISO 3166-2 country code | PH | [optional] +**channel_name** | **string** | Official parter name of the payment channel | Bank of the Philippine Islands | [optional] +**channel_properties** | [**array**](ChannelProperty.md) | | null | [optional] +**logo_url** | **string** | If available, this contains a URL to the logo of the partner channel | null | [optional] +**amount_limits** | [**array**](ChannelAmountLimits.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentChannelList.md b/docs/PaymentMethod/PaymentChannelList.md new file mode 100644 index 0000000..ee686c0 --- /dev/null +++ b/docs/PaymentMethod/PaymentChannelList.md @@ -0,0 +1,16 @@ +# # PaymentChannelList + + +```php +use Xendit\PaymentMethod\PaymentChannelList; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](PaymentChannel.md) | Array of resources that match the provided filters | null | [optional] +**links** | [**array**](PaymentChannelListLinksInner.md) | Array of objects that can be used to assist on navigating through the data | null | [optional] +**has_more** | **bool** | Indicates whether there are more items in the list | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentChannelListLinksInner.md b/docs/PaymentMethod/PaymentChannelListLinksInner.md new file mode 100644 index 0000000..c31c204 --- /dev/null +++ b/docs/PaymentMethod/PaymentChannelListLinksInner.md @@ -0,0 +1,16 @@ +# # PaymentChannelListLinksInner + + +```php +use Xendit\PaymentMethod\PaymentChannelListLinksInner; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**href** | **string** | Target URI that should contain a target to Internationalized Resource Identifiers (IRI) | /v2/payment_methods/channels?is_activated=true | [optional] +**rel** | **string** | The link relation type described how the current context (source) is related to target resource | next | [optional] +**method** | **string** | The HTTP method to be used to call `href` | GET | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentChannelListLinksInnerAllOf.md b/docs/PaymentMethod/PaymentChannelListLinksInnerAllOf.md new file mode 100644 index 0000000..e320a83 --- /dev/null +++ b/docs/PaymentMethod/PaymentChannelListLinksInnerAllOf.md @@ -0,0 +1,16 @@ +# # PaymentChannelListLinksInnerAllOf + + +```php +use Xendit\PaymentMethod\PaymentChannelListLinksInnerAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**href** | **string** | Target URI that should contain a target to Internationalized Resource Identifiers (IRI) | /v2/payment_methods/channels?is_activated=true | [optional] +**rel** | **string** | The link relation type described how the current context (source) is related to target resource | next | [optional] +**method** | **string** | The HTTP method to be used to call `href` | GET | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethod.md b/docs/PaymentMethod/PaymentMethod.md new file mode 100644 index 0000000..7ad8ef4 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethod.md @@ -0,0 +1,35 @@ +# # PaymentMethod + + +```php +use Xendit\PaymentMethod\PaymentMethod; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | | null | +**business_id** | **string** | | null | [optional] +**type** | [**PaymentMethodType**](PaymentMethodType.md) | | null | [optional] +**country** | [**PaymentMethodCountry**](PaymentMethodCountry.md) | | null | [optional] +**customer_id** | **string** | | null | [optional] +**customer** | **object** | | null | [optional] +**reference_id** | **string** | | null | [optional] +**description** | **string** | | null | [optional] +**status** | [**PaymentMethodStatus**](PaymentMethodStatus.md) | | null | [optional] +**reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md) | | null | [optional] +**actions** | [**array**](PaymentMethodAction.md) | | null | [optional] +**metadata** | **object** | | null | [optional] +**billing_information** | [**BillingInformation**](BillingInformation.md) | | null | [optional] +**failure_code** | **string** | | null | [optional] +**created** | **\DateTime** | | 2016-08-29T09:12:33.001Z | [optional] +**updated** | **\DateTime** | | 2016-08-29T09:12:33.001Z | [optional] +**ewallet** | [**EWallet**](EWallet.md) | | null | [optional] +**direct_debit** | [**DirectDebit**](DirectDebit.md) | | null | [optional] +**over_the_counter** | [**OverTheCounter**](OverTheCounter.md) | | null | [optional] +**card** | [**Card**](Card.md) | | null | [optional] +**qr_code** | [**QRCode**](QRCode.md) | | null | [optional] +**virtual_account** | [**VirtualAccount**](VirtualAccount.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodAction.md b/docs/PaymentMethod/PaymentMethodAction.md new file mode 100644 index 0000000..89ab55e --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodAction.md @@ -0,0 +1,17 @@ +# # PaymentMethodAction + + +```php +use Xendit\PaymentMethod\PaymentMethodAction; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**action** | **string** | | null | [optional] +**method** | **string** | | null | [optional] +**url** | **string** | | null | [optional] +**url_type** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodApi.md b/docs/PaymentMethod/PaymentMethodApi.md new file mode 100644 index 0000000..beeb29c --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodApi.md @@ -0,0 +1,546 @@ +# Xendit\PaymentMethodApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**authPaymentMethod()**](PaymentMethodApi.md#authPaymentMethod) | **POST** /v2/payment_methods/{paymentMethodId}/auth | Validate a payment method's linking OTP | +| [**createPaymentMethod()**](PaymentMethodApi.md#createPaymentMethod) | **POST** /v2/payment_methods | Creates payment method | +| [**expirePaymentMethod()**](PaymentMethodApi.md#expirePaymentMethod) | **POST** /v2/payment_methods/{paymentMethodId}/expire | Expires a payment method | +| [**getAllPaymentChannels()**](PaymentMethodApi.md#getAllPaymentChannels) | **GET** /v2/payment_methods/channels | Get all payment channels | +| [**getAllPaymentMethods()**](PaymentMethodApi.md#getAllPaymentMethods) | **GET** /v2/payment_methods | Get all payment methods by filters | +| [**getPaymentMethodByID()**](PaymentMethodApi.md#getPaymentMethodByID) | **GET** /v2/payment_methods/{paymentMethodId} | Get payment method by ID | +| [**getPaymentsByPaymentMethodId()**](PaymentMethodApi.md#getPaymentsByPaymentMethodId) | **GET** /v2/payment_methods/{paymentMethodId}/payments | Returns payments with matching PaymentMethodID. | +| [**patchPaymentMethod()**](PaymentMethodApi.md#patchPaymentMethod) | **PATCH** /v2/payment_methods/{paymentMethodId} | Patch payment methods | +| [**simulatePayment()**](PaymentMethodApi.md#simulatePayment) | **POST** /v2/payment_methods/{paymentMethodId}/payments/simulate | Makes payment with matching PaymentMethodID. | + + +## `authPaymentMethod()` + +```php +authPaymentMethod($payment_method_id, $payment_method_auth_parameters): \PaymentMethod\PaymentMethod +``` + +Validate a payment method's linking OTP + +This endpoint validates a payment method linking OTP + +### Example + +```php +authPaymentMethod($payment_method_id, $payment_method_auth_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->authPaymentMethod: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | +| **payment_method_auth_parameters** | [**PaymentMethodAuthParameters**](PaymentMethodAuthParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethod**](PaymentMethod.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `createPaymentMethod()` + +```php +createPaymentMethod($payment_method_parameters): \PaymentMethod\PaymentMethod +``` + +Creates payment method + +This endpoint initiates creation of payment method + +### Example + +```php +createPaymentMethod($payment_method_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->createPaymentMethod: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_parameters** | [**PaymentMethodParameters**](PaymentMethodParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethod**](PaymentMethod.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `expirePaymentMethod()` + +```php +expirePaymentMethod($payment_method_id, $payment_method_expire_parameters): \PaymentMethod\PaymentMethod +``` + +Expires a payment method + +This endpoint expires a payment method and performs unlinking if necessary + +### Example + +```php +expirePaymentMethod($payment_method_id, $payment_method_expire_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->expirePaymentMethod: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | +| **payment_method_expire_parameters** | [**PaymentMethodExpireParameters**](PaymentMethodExpireParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethod**](PaymentMethod.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getAllPaymentChannels()` + +```php +getAllPaymentChannels($is_activated, $type): \PaymentMethod\PaymentChannelList +``` + +Get all payment channels + +Get all payment channels + +### Example + +```php +getAllPaymentChannels($is_activated, $type); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->getAllPaymentChannels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **is_activated** | **bool**| | [optional] [default to true] | +| **type** | **string**| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentChannelList**](PaymentChannelList.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getAllPaymentMethods()` + +```php +getAllPaymentMethods($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit): \PaymentMethod\PaymentMethodList +``` + +Get all payment methods by filters + +Get all payment methods by filters + +### Example + +```php +getAllPaymentMethods($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->getAllPaymentMethods: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string[]**| | [optional] | +| **type** | **string[]**| | [optional] | +| **status** | [**PaymentMethodStatus**](PaymentMethodStatus.md)| | [optional] | +| **reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md)| | [optional] | +| **customer_id** | **string**| | [optional] | +| **reference_id** | **string**| | [optional] | +| **after_id** | **string**| | [optional] | +| **before_id** | **string**| | [optional] | +| **limit** | **int**| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethodList**](PaymentMethodList.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPaymentMethodByID()` + +```php +getPaymentMethodByID($payment_method_id): \PaymentMethod\PaymentMethod +``` + +Get payment method by ID + +Get payment method by ID + +### Example + +```php +getPaymentMethodByID($payment_method_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->getPaymentMethodByID: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethod**](PaymentMethod.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPaymentsByPaymentMethodId()` + +```php +getPaymentsByPaymentMethodId($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id): object +``` + +Returns payments with matching PaymentMethodID. + +Returns payments with matching PaymentMethodID. + +### Example + +```php +getPaymentsByPaymentMethodId($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->getPaymentsByPaymentMethodId: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | +| **payment_request_id** | **string[]**| | [optional] | +| **payment_method_id2** | **string[]**| | [optional] | +| **reference_id** | **string[]**| | [optional] | +| **payment_method_type** | [**PaymentMethodType**](PaymentMethodType.md)| | [optional] | +| **channel_code** | **string[]**| | [optional] | +| **status** | **string[]**| | [optional] | +| **currency** | **string[]**| | [optional] | +| **created_gte** | **\DateTime**| | [optional] | +| **created_lte** | **\DateTime**| | [optional] | +| **updated_gte** | **\DateTime**| | [optional] | +| **updated_lte** | **\DateTime**| | [optional] | +| **limit** | **int**| | [optional] | +| **after_id** | **string**| | [optional] | +| **before_id** | **string**| | [optional] | + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `patchPaymentMethod()` + +```php +patchPaymentMethod($payment_method_id, $payment_method_update_parameters): \PaymentMethod\PaymentMethod +``` + +Patch payment methods + +This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. + +### Example + +```php +patchPaymentMethod($payment_method_id, $payment_method_update_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->patchPaymentMethod: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | +| **payment_method_update_parameters** | [**PaymentMethodUpdateParameters**](PaymentMethodUpdateParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentMethod\PaymentMethod**](PaymentMethod.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `simulatePayment()` + +```php +simulatePayment($payment_method_id, $simulate_payment_request) +``` + +Makes payment with matching PaymentMethodID. + +Makes payment with matching PaymentMethodID. + +### Example + +```php +simulatePayment($payment_method_id, $simulate_payment_request); +} catch (Exception $e) { + echo 'Exception when calling PaymentMethodApi->simulatePayment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_method_id** | **string**| | | +| **simulate_payment_request** | [**SimulatePaymentRequest**](SimulatePaymentRequest.md)| | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodAuthParameters.md b/docs/PaymentMethod/PaymentMethodAuthParameters.md new file mode 100644 index 0000000..8d80b23 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodAuthParameters.md @@ -0,0 +1,14 @@ +# # PaymentMethodAuthParameters + + +```php +use Xendit\PaymentMethod\PaymentMethodAuthParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**auth_code** | **string** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodCountry.md b/docs/PaymentMethod/PaymentMethodCountry.md new file mode 100644 index 0000000..ccd43e7 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodCountry.md @@ -0,0 +1,13 @@ +# # PaymentMethodCountry + + +```php +use Xendit\PaymentMethod\PaymentMethodCountry; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodExpireParameters.md b/docs/PaymentMethod/PaymentMethodExpireParameters.md new file mode 100644 index 0000000..2a87919 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodExpireParameters.md @@ -0,0 +1,15 @@ +# # PaymentMethodExpireParameters + + +```php +use Xendit\PaymentMethod\PaymentMethodExpireParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | URL where the end customer is redirected if the unlinking authorization is successful. | null | [optional] +**failure_return_url** | **string** | URL where the end customer is redirected if the unlinking authorization is failed. | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodList.md b/docs/PaymentMethod/PaymentMethodList.md new file mode 100644 index 0000000..b597572 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodList.md @@ -0,0 +1,15 @@ +# # PaymentMethodList + + +```php +use Xendit\PaymentMethod\PaymentMethodList; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](PaymentMethod.md) | | null | +**has_more** | **bool** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodParameters.md b/docs/PaymentMethod/PaymentMethodParameters.md new file mode 100644 index 0000000..eb7e98b --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodParameters.md @@ -0,0 +1,27 @@ +# # PaymentMethodParameters + + +```php +use Xendit\PaymentMethod\PaymentMethodParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | [**PaymentMethodType**](PaymentMethodType.md) | | null | +**country** | **string** | | null | [optional] +**reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md) | | null | +**customer_id** | **string** | | null | [optional] +**reference_id** | **string** | | null | [optional] +**description** | **string** | | null | [optional] +**card** | [**CardParameters**](CardParameters.md) | | null | [optional] +**direct_debit** | [**DirectDebitParameters**](DirectDebitParameters.md) | | null | [optional] +**ewallet** | [**EWalletParameters**](EWalletParameters.md) | | null | [optional] +**over_the_counter** | [**OverTheCounterParameters**](OverTheCounterParameters.md) | | null | [optional] +**virtual_account** | [**VirtualAccountParameters**](VirtualAccountParameters.md) | | null | [optional] +**qr_code** | [**QRCodeParameters**](QRCodeParameters.md) | | null | [optional] +**metadata** | **object** | | null | [optional] +**billing_information** | [**BillingInformation**](BillingInformation.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodReusability.md b/docs/PaymentMethod/PaymentMethodReusability.md new file mode 100644 index 0000000..2f9c3de --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodReusability.md @@ -0,0 +1,13 @@ +# # PaymentMethodReusability + + +```php +use Xendit\PaymentMethod\PaymentMethodReusability; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodStatus.md b/docs/PaymentMethod/PaymentMethodStatus.md new file mode 100644 index 0000000..07ad2b6 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodStatus.md @@ -0,0 +1,13 @@ +# # PaymentMethodStatus + + +```php +use Xendit\PaymentMethod\PaymentMethodStatus; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodType.md b/docs/PaymentMethod/PaymentMethodType.md new file mode 100644 index 0000000..22ce0e3 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodType.md @@ -0,0 +1,13 @@ +# # PaymentMethodType + + +```php +use Xendit\PaymentMethod\PaymentMethodType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/PaymentMethodUpdateParameters.md b/docs/PaymentMethod/PaymentMethodUpdateParameters.md new file mode 100644 index 0000000..695d132 --- /dev/null +++ b/docs/PaymentMethod/PaymentMethodUpdateParameters.md @@ -0,0 +1,19 @@ +# # PaymentMethodUpdateParameters + + +```php +use Xendit\PaymentMethod\PaymentMethodUpdateParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**description** | **string** | | null | [optional] +**reference_id** | **string** | | null | [optional] +**reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md) | | null | [optional] +**status** | [**PaymentMethodStatus**](PaymentMethodStatus.md) | | null | [optional] +**over_the_counter** | [**OverTheCounterUpdateParameters**](OverTheCounterUpdateParameters.md) | | null | [optional] +**virtual_account** | [**VirtualAccountUpdateParameters**](VirtualAccountUpdateParameters.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/QRCode.md b/docs/PaymentMethod/QRCode.md new file mode 100644 index 0000000..91b558d --- /dev/null +++ b/docs/PaymentMethod/QRCode.md @@ -0,0 +1,17 @@ +# # QRCode + + +```php +use Xendit\PaymentMethod\QRCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**QRCodeChannelCode**](QRCodeChannelCode.md) | | null | [optional] +**channel_properties** | [**QRCodeChannelProperties**](QRCodeChannelProperties.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/QRCodeChannelCode.md b/docs/PaymentMethod/QRCodeChannelCode.md new file mode 100644 index 0000000..49b4246 --- /dev/null +++ b/docs/PaymentMethod/QRCodeChannelCode.md @@ -0,0 +1,13 @@ +# # QRCodeChannelCode + + +```php +use Xendit\PaymentMethod\QRCodeChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/QRCodeChannelProperties.md b/docs/PaymentMethod/QRCodeChannelProperties.md new file mode 100644 index 0000000..5c673c6 --- /dev/null +++ b/docs/PaymentMethod/QRCodeChannelProperties.md @@ -0,0 +1,15 @@ +# # QRCodeChannelProperties + + +```php +use Xendit\PaymentMethod\QRCodeChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**qr_string** | **string** | QR string to be rendered for display to end users. QR string to image rendering are commonly available in software libraries (e.g Nodejs, PHP, Java) | 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52 045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB | [optional] +**expires_at** | **\DateTime** | | 2022-01-01T00:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/QRCodeParameters.md b/docs/PaymentMethod/QRCodeParameters.md new file mode 100644 index 0000000..2bd1c03 --- /dev/null +++ b/docs/PaymentMethod/QRCodeParameters.md @@ -0,0 +1,17 @@ +# # QRCodeParameters + + +```php +use Xendit\PaymentMethod\QRCodeParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**QRCodeChannelCode**](QRCodeChannelCode.md) | | null | [optional] +**channel_properties** | [**QRCodeChannelProperties**](QRCodeChannelProperties.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/SimulatePaymentRequest.md b/docs/PaymentMethod/SimulatePaymentRequest.md new file mode 100644 index 0000000..ae51908 --- /dev/null +++ b/docs/PaymentMethod/SimulatePaymentRequest.md @@ -0,0 +1,14 @@ +# # SimulatePaymentRequest + + +```php +use Xendit\PaymentMethod\SimulatePaymentRequest; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/TokenizedCardInformation.md b/docs/PaymentMethod/TokenizedCardInformation.md new file mode 100644 index 0000000..96c269c --- /dev/null +++ b/docs/PaymentMethod/TokenizedCardInformation.md @@ -0,0 +1,23 @@ +# # TokenizedCardInformation + + +```php +use Xendit\PaymentMethod\TokenizedCardInformation; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**token_id** | **string** | | null | +**masked_card_number** | **string** | 1st 6 and last 4 digits of the card | null | +**cardholder_name** | **string** | Cardholder name is optional but recommended for 3DS 2 / AVS verification | null | [optional] +**expiry_month** | **string** | Card expiry month in MM format | null | +**expiry_year** | **string** | Card expiry month in YY format | null | +**fingerprint** | **string** | Xendit-generated identifier for the unique card number. Multiple payment method objects can be created for the same account - e.g. if the user first creates a one-time payment request, and then later on creates a multiple-use payment method using the same account. The fingerprint helps to identify the unique account being used. | null | +**type** | **string** | Whether the card is a credit or debit card | null | +**network** | **string** | Card network - VISA, MASTERCARD, JCB, AMEX, DISCOVER, BCA | null | +**country** | **string** | Country where the card was issued ISO 3166-1 Alpha-2 | null | +**issuer** | **string** | Issuer of the card, most often an issuing bank For example, “BCA”, “MANDIRI” | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccount.md b/docs/PaymentMethod/VirtualAccount.md new file mode 100644 index 0000000..98e4b13 --- /dev/null +++ b/docs/PaymentMethod/VirtualAccount.md @@ -0,0 +1,21 @@ +# # VirtualAccount + + +```php +use Xendit\PaymentMethod\VirtualAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**VirtualAccountChannelCode**](VirtualAccountChannelCode.md) | | null | +**channel_properties** | [**VirtualAccountChannelProperties**](VirtualAccountChannelProperties.md) | | null | +**alternative_display_types** | **string[]** | For payments in Vietnam only, alternative display requested for the virtual account | null | [optional] +**alternative_displays** | [**array**](VirtualAccountAlternativeDisplay.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountAllOf.md b/docs/PaymentMethod/VirtualAccountAllOf.md new file mode 100644 index 0000000..7e4c98b --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountAllOf.md @@ -0,0 +1,14 @@ +# # VirtualAccountAllOf + + +```php +use Xendit\PaymentMethod\VirtualAccountAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**alternative_displays** | [**array**](VirtualAccountAlternativeDisplay.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountAlternativeDisplay.md b/docs/PaymentMethod/VirtualAccountAlternativeDisplay.md new file mode 100644 index 0000000..26ba565 --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountAlternativeDisplay.md @@ -0,0 +1,15 @@ +# # VirtualAccountAlternativeDisplay + + +```php +use Xendit\PaymentMethod\VirtualAccountAlternativeDisplay; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | **string** | Type of the alternative display | null | [optional] [readonly] +**data** | **string** | Data payload of the given alternative display | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountChannelCode.md b/docs/PaymentMethod/VirtualAccountChannelCode.md new file mode 100644 index 0000000..ee83c21 --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountChannelCode.md @@ -0,0 +1,13 @@ +# # VirtualAccountChannelCode + + +```php +use Xendit\PaymentMethod\VirtualAccountChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountChannelProperties.md b/docs/PaymentMethod/VirtualAccountChannelProperties.md new file mode 100644 index 0000000..1c7a6cf --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountChannelProperties.md @@ -0,0 +1,17 @@ +# # VirtualAccountChannelProperties + + +```php +use Xendit\PaymentMethod\VirtualAccountChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**customer_name** | **string** | Name of customer. | Rika Sutanto | [optional] +**virtual_account_number** | **string** | You can assign specific Virtual Account number using this parameter. If you do not send one, one will be picked at random. Make sure the number you specify is within your Virtual Account range. | 262159999999999 | [optional] +**expires_at** | **\DateTime** | The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. | 2022-01-01T00:00Z | [optional] +**suggested_amount** | **float** | The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) | 100000 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountChannelPropertiesPatch.md b/docs/PaymentMethod/VirtualAccountChannelPropertiesPatch.md new file mode 100644 index 0000000..e909840 --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountChannelPropertiesPatch.md @@ -0,0 +1,15 @@ +# # VirtualAccountChannelPropertiesPatch + + +```php +use Xendit\PaymentMethod\VirtualAccountChannelPropertiesPatch; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**expires_at** | **\DateTime** | The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. | 2022-01-01T00:00Z | [optional] +**suggested_amount** | **float** | The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) | 100000 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountParameters.md b/docs/PaymentMethod/VirtualAccountParameters.md new file mode 100644 index 0000000..9488a7e --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountParameters.md @@ -0,0 +1,20 @@ +# # VirtualAccountParameters + + +```php +use Xendit\PaymentMethod\VirtualAccountParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**currency** | **string** | | null | [optional] +**channel_code** | [**VirtualAccountChannelCode**](VirtualAccountChannelCode.md) | | null | +**channel_properties** | [**VirtualAccountChannelProperties**](VirtualAccountChannelProperties.md) | | null | +**alternative_display_types** | **string[]** | For payments in Vietnam only, alternative display requested for the virtual account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentMethod/VirtualAccountUpdateParameters.md b/docs/PaymentMethod/VirtualAccountUpdateParameters.md new file mode 100644 index 0000000..14f05b1 --- /dev/null +++ b/docs/PaymentMethod/VirtualAccountUpdateParameters.md @@ -0,0 +1,18 @@ +# # VirtualAccountUpdateParameters + + +```php +use Xendit\PaymentMethod\VirtualAccountUpdateParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**channel_properties** | [**VirtualAccountChannelPropertiesPatch**](VirtualAccountChannelPropertiesPatch.md) | | null | [optional] +**alternative_display_types** | **string[]** | For payments in Vietnam only, alternative display requested for the virtual account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest.yaml b/docs/PaymentRequest.yaml new file mode 100644 index 0000000..6509ed7 --- /dev/null +++ b/docs/PaymentRequest.yaml @@ -0,0 +1,2500 @@ +openapi: 3.0.0 +info: + description: This API is used for Payment Requests + title: Payment Requests + version: 1.41.0 +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /payment_requests: + get: + description: Get all payment requests by filter + operationId: getAllPaymentRequests + parameters: + - explode: true + in: query + name: reference_id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: customer_id + required: false + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: before_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: after_id + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequestListResponse' + description: Request successful + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Get all payment requests by filter + tags: + - payment_request + post: + description: Create Payment Request + operationId: createPaymentRequest + parameters: + - explode: false + in: header + name: idempotency-key + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequestParameters' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequest' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Create Payment Request + tags: + - payment_request + /payment_requests/{paymentRequestId}: + get: + description: Get payment request by ID + operationId: getPaymentRequestByID + parameters: + - explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequest' + description: Request successful + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Get payment request by ID + tags: + - payment_request + /payment_requests/{paymentRequestId}/auth: + post: + description: Payment Request Authorize + operationId: authorizePaymentRequest + parameters: + - explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequestAuthParameters' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequest' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Payment Request Authorize + tags: + - payment_request + /payment_requests/{paymentRequestId}/auth/resend: + post: + description: Payment Request Resend Auth + operationId: resendPaymentRequestAuth + parameters: + - explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequest' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Payment Request Resend Auth + tags: + - payment_request + /payment_requests/{paymentRequestId}/captures: + get: + description: Get Payment Request Capture + operationId: getPaymentRequestCaptures + parameters: + - explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + - explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: after_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: before_id + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CaptureListResponse' + description: Request successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Get Payment Request Capture + tags: + - payment_request + post: + description: Payment Request Capture + operationId: capturePaymentRequest + parameters: + - explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CaptureParameters' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/Capture' + description: Capture created + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: Payment Request Capture + tags: + - payment_request +components: + parameters: + IdempotencyKey: + explode: false + in: header + name: idempotency-key + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple + PaymentRequestID: + explode: false + in: path + name: paymentRequestId + required: true + schema: + example: pr-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + responses: + UnexpectedError: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + schemas: + Error: + properties: + error_code: + enum: + - ACCOUNT_ACCESS_BLOCKED + - ADDRESS_VALIDATION_FAILED + - AMOUNT_MISMATCHED + - API_VALIDATION_ERROR + - AUTHENTICATION_FAILED + - AUTHENTICATION_REQUIRED + - CARD_DECLINED + - CHANNEL_CODE_NOT_SUPPORTED_ERROR + - CHANNEL_NOT_ACTIVATED + - CHANNEL_UNAVAILABLE + - COF_COMBINATION_NOT_ALLOWED_ERROR + - CURRENCY_MISMATCHED + - CUSTOMER_NOT_FOUND_ERROR + - CUSTOMER_PAYMENT_METHOD_MISMATCHED + - DATA_NOT_FOUND + - DATA_NOT_FOUND_ERROR + - DECLINED_BY_ISSUER + - DECLINED_BY_PROCESSOR + - DENIED_PERSON_LIST_MATCHED + - DUPLICATE_ERROR + - DUPLICATE_REFERENCE + - EXCEEDS_CAPTURABLE_AMOUNT + - EXPIRED_CARD + - EXPIRED_OTP_ERROR + - FEATURE_NOT_ACTIVATED + - IDEMPOTENCY_ERROR + - INACTIVE_OR_UNAUTHORIZED_CARD + - INSUFFICIENT_BALANCE + - INVALID_ACCOUNT_DETAILS + - INVALID_CVV + - INVALID_OTP_ERROR + - INVALID_PAYMENT_METHOD + - ISSUER_UNAVAILABLE + - MANUAL_CAPTURE_NOT_SUPPORTED + - MAX_ACCOUNT_LINKING + - MAX_AMOUNT_LIMIT_ERROR + - MAX_OTP_ATTEMPTS_ERROR + - OPERATION_NOT_ALLOWED + - OTP_DELIVERY_ERROR + - PAYMENT_METHOD_NOT_FOUND_ERROR + - PAYMENT_REQUEST_ALREADY_COMPLETED + - PAYMENT_REQUEST_ALREADY_FAILED + - PAYMENT_REQUEST_ALREADY_FULLY_CAPTURED + - PAYMENT_STATUS_FAILED + - PROCESSOR_CONFIGURATION_ERROR + - PROCESSOR_ERROR + - PROCESSOR_TEMPORARILY_UNAVAILABLE + - PROCESSOR_TIMEOUT + - REJECTED_BY_ACQUIRER + - SERVER_ERROR + - STOLEN_CARD + - STRONG_CUSTOMER_AUTHENTICATION_REQUIRED + - SUSPECTED_FRAUDULENT + - UNAUTHORIZED + - DUPLICATED_FIXED_PAYMENT_INSTRUMENT + nullable: true + type: string + message: + example: An internal server error occurred + nullable: true + type: string + type: object + PaymentRequestCountry: + enum: + - ID + - PH + - VN + - TH + - MY + type: string + PaymentRequestCurrency: + enum: + - IDR + - PHP + - VND + - THB + - MYR + type: string + PaymentMethodType: + enum: + - CARD + - DIRECT_DEBIT + - EWALLET + - OVER_THE_COUNTER + - QR_CODE + - VIRTUAL_ACCOUNT + type: string + CardChannelProperties: + description: Card Channel Properties + example: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + nullable: false + properties: + skip_three_d_secure: + description: To indicate whether to perform 3DS during the linking phase + example: false + nullable: true + type: boolean + success_return_url: + description: URL where the end-customer is redirected if the authorization + is successful + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + nullable: true + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + failure_return_url: + description: URL where the end-customer is redirected if the authorization + failed + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + nullable: true + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + cardonfile_type: + description: Type of “credential-on-file” / “card-on-file” payment being + made. Indicate that this payment uses a previously linked Payment Method + for charging. + example: RECURRING + nullable: true + type: string + merchant_id_tag: + description: Tag for a Merchant ID that you want to associate this payment + with. For merchants using their own MIDs to specify which MID they want + to use + type: string + type: object + CardInformation: + description: Card Information + example: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + nullable: false + properties: + token_id: + type: string + masked_card_number: + description: 1st 6 and last 4 digits of the card + type: string + expiry_month: + description: Card expiry month in MM format + type: string + expiry_year: + description: Card expiry month in YY format + type: string + cardholder_name: + description: Cardholder name + nullable: true + type: string + fingerprint: + type: string + type: + type: string + network: + enum: + - VISA + - MASTERCARD + - JCB + - AMEX + - DISCOVER + type: string + country: + type: string + issuer: + type: string + required: + - expiry_month + - expiry_year + - masked_card_number + - token_id + type: object + CardVerificationResultsThreeDSecure: + example: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + properties: + three_d_secure_flow: + enum: + - CHALLENGE + - FRICTIONLESS + nullable: true + type: string + eci_code: + nullable: true + type: string + three_d_secure_result: + nullable: true + type: string + three_d_secure_result_reason: + nullable: true + type: string + three_d_secure_version: + nullable: true + type: string + type: object + CardVerificationResults: + example: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + three_d_secure: + $ref: '#/components/schemas/CardVerificationResultsThreeDSecure' + cvv_result: + nullable: true + type: string + address_verification_result: + nullable: true + type: string + type: object + Card: + example: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + currency: + $ref: '#/components/schemas/PaymentRequestCurrency' + channel_properties: + $ref: '#/components/schemas/CardChannelProperties' + card_information: + $ref: '#/components/schemas/CardInformation' + card_verification_results: + $ref: '#/components/schemas/CardVerificationResults' + required: + - card_information + - channel_properties + - currency + type: object + DirectDebitChannelCode: + description: Direct Debit Channel Code + enum: + - BCA_KLIKPAY + - BCA_ONEKLIK + - BRI + - BNI + - MANDIRI + - BPI + - BDO + - CIMBNIAGA + - MTB + - RCBC + - UBP + - AUTODEBIT_UBP + - CHINABANK + - BAY + - KTB + - BBL + - SCB + - KBANK_MB + - BAY_MB + - KTB_MB + - BBL_MB + - SCB_MB + - BDO_EPAY + - AFFIN_FPX + - AGRO_FPX + - ALLIANCE_FPX + - AMBANK_FPX + - ISLAM_FPX + - MUAMALAT_FPX + - BOC_FPX + - RAKYAT_FPX + - BSN_FPX + - CIMB_FPX + - HLB_FPX + - HSBC_FPX + - KFH_FPX + - MAYB2E_FPX + - MAYB2U_FPX + - OCBC_FPX + - PUBLIC_FPX + - RHB_FPX + - SCH_FPX + - UOB_FPX + - AFFIN_FPX_BUSINESS + - AGRO_FPX_BUSINESS + - ALLIANCE_FPX_BUSINESS + - AMBANK_FPX_BUSINESS + - ISLAM_FPX_BUSINESS + - MUAMALAT_FPX_BUSINESS + - BNP_FPX_BUSINESS + - CIMB_FPX_BUSINESS + - CITIBANK_FPX_BUSINESS + - DEUTSCHE_FPX_BUSINESS + - HLB_FPX_BUSINESS + - HSBC_FPX_BUSINESS + - RAKYAT_FPX_BUSINESS + - KFH_FPX_BUSINESS + - MAYB2E_FPX_BUSINESS + - OCBC_FPX_BUSINESS + - PUBLIC_FPX_BUSINESS + - RHB_FPX_BUSINESS + - SCH_FPX_BUSINESS + - UOB_FPX_BUSINESS + example: BRI + type: string + DirectDebitChannelPropertiesBankRedirect: + description: Direct Debit Bank Account Channel Properties + example: + mobile_number: "0812345678" + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + properties: + mobile_number: + description: Mobile number of the customer that is registered to channel + type: string + success_return_url: + format: uri + type: string + failure_return_url: + format: uri + type: string + type: object + DirectDebitChannelPropertiesBankAccount: + description: Direct Debit Bank Account Channel Properties + example: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + properties: + success_return_url: + format: uri + type: string + failure_return_url: + format: uri + type: string + mobile_number: + type: string + identity_document_number: + type: string + type: object + DirectDebitChannelPropertiesDebitCard: + description: Direct Debit Debit Card Channel Properties + example: + mobile_number: +62818555988 + card_last_four: "8888" + card_expiry: 06/24 + email: test.email@xendit.co + properties: + mobile_number: + description: Mobile number of the customer registered to the partner channel + example: +62818555988 + type: string + account_number: + example: "1234567890" + type: string + card_last_four: + description: Last four digits of the debit card + example: "8888" + type: string + card_expiry: + description: Expiry month and year of the debit card (in MM/YY format) + example: 06/24 + type: string + email: + description: Email address of the customer that is registered to the partner + channel + example: test.email@xendit.co + type: string + type: object + DirectDebitChannelProperties: + anyOf: + - $ref: '#/components/schemas/DirectDebitChannelPropertiesBankRedirect' + - $ref: '#/components/schemas/DirectDebitChannelPropertiesBankAccount' + - $ref: '#/components/schemas/DirectDebitChannelPropertiesDebitCard' + nullable: true + DirectDebitType: + enum: + - DEBIT_CARD + - BANK_ACCOUNT + - BANK_REDIRECT + type: string + DirectDebitParameters: + example: + channel_properties: null + channel_code: BRI + type: null + nullable: true + properties: + channel_code: + $ref: '#/components/schemas/DirectDebitChannelCode' + channel_properties: + $ref: '#/components/schemas/DirectDebitChannelProperties' + type: + $ref: '#/components/schemas/DirectDebitType' + required: + - channel_code + - channel_properties + type: object + DirectDebitBankAccount: + nullable: true + properties: + masked_bank_account_number: + example: 233eca40ff303ba15bf39052ca3102c6 + nullable: true + type: string + bank_account_hash: + example: 233eca40ff303ba15bf39052ca3102c6 + nullable: true + type: string + type: object + DirectDebitDebitCard: + nullable: true + properties: + mobile_number: + description: Mobile number of the customer registered to the partner channel + example: +62818555988 + nullable: true + type: string + account_number: + example: "1234567890" + type: string + card_last_four: + description: Last four digits of the debit card + example: "8888" + nullable: true + type: string + card_expiry: + description: Expiry month and year of the debit card (in MM/YY format) + example: 06/24 + nullable: true + type: string + email: + description: Email address of the customer that is registered to the partner + channel + example: test.email@xendit.co + format: email + nullable: true + type: string + type: object + DirectDebit: + allOf: + - $ref: '#/components/schemas/DirectDebitParameters' + - $ref: '#/components/schemas/DirectDebit_allOf' + description: Direct Debit Payment Method Details + nullable: true + type: object + EWalletChannelCode: + description: Ewallet Channel Code + enum: + - GCASH + - GRABPAY + - PAYMAYA + - DANA + - OVO + - LINKAJA + - SHOPEEPAY + - NEXCASH + - ASTRAPAY + - JENIUSPAY + - APPOTA + - MOMO + - VNPTWALLET + - VIETTELPAY + - ZALOPAY + - WECHATPAY + - LINEPAY + - TRUEMONEY + - ALIPAY + example: PAYMAYA + type: string + EWalletChannelProperties: + description: Ewallet Channel Properties + example: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + nullable: false + properties: + success_return_url: + description: URL where the end-customer is redirected if the authorization + is successful + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + failure_return_url: + description: URL where the end-customer is redirected if the authorization + failed + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + cancel_return_url: + description: URL where the end-customer is redirected if the authorization + cancelled + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + redeem_points: + description: "REDEEM_NONE will not use any point, REDEEM_ALL will use all\ + \ available points before cash balance is used. For OVO and ShopeePay\ + \ tokenized payment use only." + example: REDEEM_NONE + type: string + mobile:number: + type: string + cashtag: + type: string + type: object + EWalletParameters: + example: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + channel_code: PAYMAYA + nullable: true + properties: + channel_code: + $ref: '#/components/schemas/EWalletChannelCode' + channel_properties: + $ref: '#/components/schemas/EWalletChannelProperties' + type: object + EWalletAccount: + description: EWallet Account Properties + example: + name: John Peter Doe + account_details: +63(2)123456XXXX + balance: null + point_balance: null + nullable: false + properties: + name: + description: Name of the eWallet account holder. The value is null if unavailableName + of the eWallet account holder. The value is null if unavailable + nullable: true + type: string + account_details: + description: Identifier from eWallet provider e.g. phone number. The value + is null if unavailable + nullable: true + type: string + balance: + description: The main balance amount on eWallet account provided from eWallet + provider. The value is null if unavailable + format: double + nullable: true + type: number + point_balance: + description: The point balance amount on eWallet account. Applicable only + on some eWallet provider that has point system. The value is null if unavailabl + format: double + nullable: true + type: number + type: object + EWallet: + allOf: + - $ref: '#/components/schemas/EWalletParameters' + - $ref: '#/components/schemas/EWallet_allOf' + description: Ewallet Payment Method Details + nullable: true + type: object + OverTheCounterChannelCode: + description: Over The Counter Channel Code + enum: + - 7ELEVEN + - 7ELEVEN_CLIQQ + - CEBUANA + - ECPAY + - PALAWAN + - MLHUILLIER + - ECPAY_DRAGONLOAN + - LBC + - ECPAY_SCHOOL + - RD_PAWNSHOP + - CVM + - USSC + - SM_BILLS + - ROBINSONS_BILLS + - ALFAMART + - INDOMARET + example: 7ELEVEN_CLIQQ + type: string + OverTheCounterChannelProperties: + description: Over The Counter Channel Properties + example: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + properties: + payment_code: + description: "The payment code that you want to assign, e.g 12345. If you\ + \ do not send one, one will be picked at random." + example: "12345" + type: string + customer_name: + description: Name of customer. + example: Rika Sutanto + type: string + expires_at: + description: The time when the payment code will be expired. The minimum + is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date + will be 2 days from payment code generated. + example: 2022-01-01T00:00:00Z + format: date-time + type: string + required: + - customer_name + type: object + OverTheCounterParameters: + example: + amount: 6.027456183070403 + currency: null + channel_properties: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + channel_code: 7ELEVEN_CLIQQ + nullable: true + properties: + amount: + format: double + nullable: true + type: number + currency: + $ref: '#/components/schemas/PaymentRequestCurrency' + channel_code: + $ref: '#/components/schemas/OverTheCounterChannelCode' + channel_properties: + $ref: '#/components/schemas/OverTheCounterChannelProperties' + required: + - channel_code + - channel_properties + type: object + OverTheCounter: + allOf: + - $ref: '#/components/schemas/OverTheCounterParameters' + description: Over the Counter Payment Method Details + nullable: true + type: object + VirtualAccountChannelCode: + description: Virtual Account Channel Code + enum: + - BCA + - BJB + - BNI + - BRI + - MANDIRI + - PERMATA + - BSI + - CIMB + - SAHABAT_SAMPOERNA + - ARTAJASA + - PV + - VIETCAPITAL + - WOORI + - MSB + example: BCA + type: string + VirtualAccountChannelProperties: + description: Virtual Account Channel Properties + example: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + properties: + customer_name: + description: Name of customer. + example: Rika Sutanto + type: string + virtual_account_number: + description: "You can assign specific Virtual Account number using this\ + \ parameter. If you do not send one, one will be picked at random. Make\ + \ sure the number you specify is within your Virtual Account range." + example: "262159999999999" + type: string + expires_at: + description: "The date and time in ISO 8601 UTC+0 when the virtual account\ + \ number will be expired. Default: The default expiration date will be\ + \ 31 years from creation date." + example: 2022-01-01T00:00:00Z + format: date-time + type: string + suggested_amount: + description: "The suggested amount you want to assign. Note: Suggested amounts\ + \ is the amounts that can see as a suggestion, but user can still put\ + \ any numbers (only supported for Mandiri and BRI)" + example: 100000 + format: double + type: number + required: + - customer_name + type: object + VirtualAccountParameters: + example: + amount: 5.637376656633329 + min_amount: 1.4658129805029452 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 5.962133916683182 + currency: null + channel_properties: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + channel_code: BCA + nullable: true + properties: + min_amount: + format: double + nullable: true + type: number + max_amount: + format: double + nullable: true + type: number + amount: + format: double + nullable: true + type: number + currency: + $ref: '#/components/schemas/PaymentRequestCurrency' + channel_code: + $ref: '#/components/schemas/VirtualAccountChannelCode' + channel_properties: + $ref: '#/components/schemas/VirtualAccountChannelProperties' + alternative_display_types: + description: Alternative display requested for the virtual account + items: + enum: + - QR_STRING + type: string + type: array + required: + - channel_code + - channel_properties + type: object + VirtualAccountAlternativeDisplay: + description: Alternative Display Object + properties: + type: + description: Type of the alternative display + enum: + - QR_STRING + readOnly: true + type: string + data: + description: Data payload of the given alternative display + type: string + type: object + VirtualAccount: + allOf: + - $ref: '#/components/schemas/VirtualAccountParameters' + - $ref: '#/components/schemas/VirtualAccount_allOf' + description: Virtual Account Payment Method Details + nullable: true + type: object + QRCodeChannelCode: + description: QR Code Channel Code + enum: + - DANA + - RCBC + - LINKAJA + - PROMPTPAY + example: RCBC + nullable: true + type: string + QRCodeChannelProperties: + description: QR Code Channel Properties + example: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + nullable: false + properties: + qr_string: + type: string + expires_at: + example: 2022-01-01T00:00:00Z + format: date-time + type: string + type: object + QRCodeParameters: + example: + channel_properties: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + channel_code: RCBC + nullable: true + properties: + channel_code: + $ref: '#/components/schemas/QRCodeChannelCode' + channel_properties: + $ref: '#/components/schemas/QRCodeChannelProperties' + type: object + QRCode: + allOf: + - $ref: '#/components/schemas/QRCodeParameters' + description: QRCode Payment Method Details + nullable: true + type: object + PaymentMethodReusability: + enum: + - MULTIPLE_USE + - ONE_TIME_USE + type: string + PaymentMethodStatus: + enum: + - ACTIVE + - INACTIVE + - PENDING + - EXPIRED + - FAILED + type: string + Object: + nullable: true + type: object + PaymentMethod: + example: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + nullable: false + properties: + id: + type: string + type: + $ref: '#/components/schemas/PaymentMethodType' + created: + type: string + updated: + type: string + description: + nullable: true + type: string + reference_id: + type: string + card: + $ref: '#/components/schemas/Card' + direct_debit: + $ref: '#/components/schemas/DirectDebit' + ewallet: + $ref: '#/components/schemas/EWallet' + over_the_counter: + $ref: '#/components/schemas/OverTheCounter' + virtual_account: + $ref: '#/components/schemas/VirtualAccount' + qr_code: + $ref: '#/components/schemas/QRCode' + reusability: + $ref: '#/components/schemas/PaymentMethodReusability' + status: + $ref: '#/components/schemas/PaymentMethodStatus' + metadata: + nullable: true + type: object + required: + - id + - reusability + - status + - type + type: object + PaymentRequestCaptureMethod: + enum: + - AUTOMATIC + - MANUAL + nullable: true + type: string + PaymentRequestInitiator: + enum: + - CUSTOMER + - MERCHANT + nullable: true + type: string + PaymentRequestCardVerificationResultsThreeDeeSecure: + example: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: three_d_secure_flow + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + three_d_secure_flow: + type: string + eci_code: + type: string + three_d_secure_result: + type: string + three_d_secure_result_reason: + nullable: true + type: string + three_d_secure_version: + type: string + type: object + PaymentRequestCardVerificationResults: + example: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: three_d_secure_flow + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + nullable: true + properties: + three_d_secure: + $ref: '#/components/schemas/PaymentRequestCardVerificationResultsThreeDeeSecure' + cvv_result: + nullable: true + type: string + address_verification_result: + nullable: true + type: string + required: + - three_d_secure + type: object + PaymentRequestStatus: + enum: + - PENDING + - REQUIRES_ACTION + - CANCELED + - SUCCEEDED + - FAILED + - VOIDED + - UNKNOWN + - AWAITING_CAPTURE + type: string + PaymentRequestAction: + example: + method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + properties: + action: + enum: + - AUTH + - RESEND_AUTH + - CAPTURE + - CANCEL + - PRESENT_TO_CUSTOMER + type: string + url_type: + enum: + - API + - WEB + - MOBILE + - DEEPLINK + type: string + method: + nullable: true + type: string + url: + nullable: true + type: string + qr_code: + nullable: true + type: string + required: + - action + - method + - qr_code + - url + - url_type + type: object + PaymentRequestShippingInformation: + example: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + nullable: true + properties: + country: + type: string + street_line1: + type: string + street_line2: + type: string + city: + type: string + province_state: + type: string + postal_code: + type: string + required: + - country + type: object + PaymentRequestBasketItem: + example: + metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + nullable: true + properties: + reference_id: + type: string + name: + type: string + description: + type: string + type: + type: string + category: + type: string + sub_category: + type: string + currency: + type: string + quantity: + format: double + type: number + price: + format: double + type: number + payer_charged_currency: + type: string + payer_charged_price: + format: double + type: number + url: + type: string + metadata: + type: object + required: + - category + - currency + - name + - price + - quantity + type: object + PaymentRequestBasket: + items: + $ref: '#/components/schemas/PaymentRequestBasketItem' + nullable: true + type: array + PaymentRequest: + example: + capture_method: null + country: null + amount: 0.8008281904610115 + failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + min_amount: 6.027456183070403 + initiator: null + description: description + shipping_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + max_amount: 1.4658129805029452 + currency: null + id: id + customer_id: customer_id + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: three_d_secure_flow + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + updated: updated + business_id: business_id + actions: + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + items: + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + customer: "{}" + status: null + nullable: false + properties: + id: + type: string + created: + type: string + updated: + type: string + reference_id: + type: string + business_id: + type: string + customer_id: + nullable: true + type: string + customer: + nullable: true + type: object + amount: + format: double + type: number + min_amount: + format: double + nullable: true + type: number + max_amount: + format: double + nullable: true + type: number + country: + $ref: '#/components/schemas/PaymentRequestCountry' + currency: + $ref: '#/components/schemas/PaymentRequestCurrency' + payment_method: + $ref: '#/components/schemas/PaymentMethod' + description: + nullable: true + type: string + failure_code: + nullable: true + type: string + capture_method: + $ref: '#/components/schemas/PaymentRequestCaptureMethod' + initiator: + $ref: '#/components/schemas/PaymentRequestInitiator' + card_verification_results: + $ref: '#/components/schemas/PaymentRequestCardVerificationResults' + status: + $ref: '#/components/schemas/PaymentRequestStatus' + actions: + items: + $ref: '#/components/schemas/PaymentRequestAction' + type: array + metadata: + nullable: true + type: object + shipping_information: + $ref: '#/components/schemas/PaymentRequestShippingInformation' + items: + items: + $ref: '#/components/schemas/PaymentRequestBasketItem' + nullable: true + type: array + required: + - business_id + - created + - currency + - id + - payment_method + - reference_id + - status + - updated + type: object + PaymentRequestListResponse: + example: + data: + - capture_method: null + country: null + amount: 0.8008281904610115 + failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + min_amount: 6.027456183070403 + initiator: null + description: description + shipping_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + max_amount: 1.4658129805029452 + currency: null + id: id + customer_id: customer_id + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: three_d_secure_flow + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + updated: updated + business_id: business_id + actions: + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + items: + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + customer: "{}" + status: null + - capture_method: null + country: null + amount: 0.8008281904610115 + failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + min_amount: 6.027456183070403 + initiator: null + description: description + shipping_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + max_amount: 1.4658129805029452 + currency: null + id: id + customer_id: customer_id + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: three_d_secure_flow + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + updated: updated + business_id: business_id + actions: + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + - method: method + url_type: API + action: AUTH + qr_code: qr_code + url: url + items: + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + customer: "{}" + status: null + has_more: true + properties: + data: + items: + $ref: '#/components/schemas/PaymentRequest' + nullable: false + type: array + has_more: + type: boolean + required: + - data + - has_more + type: object + PaymentMethodParameters: + example: + ewallet: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + channel_code: PAYMAYA + reference_id: reference_id + over_the_counter: + amount: 6.027456183070403 + currency: null + channel_properties: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + channel_code: 7ELEVEN_CLIQQ + virtual_account: + amount: 5.637376656633329 + min_amount: 1.4658129805029452 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 5.962133916683182 + currency: null + channel_properties: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + channel_code: BCA + reusability: null + description: description + qr_code: + channel_properties: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + channel_code: RCBC + type: null + direct_debit: + channel_properties: null + channel_code: BRI + type: null + nullable: false + properties: + type: + $ref: '#/components/schemas/PaymentMethodType' + reusability: + $ref: '#/components/schemas/PaymentMethodReusability' + description: + nullable: true + type: string + reference_id: + type: string + direct_debit: + $ref: '#/components/schemas/DirectDebitParameters' + ewallet: + $ref: '#/components/schemas/EWalletParameters' + over_the_counter: + $ref: '#/components/schemas/OverTheCounterParameters' + virtual_account: + $ref: '#/components/schemas/VirtualAccountParameters' + qr_code: + $ref: '#/components/schemas/QRCodeParameters' + required: + - reusability + - type + type: object + PaymentRequestChannelProperties: + nullable: true + properties: + success_return_url: + description: URL where the end-customer is redirected if the authorization + is successful + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + failure_return_url: + description: URL where the end-customer is redirected if the authorization + failed + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + cancel_return_url: + description: URL where the end-customer is redirected if the authorization + cancelled + example: https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 + pattern: "^\\S{1,255}:\\/\\/\\S{0,1000}$" + type: string + redeem_points: + description: "REDEEM_NONE will not use any point, REDEEM_ALL will use all\ + \ available points before cash balance is used. For OVO and ShopeePay\ + \ tokenized payment use only." + example: REDEEM_NONE + type: string + require_auth: + description: "Toggle used to require end-customer to input undergo OTP validation\ + \ before completing a payment. OTP will always be required for transactions\ + \ greater than 1,000,000 IDR. For BRI tokenized payment use only." + example: false + type: boolean + merchant_id_tag: + description: 'Tag for a Merchant ID that you want to associate this payment + with. For merchants using their own MIDs to specify which MID they want + to use ' + type: string + cardonfile_type: + description: Type of “credential-on-file” / “card-on-file” payment being + made. Indicate that this payment uses a previously linked Payment Method + for charging. + example: RECURRING + nullable: true + type: string + type: object + PaymentRequestParameters: + example: + capture_method: null + amount: 0.8008281904610115 + metadata: "{}" + reference_id: reference_id + initiator: null + description: description + payment_method_id: payment_method_id + shipping_information: + country: country + city: city + province_state: province_state + street_line2: street_line2 + street_line1: street_line1 + postal_code: postal_code + currency: null + channel_properties: null + customer_id: customer_id + items: + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + - metadata: "{}" + quantity: 5.962133916683182 + reference_id: reference_id + sub_category: sub_category + description: description + type: type + url: url + price: 5.637376656633329 + name: name + payer_charged_price: 2.3021358869347655 + currency: currency + payer_charged_currency: payer_charged_currency + category: category + payment_method: + ewallet: + channel_properties: + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + cancel_return_url: https://redirect.me/cancel + channel_code: PAYMAYA + reference_id: reference_id + over_the_counter: + amount: 6.027456183070403 + currency: null + channel_properties: + payment_code: "12345" + customer_name: Rika Sutanto + expires_at: 2022-01-01T00:00:00Z + channel_code: 7ELEVEN_CLIQQ + virtual_account: + amount: 5.637376656633329 + min_amount: 1.4658129805029452 + alternative_display_types: + - QR_STRING + - QR_STRING + max_amount: 5.962133916683182 + currency: null + channel_properties: + customer_name: Rika Sutanto + description: Payment for SSS + expires_at: 2022-01-01T00:00:00Z + channel_code: BCA + reusability: null + description: description + qr_code: + channel_properties: + qr_string: 0002010102##########CO.XENDIT.WWW011893600#######14220002152#####414220010303TTT####015CO.XENDIT.WWW02180000000000000000000TTT52045######ID5911XenditQRIS6007Jakarta6105121606##########3k1mOnF73h11111111#3k1mOnF73h6v53033605401163040BDB + expires_at: 2022-01-01T00:00:00Z + channel_code: RCBC + type: null + direct_debit: + channel_properties: null + channel_code: BRI + type: null + customer: "{}" + nullable: false + properties: + reference_id: + type: string + amount: + format: double + type: number + currency: + $ref: '#/components/schemas/PaymentRequestCurrency' + payment_method: + $ref: '#/components/schemas/PaymentMethodParameters' + description: + nullable: true + type: string + capture_method: + $ref: '#/components/schemas/PaymentRequestCaptureMethod' + initiator: + $ref: '#/components/schemas/PaymentRequestInitiator' + payment_method_id: + type: string + channel_properties: + $ref: '#/components/schemas/PaymentRequestParameters_channel_properties' + shipping_information: + $ref: '#/components/schemas/PaymentRequestShippingInformation' + items: + items: + $ref: '#/components/schemas/PaymentRequestBasketItem' + nullable: true + type: array + customer_id: + nullable: true + type: string + customer: + nullable: true + type: object + metadata: + nullable: true + type: object + required: + - currency + type: object + PaymentRequestAuthParameters: + example: + auth_code: auth_code + nullable: false + properties: + auth_code: + type: string + required: + - auth_code + type: object + Capture: + example: + failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + payment_request_id: payment_request_id + payment_id: payment_id + captured_amount: 6.027456183070403 + authorized_amount: 0.8008281904610115 + currency: currency + channel_properties: "{}" + id: id + customer_id: customer_id + updated: updated + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + status: SUCCEEDED + nullable: false + properties: + id: + type: string + payment_request_id: + type: string + payment_id: + type: string + reference_id: + type: string + currency: + type: string + authorized_amount: + format: double + type: number + captured_amount: + format: double + type: number + status: + enum: + - SUCCEEDED + - FAILED + type: string + payment_method: + $ref: '#/components/schemas/PaymentMethod' + failure_code: + nullable: true + type: string + customer_id: + nullable: true + type: string + metadata: + nullable: true + type: object + channel_properties: + nullable: true + type: object + created: + type: string + updated: + type: string + required: + - authorized_amount + - captured_amount + - channel_properties + - created + - currency + - customer_id + - failure_code + - id + - metadata + - payment_id + - payment_method + - payment_request_id + - reference_id + - status + - updated + type: object + CaptureList: + items: + $ref: '#/components/schemas/Capture' + nullable: false + type: array + CaptureListResponse: + example: + data: + - failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + payment_request_id: payment_request_id + payment_id: payment_id + captured_amount: 6.027456183070403 + authorized_amount: 0.8008281904610115 + currency: currency + channel_properties: "{}" + id: id + customer_id: customer_id + updated: updated + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + status: SUCCEEDED + - failure_code: failure_code + metadata: "{}" + reference_id: reference_id + created: created + payment_request_id: payment_request_id + payment_id: payment_id + captured_amount: 6.027456183070403 + authorized_amount: 0.8008281904610115 + currency: currency + channel_properties: "{}" + id: id + customer_id: customer_id + updated: updated + payment_method: + metadata: "{}" + reference_id: reference_id + created: created + over_the_counter: null + description: description + reusability: null + type: null + direct_debit: null + ewallet: null + virtual_account: null + qr_code: null + id: id + updated: updated + card: + currency: null + channel_properties: + cardonfile_type: UNSCHEDULED + success_return_url: https://redirect.me/good + failure_return_url: https://redirect.me/bad + card_information: + expiry_month: expiry_month + country: country + token_id: token_id + fingerprint: fingerprint + masked_card_number: masked_card_number + cardholder_name: cardholder_name + type: type + expiry_year: expiry_year + issuer: issuer + network: VISA + card_verification_results: + cvv_result: cvv_result + address_verification_result: address_verification_result + three_d_secure: + eci_code: eci_code + three_d_secure_version: three_d_secure_version + three_d_secure_flow: CHALLENGE + three_d_secure_result: three_d_secure_result + three_d_secure_result_reason: three_d_secure_result_reason + status: null + status: SUCCEEDED + has_more: true + properties: + data: + items: + $ref: '#/components/schemas/Capture' + nullable: false + type: array + has_more: + type: boolean + required: + - data + - has_more + type: object + CaptureParameters: + example: + reference_id: reference_id + capture_amount: 0.8008281904610115 + nullable: false + properties: + reference_id: + nullable: true + type: string + capture_amount: + format: double + type: number + required: + - capture_amount + type: object + DirectDebit_allOf: + properties: + type: + $ref: '#/components/schemas/DirectDebitType' + bank_account: + $ref: '#/components/schemas/DirectDebitBankAccount' + debit_card: + $ref: '#/components/schemas/DirectDebitDebitCard' + required: + - type + type: object + example: null + EWallet_allOf: + properties: + account: + $ref: '#/components/schemas/EWalletAccount' + type: object + example: null + VirtualAccount_allOf: + properties: + alternative_displays: + items: + $ref: '#/components/schemas/VirtualAccountAlternativeDisplay' + type: array + type: object + example: null + PaymentRequestParameters_channel_properties_allOf: + properties: + cvv: + description: Three digit code written on the back of the card (usually called + CVV/CVN). + example: "123" + type: string + type: object + PaymentRequestParameters_channel_properties: + allOf: + - $ref: '#/components/schemas/PaymentRequestChannelProperties' + - $ref: '#/components/schemas/PaymentRequestParameters_channel_properties_allOf' diff --git a/docs/PaymentRequest/Capture.md b/docs/PaymentRequest/Capture.md new file mode 100644 index 0000000..3826543 --- /dev/null +++ b/docs/PaymentRequest/Capture.md @@ -0,0 +1,28 @@ +# # Capture + + +```php +use Xendit\PaymentRequest\Capture; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | | null | +**payment_request_id** | **string** | | null | +**payment_id** | **string** | | null | +**reference_id** | **string** | | null | +**currency** | **string** | | null | +**authorized_amount** | **float** | | null | +**captured_amount** | **float** | | null | +**status** | **string** | | null | +**payment_method** | [**PaymentMethod**](PaymentMethod.md) | | null | +**failure_code** | **string** | | null | +**customer_id** | **string** | | null | +**metadata** | **object** | | null | +**channel_properties** | **object** | | null | +**created** | **string** | | null | +**updated** | **string** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CaptureListResponse.md b/docs/PaymentRequest/CaptureListResponse.md new file mode 100644 index 0000000..041efc5 --- /dev/null +++ b/docs/PaymentRequest/CaptureListResponse.md @@ -0,0 +1,15 @@ +# # CaptureListResponse + + +```php +use Xendit\PaymentRequest\CaptureListResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](Capture.md) | | null | +**has_more** | **bool** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CaptureParameters.md b/docs/PaymentRequest/CaptureParameters.md new file mode 100644 index 0000000..2c9eb80 --- /dev/null +++ b/docs/PaymentRequest/CaptureParameters.md @@ -0,0 +1,15 @@ +# # CaptureParameters + + +```php +use Xendit\PaymentRequest\CaptureParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | | null | [optional] +**capture_amount** | **float** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/Card.md b/docs/PaymentRequest/Card.md new file mode 100644 index 0000000..ea2b129 --- /dev/null +++ b/docs/PaymentRequest/Card.md @@ -0,0 +1,17 @@ +# # Card + + +```php +use Xendit\PaymentRequest\Card; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | +**channel_properties** | [**CardChannelProperties**](CardChannelProperties.md) | | null | +**card_information** | [**CardInformation**](CardInformation.md) | | null | +**card_verification_results** | [**CardVerificationResults**](CardVerificationResults.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CardChannelProperties.md b/docs/PaymentRequest/CardChannelProperties.md new file mode 100644 index 0000000..9cf5dc6 --- /dev/null +++ b/docs/PaymentRequest/CardChannelProperties.md @@ -0,0 +1,18 @@ +# # CardChannelProperties + + +```php +use Xendit\PaymentRequest\CardChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**skip_three_d_secure** | **bool** | To indicate whether to perform 3DS during the linking phase | false | [optional] +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cardonfile_type** | **string** | Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. | RECURRING | [optional] +**merchant_id_tag** | **string** | Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CardInformation.md b/docs/PaymentRequest/CardInformation.md new file mode 100644 index 0000000..c8b9b6f --- /dev/null +++ b/docs/PaymentRequest/CardInformation.md @@ -0,0 +1,23 @@ +# # CardInformation + + +```php +use Xendit\PaymentRequest\CardInformation; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**token_id** | **string** | | null | +**masked_card_number** | **string** | 1st 6 and last 4 digits of the card | null | +**expiry_month** | **string** | Card expiry month in MM format | null | +**expiry_year** | **string** | Card expiry month in YY format | null | +**cardholder_name** | **string** | Cardholder name | null | [optional] +**fingerprint** | **string** | | null | [optional] +**type** | **string** | | null | [optional] +**network** | **string** | | null | [optional] +**country** | **string** | | null | [optional] +**issuer** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CardVerificationResults.md b/docs/PaymentRequest/CardVerificationResults.md new file mode 100644 index 0000000..2320b09 --- /dev/null +++ b/docs/PaymentRequest/CardVerificationResults.md @@ -0,0 +1,16 @@ +# # CardVerificationResults + + +```php +use Xendit\PaymentRequest\CardVerificationResults; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure** | [**CardVerificationResultsThreeDSecure**](CardVerificationResultsThreeDSecure.md) | | null | [optional] +**cvv_result** | **string** | | null | [optional] +**address_verification_result** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/CardVerificationResultsThreeDSecure.md b/docs/PaymentRequest/CardVerificationResultsThreeDSecure.md new file mode 100644 index 0000000..2e1b77b --- /dev/null +++ b/docs/PaymentRequest/CardVerificationResultsThreeDSecure.md @@ -0,0 +1,18 @@ +# # CardVerificationResultsThreeDSecure + + +```php +use Xendit\PaymentRequest\CardVerificationResultsThreeDSecure; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure_flow** | **string** | | null | [optional] +**eci_code** | **string** | | null | [optional] +**three_d_secure_result** | **string** | | null | [optional] +**three_d_secure_result_reason** | **string** | | null | [optional] +**three_d_secure_version** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebit.md b/docs/PaymentRequest/DirectDebit.md new file mode 100644 index 0000000..50b958c --- /dev/null +++ b/docs/PaymentRequest/DirectDebit.md @@ -0,0 +1,18 @@ +# # DirectDebit + + +```php +use Xendit\PaymentRequest\DirectDebit; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**DirectDebitChannelCode**](DirectDebitChannelCode.md) | | null | +**channel_properties** | [**DirectDebitChannelProperties**](DirectDebitChannelProperties.md) | | null | +**type** | [**DirectDebitType**](DirectDebitType.md) | | null | +**bank_account** | [**DirectDebitBankAccount**](DirectDebitBankAccount.md) | | null | [optional] +**debit_card** | [**DirectDebitDebitCard**](DirectDebitDebitCard.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitAllOf.md b/docs/PaymentRequest/DirectDebitAllOf.md new file mode 100644 index 0000000..88f1990 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitAllOf.md @@ -0,0 +1,16 @@ +# # DirectDebitAllOf + + +```php +use Xendit\PaymentRequest\DirectDebitAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | [**DirectDebitType**](DirectDebitType.md) | | null | +**bank_account** | [**DirectDebitBankAccount**](DirectDebitBankAccount.md) | | null | [optional] +**debit_card** | [**DirectDebitDebitCard**](DirectDebitDebitCard.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitBankAccount.md b/docs/PaymentRequest/DirectDebitBankAccount.md new file mode 100644 index 0000000..2b2d0e8 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitBankAccount.md @@ -0,0 +1,15 @@ +# # DirectDebitBankAccount + + +```php +use Xendit\PaymentRequest\DirectDebitBankAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**masked_bank_account_number** | **string** | | 233eca40ff303ba15bf39052ca3102c6 | [optional] +**bank_account_hash** | **string** | | 233eca40ff303ba15bf39052ca3102c6 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitChannelCode.md b/docs/PaymentRequest/DirectDebitChannelCode.md new file mode 100644 index 0000000..75a8170 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitChannelCode.md @@ -0,0 +1,13 @@ +# # DirectDebitChannelCode + + +```php +use Xendit\PaymentRequest\DirectDebitChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitChannelProperties.md b/docs/PaymentRequest/DirectDebitChannelProperties.md new file mode 100644 index 0000000..8697480 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitChannelProperties.md @@ -0,0 +1,21 @@ +# # DirectDebitChannelProperties + + +```php +use Xendit\PaymentRequest\DirectDebitChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**success_return_url** | **string** | | null | [optional] +**failure_return_url** | **string** | | null | [optional] +**identity_document_number** | **string** | | null | [optional] +**account_number** | **string** | | 1234567890 | [optional] +**card_last_four** | **string** | Last four digits of the debit card | 8888 | [optional] +**card_expiry** | **string** | Expiry month and year of the debit card (in MM/YY format) | 06/24 | [optional] +**email** | **string** | Email address of the customer that is registered to the partner channel | test.email@xendit.co | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitChannelPropertiesBankAccount.md b/docs/PaymentRequest/DirectDebitChannelPropertiesBankAccount.md new file mode 100644 index 0000000..3186e8e --- /dev/null +++ b/docs/PaymentRequest/DirectDebitChannelPropertiesBankAccount.md @@ -0,0 +1,17 @@ +# # DirectDebitChannelPropertiesBankAccount + + +```php +use Xendit\PaymentRequest\DirectDebitChannelPropertiesBankAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | | null | [optional] +**failure_return_url** | **string** | | null | [optional] +**mobile_number** | **string** | | null | [optional] +**identity_document_number** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.md b/docs/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.md new file mode 100644 index 0000000..bfa4f6a --- /dev/null +++ b/docs/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.md @@ -0,0 +1,16 @@ +# # DirectDebitChannelPropertiesBankRedirect + + +```php +use Xendit\PaymentRequest\DirectDebitChannelPropertiesBankRedirect; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**mobile_number** | **string** | Mobile number of the customer that is registered to channel | null | [optional] +**success_return_url** | **string** | | null | [optional] +**failure_return_url** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitChannelPropertiesDebitCard.md b/docs/PaymentRequest/DirectDebitChannelPropertiesDebitCard.md new file mode 100644 index 0000000..09bb747 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitChannelPropertiesDebitCard.md @@ -0,0 +1,18 @@ +# # DirectDebitChannelPropertiesDebitCard + + +```php +use Xendit\PaymentRequest\DirectDebitChannelPropertiesDebitCard; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**account_number** | **string** | | 1234567890 | [optional] +**card_last_four** | **string** | Last four digits of the debit card | 8888 | [optional] +**card_expiry** | **string** | Expiry month and year of the debit card (in MM/YY format) | 06/24 | [optional] +**email** | **string** | Email address of the customer that is registered to the partner channel | test.email@xendit.co | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitDebitCard.md b/docs/PaymentRequest/DirectDebitDebitCard.md new file mode 100644 index 0000000..bdacd09 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitDebitCard.md @@ -0,0 +1,18 @@ +# # DirectDebitDebitCard + + +```php +use Xendit\PaymentRequest\DirectDebitDebitCard; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**mobile_number** | **string** | Mobile number of the customer registered to the partner channel | +62818555988 | [optional] +**account_number** | **string** | | 1234567890 | [optional] +**card_last_four** | **string** | Last four digits of the debit card | 8888 | [optional] +**card_expiry** | **string** | Expiry month and year of the debit card (in MM/YY format) | 06/24 | [optional] +**email** | **string** | Email address of the customer that is registered to the partner channel | test.email@xendit.co | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitParameters.md b/docs/PaymentRequest/DirectDebitParameters.md new file mode 100644 index 0000000..6751bb1 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitParameters.md @@ -0,0 +1,16 @@ +# # DirectDebitParameters + + +```php +use Xendit\PaymentRequest\DirectDebitParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**DirectDebitChannelCode**](DirectDebitChannelCode.md) | | null | +**channel_properties** | [**DirectDebitChannelProperties**](DirectDebitChannelProperties.md) | | null | +**type** | [**DirectDebitType**](DirectDebitType.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/DirectDebitType.md b/docs/PaymentRequest/DirectDebitType.md new file mode 100644 index 0000000..a878102 --- /dev/null +++ b/docs/PaymentRequest/DirectDebitType.md @@ -0,0 +1,13 @@ +# # DirectDebitType + + +```php +use Xendit\PaymentRequest\DirectDebitType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWallet.md b/docs/PaymentRequest/EWallet.md new file mode 100644 index 0000000..d768185 --- /dev/null +++ b/docs/PaymentRequest/EWallet.md @@ -0,0 +1,16 @@ +# # EWallet + + +```php +use Xendit\PaymentRequest\EWallet; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**EWalletChannelCode**](EWalletChannelCode.md) | | null | [optional] +**channel_properties** | [**EWalletChannelProperties**](EWalletChannelProperties.md) | | null | [optional] +**account** | [**EWalletAccount**](EWalletAccount.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWalletAccount.md b/docs/PaymentRequest/EWalletAccount.md new file mode 100644 index 0000000..6e8182e --- /dev/null +++ b/docs/PaymentRequest/EWalletAccount.md @@ -0,0 +1,17 @@ +# # EWalletAccount + + +```php +use Xendit\PaymentRequest\EWalletAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**name** | **string** | Name of the eWallet account holder. The value is null if unavailableName of the eWallet account holder. The value is null if unavailable | null | [optional] +**account_details** | **string** | Identifier from eWallet provider e.g. phone number. The value is null if unavailable | null | [optional] +**balance** | **float** | The main balance amount on eWallet account provided from eWallet provider. The value is null if unavailable | null | [optional] +**point_balance** | **float** | The point balance amount on eWallet account. Applicable only on some eWallet provider that has point system. The value is null if unavailabl | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWalletAllOf.md b/docs/PaymentRequest/EWalletAllOf.md new file mode 100644 index 0000000..c6be5de --- /dev/null +++ b/docs/PaymentRequest/EWalletAllOf.md @@ -0,0 +1,14 @@ +# # EWalletAllOf + + +```php +use Xendit\PaymentRequest\EWalletAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**account** | [**EWalletAccount**](EWalletAccount.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWalletChannelCode.md b/docs/PaymentRequest/EWalletChannelCode.md new file mode 100644 index 0000000..37a97d2 --- /dev/null +++ b/docs/PaymentRequest/EWalletChannelCode.md @@ -0,0 +1,13 @@ +# # EWalletChannelCode + + +```php +use Xendit\PaymentRequest\EWalletChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWalletChannelProperties.md b/docs/PaymentRequest/EWalletChannelProperties.md new file mode 100644 index 0000000..98bcd9c --- /dev/null +++ b/docs/PaymentRequest/EWalletChannelProperties.md @@ -0,0 +1,19 @@ +# # EWalletChannelProperties + + +```php +use Xendit\PaymentRequest\EWalletChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cancel_return_url** | **string** | URL where the end-customer is redirected if the authorization cancelled | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**redeem_points** | **string** | REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. | REDEEM_NONE | [optional] +**mobilenumber** | **string** | | null | [optional] +**cashtag** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/EWalletParameters.md b/docs/PaymentRequest/EWalletParameters.md new file mode 100644 index 0000000..fa3fc1e --- /dev/null +++ b/docs/PaymentRequest/EWalletParameters.md @@ -0,0 +1,15 @@ +# # EWalletParameters + + +```php +use Xendit\PaymentRequest\EWalletParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**EWalletChannelCode**](EWalletChannelCode.md) | | null | [optional] +**channel_properties** | [**EWalletChannelProperties**](EWalletChannelProperties.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/Error.md b/docs/PaymentRequest/Error.md new file mode 100644 index 0000000..055ec3d --- /dev/null +++ b/docs/PaymentRequest/Error.md @@ -0,0 +1,15 @@ +# # Error + + +```php +use Xendit\PaymentRequest\Error; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An internal server error occurred | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/OverTheCounter.md b/docs/PaymentRequest/OverTheCounter.md new file mode 100644 index 0000000..f9e4d83 --- /dev/null +++ b/docs/PaymentRequest/OverTheCounter.md @@ -0,0 +1,17 @@ +# # OverTheCounter + + +```php +use Xendit\PaymentRequest\OverTheCounter; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | [optional] +**channel_code** | [**OverTheCounterChannelCode**](OverTheCounterChannelCode.md) | | null | +**channel_properties** | [**OverTheCounterChannelProperties**](OverTheCounterChannelProperties.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/OverTheCounterChannelCode.md b/docs/PaymentRequest/OverTheCounterChannelCode.md new file mode 100644 index 0000000..3c61b9d --- /dev/null +++ b/docs/PaymentRequest/OverTheCounterChannelCode.md @@ -0,0 +1,13 @@ +# # OverTheCounterChannelCode + + +```php +use Xendit\PaymentRequest\OverTheCounterChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/OverTheCounterChannelProperties.md b/docs/PaymentRequest/OverTheCounterChannelProperties.md new file mode 100644 index 0000000..a1b9d08 --- /dev/null +++ b/docs/PaymentRequest/OverTheCounterChannelProperties.md @@ -0,0 +1,16 @@ +# # OverTheCounterChannelProperties + + +```php +use Xendit\PaymentRequest\OverTheCounterChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**payment_code** | **string** | The payment code that you want to assign, e.g 12345. If you do not send one, one will be picked at random. | 12345 | [optional] +**customer_name** | **string** | Name of customer. | Rika Sutanto | +**expires_at** | **\DateTime** | The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. | 2022-01-01T00:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/OverTheCounterParameters.md b/docs/PaymentRequest/OverTheCounterParameters.md new file mode 100644 index 0000000..96e0c50 --- /dev/null +++ b/docs/PaymentRequest/OverTheCounterParameters.md @@ -0,0 +1,17 @@ +# # OverTheCounterParameters + + +```php +use Xendit\PaymentRequest\OverTheCounterParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**amount** | **float** | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | [optional] +**channel_code** | [**OverTheCounterChannelCode**](OverTheCounterChannelCode.md) | | null | +**channel_properties** | [**OverTheCounterChannelProperties**](OverTheCounterChannelProperties.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentMethod.md b/docs/PaymentRequest/PaymentMethod.md new file mode 100644 index 0000000..a1896db --- /dev/null +++ b/docs/PaymentRequest/PaymentMethod.md @@ -0,0 +1,28 @@ +# # PaymentMethod + + +```php +use Xendit\PaymentRequest\PaymentMethod; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | | null | +**type** | [**PaymentMethodType**](PaymentMethodType.md) | | null | +**created** | **string** | | null | [optional] +**updated** | **string** | | null | [optional] +**description** | **string** | | null | [optional] +**reference_id** | **string** | | null | [optional] +**card** | [**Card**](Card.md) | | null | [optional] +**direct_debit** | [**DirectDebit**](DirectDebit.md) | | null | [optional] +**ewallet** | [**EWallet**](EWallet.md) | | null | [optional] +**over_the_counter** | [**OverTheCounter**](OverTheCounter.md) | | null | [optional] +**virtual_account** | [**VirtualAccount**](VirtualAccount.md) | | null | [optional] +**qr_code** | [**QRCode**](QRCode.md) | | null | [optional] +**reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md) | | null | +**status** | [**PaymentMethodStatus**](PaymentMethodStatus.md) | | null | +**metadata** | **object** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentMethodParameters.md b/docs/PaymentRequest/PaymentMethodParameters.md new file mode 100644 index 0000000..b19db60 --- /dev/null +++ b/docs/PaymentRequest/PaymentMethodParameters.md @@ -0,0 +1,22 @@ +# # PaymentMethodParameters + + +```php +use Xendit\PaymentRequest\PaymentMethodParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | [**PaymentMethodType**](PaymentMethodType.md) | | null | +**reusability** | [**PaymentMethodReusability**](PaymentMethodReusability.md) | | null | +**description** | **string** | | null | [optional] +**reference_id** | **string** | | null | [optional] +**direct_debit** | [**DirectDebitParameters**](DirectDebitParameters.md) | | null | [optional] +**ewallet** | [**EWalletParameters**](EWalletParameters.md) | | null | [optional] +**over_the_counter** | [**OverTheCounterParameters**](OverTheCounterParameters.md) | | null | [optional] +**virtual_account** | [**VirtualAccountParameters**](VirtualAccountParameters.md) | | null | [optional] +**qr_code** | [**QRCodeParameters**](QRCodeParameters.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentMethodReusability.md b/docs/PaymentRequest/PaymentMethodReusability.md new file mode 100644 index 0000000..fd7fb0d --- /dev/null +++ b/docs/PaymentRequest/PaymentMethodReusability.md @@ -0,0 +1,13 @@ +# # PaymentMethodReusability + + +```php +use Xendit\PaymentRequest\PaymentMethodReusability; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentMethodStatus.md b/docs/PaymentRequest/PaymentMethodStatus.md new file mode 100644 index 0000000..43012c9 --- /dev/null +++ b/docs/PaymentRequest/PaymentMethodStatus.md @@ -0,0 +1,13 @@ +# # PaymentMethodStatus + + +```php +use Xendit\PaymentRequest\PaymentMethodStatus; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentMethodType.md b/docs/PaymentRequest/PaymentMethodType.md new file mode 100644 index 0000000..3838176 --- /dev/null +++ b/docs/PaymentRequest/PaymentMethodType.md @@ -0,0 +1,13 @@ +# # PaymentMethodType + + +```php +use Xendit\PaymentRequest\PaymentMethodType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequest.md b/docs/PaymentRequest/PaymentRequest.md new file mode 100644 index 0000000..e137670 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequest.md @@ -0,0 +1,36 @@ +# # PaymentRequest + + +```php +use Xendit\PaymentRequest\PaymentRequest; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | | null | +**created** | **string** | | null | +**updated** | **string** | | null | +**reference_id** | **string** | | null | +**business_id** | **string** | | null | +**customer_id** | **string** | | null | [optional] +**customer** | **object** | | null | [optional] +**amount** | **float** | | null | [optional] +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**country** | [**PaymentRequestCountry**](PaymentRequestCountry.md) | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | +**payment_method** | [**PaymentMethod**](PaymentMethod.md) | | null | +**description** | **string** | | null | [optional] +**failure_code** | **string** | | null | [optional] +**capture_method** | [**PaymentRequestCaptureMethod**](PaymentRequestCaptureMethod.md) | | null | [optional] +**initiator** | [**PaymentRequestInitiator**](PaymentRequestInitiator.md) | | null | [optional] +**card_verification_results** | [**PaymentRequestCardVerificationResults**](PaymentRequestCardVerificationResults.md) | | null | [optional] +**status** | [**PaymentRequestStatus**](PaymentRequestStatus.md) | | null | +**actions** | [**array**](PaymentRequestAction.md) | | null | [optional] +**metadata** | **object** | | null | [optional] +**shipping_information** | [**PaymentRequestShippingInformation**](PaymentRequestShippingInformation.md) | | null | [optional] +**items** | [**array**](PaymentRequestBasketItem.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestAction.md b/docs/PaymentRequest/PaymentRequestAction.md new file mode 100644 index 0000000..fa45191 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestAction.md @@ -0,0 +1,18 @@ +# # PaymentRequestAction + + +```php +use Xendit\PaymentRequest\PaymentRequestAction; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**action** | **string** | | null | +**url_type** | **string** | | null | +**method** | **string** | | null | +**url** | **string** | | null | +**qr_code** | **string** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestApi.md b/docs/PaymentRequest/PaymentRequestApi.md new file mode 100644 index 0000000..8bc6765 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestApi.md @@ -0,0 +1,407 @@ +# Xendit\PaymentRequestApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**authorizePaymentRequest()**](PaymentRequestApi.md#authorizePaymentRequest) | **POST** /payment_requests/{paymentRequestId}/auth | Payment Request Authorize | +| [**capturePaymentRequest()**](PaymentRequestApi.md#capturePaymentRequest) | **POST** /payment_requests/{paymentRequestId}/captures | Payment Request Capture | +| [**createPaymentRequest()**](PaymentRequestApi.md#createPaymentRequest) | **POST** /payment_requests | Create Payment Request | +| [**getAllPaymentRequests()**](PaymentRequestApi.md#getAllPaymentRequests) | **GET** /payment_requests | Get all payment requests by filter | +| [**getPaymentRequestByID()**](PaymentRequestApi.md#getPaymentRequestByID) | **GET** /payment_requests/{paymentRequestId} | Get payment request by ID | +| [**getPaymentRequestCaptures()**](PaymentRequestApi.md#getPaymentRequestCaptures) | **GET** /payment_requests/{paymentRequestId}/captures | Get Payment Request Capture | +| [**resendPaymentRequestAuth()**](PaymentRequestApi.md#resendPaymentRequestAuth) | **POST** /payment_requests/{paymentRequestId}/auth/resend | Payment Request Resend Auth | + + +## `authorizePaymentRequest()` + +```php +authorizePaymentRequest($payment_request_id, $payment_request_auth_parameters): \PaymentRequest\PaymentRequest +``` + +Payment Request Authorize + +Payment Request Authorize + +### Example + +```php +authorizePaymentRequest($payment_request_id, $payment_request_auth_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->authorizePaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_request_id** | **string**| | | +| **payment_request_auth_parameters** | [**PaymentRequestAuthParameters**](PaymentRequestAuthParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentRequest\PaymentRequest**](PaymentRequest.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `capturePaymentRequest()` + +```php +capturePaymentRequest($payment_request_id, $capture_parameters): \PaymentRequest\Capture +``` + +Payment Request Capture + +Payment Request Capture + +### Example + +```php +capturePaymentRequest($payment_request_id, $capture_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->capturePaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_request_id** | **string**| | | +| **capture_parameters** | [**CaptureParameters**](CaptureParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentRequest\Capture**](Capture.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `createPaymentRequest()` + +```php +createPaymentRequest($idempotency_key, $payment_request_parameters): \PaymentRequest\PaymentRequest +``` + +Create Payment Request + +Create Payment Request + +### Example + +```php +createPaymentRequest($idempotency_key, $payment_request_parameters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->createPaymentRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **idempotency_key** | **string**| | [optional] | +| **payment_request_parameters** | [**PaymentRequestParameters**](PaymentRequestParameters.md)| | [optional] | + +### Return type + +[**\Xendit\PaymentRequest\PaymentRequest**](PaymentRequest.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getAllPaymentRequests()` + +```php +getAllPaymentRequests($reference_id, $id, $customer_id, $limit, $before_id, $after_id): \PaymentRequest\PaymentRequestListResponse +``` + +Get all payment requests by filter + +Get all payment requests by filter + +### Example + +```php +getAllPaymentRequests($reference_id, $id, $customer_id, $limit, $before_id, $after_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->getAllPaymentRequests: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **reference_id** | **string[]**| | [optional] | +| **id** | **string[]**| | [optional] | +| **customer_id** | **string[]**| | [optional] | +| **limit** | **int**| | [optional] | +| **before_id** | **string**| | [optional] | +| **after_id** | **string**| | [optional] | + +### Return type + +[**\Xendit\PaymentRequest\PaymentRequestListResponse**](PaymentRequestListResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPaymentRequestByID()` + +```php +getPaymentRequestByID($payment_request_id): \PaymentRequest\PaymentRequest +``` + +Get payment request by ID + +Get payment request by ID + +### Example + +```php +getPaymentRequestByID($payment_request_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->getPaymentRequestByID: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_request_id** | **string**| | | + +### Return type + +[**\Xendit\PaymentRequest\PaymentRequest**](PaymentRequest.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPaymentRequestCaptures()` + +```php +getPaymentRequestCaptures($payment_request_id, $limit, $after_id, $before_id): \PaymentRequest\CaptureListResponse +``` + +Get Payment Request Capture + +Get Payment Request Capture + +### Example + +```php +getPaymentRequestCaptures($payment_request_id, $limit, $after_id, $before_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->getPaymentRequestCaptures: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_request_id** | **string**| | | +| **limit** | **int**| | [optional] | +| **after_id** | **string**| | [optional] | +| **before_id** | **string**| | [optional] | + +### Return type + +[**\Xendit\PaymentRequest\CaptureListResponse**](CaptureListResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `resendPaymentRequestAuth()` + +```php +resendPaymentRequestAuth($payment_request_id): \PaymentRequest\PaymentRequest +``` + +Payment Request Resend Auth + +Payment Request Resend Auth + +### Example + +```php +resendPaymentRequestAuth($payment_request_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentRequestApi->resendPaymentRequestAuth: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **payment_request_id** | **string**| | | + +### Return type + +[**\Xendit\PaymentRequest\PaymentRequest**](PaymentRequest.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestAuthParameters.md b/docs/PaymentRequest/PaymentRequestAuthParameters.md new file mode 100644 index 0000000..ccaa07e --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestAuthParameters.md @@ -0,0 +1,14 @@ +# # PaymentRequestAuthParameters + + +```php +use Xendit\PaymentRequest\PaymentRequestAuthParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**auth_code** | **string** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestBasketItem.md b/docs/PaymentRequest/PaymentRequestBasketItem.md new file mode 100644 index 0000000..fb2ee66 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestBasketItem.md @@ -0,0 +1,26 @@ +# # PaymentRequestBasketItem + + +```php +use Xendit\PaymentRequest\PaymentRequestBasketItem; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | | null | [optional] +**name** | **string** | | null | +**description** | **string** | | null | [optional] +**type** | **string** | | null | [optional] +**category** | **string** | | null | +**sub_category** | **string** | | null | [optional] +**currency** | **string** | | null | +**quantity** | **float** | | null | +**price** | **float** | | null | +**payer_charged_currency** | **string** | | null | [optional] +**payer_charged_price** | **float** | | null | [optional] +**url** | **string** | | null | [optional] +**metadata** | **object** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestCaptureMethod.md b/docs/PaymentRequest/PaymentRequestCaptureMethod.md new file mode 100644 index 0000000..594c92c --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestCaptureMethod.md @@ -0,0 +1,13 @@ +# # PaymentRequestCaptureMethod + + +```php +use Xendit\PaymentRequest\PaymentRequestCaptureMethod; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestCardVerificationResults.md b/docs/PaymentRequest/PaymentRequestCardVerificationResults.md new file mode 100644 index 0000000..bfe3d32 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestCardVerificationResults.md @@ -0,0 +1,16 @@ +# # PaymentRequestCardVerificationResults + + +```php +use Xendit\PaymentRequest\PaymentRequestCardVerificationResults; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure** | [**PaymentRequestCardVerificationResultsThreeDeeSecure**](PaymentRequestCardVerificationResultsThreeDeeSecure.md) | | null | +**cvv_result** | **string** | | null | [optional] +**address_verification_result** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.md b/docs/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.md new file mode 100644 index 0000000..49e6cb4 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.md @@ -0,0 +1,18 @@ +# # PaymentRequestCardVerificationResultsThreeDeeSecure + + +```php +use Xendit\PaymentRequest\PaymentRequestCardVerificationResultsThreeDeeSecure; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**three_d_secure_flow** | **string** | | null | [optional] +**eci_code** | **string** | | null | [optional] +**three_d_secure_result** | **string** | | null | [optional] +**three_d_secure_result_reason** | **string** | | null | [optional] +**three_d_secure_version** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestChannelProperties.md b/docs/PaymentRequest/PaymentRequestChannelProperties.md new file mode 100644 index 0000000..5bf4969 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestChannelProperties.md @@ -0,0 +1,20 @@ +# # PaymentRequestChannelProperties + + +```php +use Xendit\PaymentRequest\PaymentRequestChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cancel_return_url** | **string** | URL where the end-customer is redirected if the authorization cancelled | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**redeem_points** | **string** | REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. | REDEEM_NONE | [optional] +**require_auth** | **bool** | Toggle used to require end-customer to input undergo OTP validation before completing a payment. OTP will always be required for transactions greater than 1,000,000 IDR. For BRI tokenized payment use only. | false | [optional] +**merchant_id_tag** | **string** | Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use | null | [optional] +**cardonfile_type** | **string** | Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. | RECURRING | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestCountry.md b/docs/PaymentRequest/PaymentRequestCountry.md new file mode 100644 index 0000000..975517f --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestCountry.md @@ -0,0 +1,13 @@ +# # PaymentRequestCountry + + +```php +use Xendit\PaymentRequest\PaymentRequestCountry; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestCurrency.md b/docs/PaymentRequest/PaymentRequestCurrency.md new file mode 100644 index 0000000..321529d --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestCurrency.md @@ -0,0 +1,13 @@ +# # PaymentRequestCurrency + + +```php +use Xendit\PaymentRequest\PaymentRequestCurrency; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestInitiator.md b/docs/PaymentRequest/PaymentRequestInitiator.md new file mode 100644 index 0000000..ded468d --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestInitiator.md @@ -0,0 +1,13 @@ +# # PaymentRequestInitiator + + +```php +use Xendit\PaymentRequest\PaymentRequestInitiator; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestListResponse.md b/docs/PaymentRequest/PaymentRequestListResponse.md new file mode 100644 index 0000000..3fc5517 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestListResponse.md @@ -0,0 +1,15 @@ +# # PaymentRequestListResponse + + +```php +use Xendit\PaymentRequest\PaymentRequestListResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](PaymentRequest.md) | | null | +**has_more** | **bool** | | null | + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestParameters.md b/docs/PaymentRequest/PaymentRequestParameters.md new file mode 100644 index 0000000..4a8a6e8 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestParameters.md @@ -0,0 +1,27 @@ +# # PaymentRequestParameters + + +```php +use Xendit\PaymentRequest\PaymentRequestParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | | null | [optional] +**amount** | **float** | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | +**payment_method** | [**PaymentMethodParameters**](PaymentMethodParameters.md) | | null | [optional] +**description** | **string** | | null | [optional] +**capture_method** | [**PaymentRequestCaptureMethod**](PaymentRequestCaptureMethod.md) | | null | [optional] +**initiator** | [**PaymentRequestInitiator**](PaymentRequestInitiator.md) | | null | [optional] +**payment_method_id** | **string** | | null | [optional] +**channel_properties** | [**PaymentRequestParametersChannelProperties**](PaymentRequestParametersChannelProperties.md) | | null | [optional] +**shipping_information** | [**PaymentRequestShippingInformation**](PaymentRequestShippingInformation.md) | | null | [optional] +**items** | [**array**](PaymentRequestBasketItem.md) | | null | [optional] +**customer_id** | **string** | | null | [optional] +**customer** | **object** | | null | [optional] +**metadata** | **object** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestParametersChannelProperties.md b/docs/PaymentRequest/PaymentRequestParametersChannelProperties.md new file mode 100644 index 0000000..9ebf006 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestParametersChannelProperties.md @@ -0,0 +1,21 @@ +# # PaymentRequestParametersChannelProperties + + +```php +use Xendit\PaymentRequest\PaymentRequestParametersChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**success_return_url** | **string** | URL where the end-customer is redirected if the authorization is successful | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**failure_return_url** | **string** | URL where the end-customer is redirected if the authorization failed | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**cancel_return_url** | **string** | URL where the end-customer is redirected if the authorization cancelled | https://webhook.site/f4b755f5-4770-4a11-8c72-cc0b3cc6b882 | [optional] +**redeem_points** | **string** | REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. | REDEEM_NONE | [optional] +**require_auth** | **bool** | Toggle used to require end-customer to input undergo OTP validation before completing a payment. OTP will always be required for transactions greater than 1,000,000 IDR. For BRI tokenized payment use only. | false | [optional] +**merchant_id_tag** | **string** | Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use | null | [optional] +**cardonfile_type** | **string** | Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. | RECURRING | [optional] +**cvv** | **string** | Three digit code written on the back of the card (usually called CVV/CVN). | 123 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.md b/docs/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.md new file mode 100644 index 0000000..5a52988 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.md @@ -0,0 +1,14 @@ +# # PaymentRequestParametersChannelPropertiesAllOf + + +```php +use Xendit\PaymentRequest\PaymentRequestParametersChannelPropertiesAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**cvv** | **string** | Three digit code written on the back of the card (usually called CVV/CVN). | 123 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestShippingInformation.md b/docs/PaymentRequest/PaymentRequestShippingInformation.md new file mode 100644 index 0000000..f5e677b --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestShippingInformation.md @@ -0,0 +1,19 @@ +# # PaymentRequestShippingInformation + + +```php +use Xendit\PaymentRequest\PaymentRequestShippingInformation; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**country** | **string** | | null | +**street_line1** | **string** | | null | [optional] +**street_line2** | **string** | | null | [optional] +**city** | **string** | | null | [optional] +**province_state** | **string** | | null | [optional] +**postal_code** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/PaymentRequestStatus.md b/docs/PaymentRequest/PaymentRequestStatus.md new file mode 100644 index 0000000..e5df781 --- /dev/null +++ b/docs/PaymentRequest/PaymentRequestStatus.md @@ -0,0 +1,13 @@ +# # PaymentRequestStatus + + +```php +use Xendit\PaymentRequest\PaymentRequestStatus; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/QRCode.md b/docs/PaymentRequest/QRCode.md new file mode 100644 index 0000000..4ae80e3 --- /dev/null +++ b/docs/PaymentRequest/QRCode.md @@ -0,0 +1,15 @@ +# # QRCode + + +```php +use Xendit\PaymentRequest\QRCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**QRCodeChannelCode**](QRCodeChannelCode.md) | | null | [optional] +**channel_properties** | [**QRCodeChannelProperties**](QRCodeChannelProperties.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/QRCodeChannelCode.md b/docs/PaymentRequest/QRCodeChannelCode.md new file mode 100644 index 0000000..5df728b --- /dev/null +++ b/docs/PaymentRequest/QRCodeChannelCode.md @@ -0,0 +1,13 @@ +# # QRCodeChannelCode + + +```php +use Xendit\PaymentRequest\QRCodeChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/QRCodeChannelProperties.md b/docs/PaymentRequest/QRCodeChannelProperties.md new file mode 100644 index 0000000..4ec5249 --- /dev/null +++ b/docs/PaymentRequest/QRCodeChannelProperties.md @@ -0,0 +1,15 @@ +# # QRCodeChannelProperties + + +```php +use Xendit\PaymentRequest\QRCodeChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**qr_string** | **string** | | null | [optional] +**expires_at** | **\DateTime** | | 2022-01-01T00:00Z | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/QRCodeParameters.md b/docs/PaymentRequest/QRCodeParameters.md new file mode 100644 index 0000000..1a46d83 --- /dev/null +++ b/docs/PaymentRequest/QRCodeParameters.md @@ -0,0 +1,15 @@ +# # QRCodeParameters + + +```php +use Xendit\PaymentRequest\QRCodeParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | [**QRCodeChannelCode**](QRCodeChannelCode.md) | | null | [optional] +**channel_properties** | [**QRCodeChannelProperties**](QRCodeChannelProperties.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccount.md b/docs/PaymentRequest/VirtualAccount.md new file mode 100644 index 0000000..dea3c40 --- /dev/null +++ b/docs/PaymentRequest/VirtualAccount.md @@ -0,0 +1,21 @@ +# # VirtualAccount + + +```php +use Xendit\PaymentRequest\VirtualAccount; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**amount** | **float** | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | [optional] +**channel_code** | [**VirtualAccountChannelCode**](VirtualAccountChannelCode.md) | | null | +**channel_properties** | [**VirtualAccountChannelProperties**](VirtualAccountChannelProperties.md) | | null | +**alternative_display_types** | **string[]** | Alternative display requested for the virtual account | null | [optional] +**alternative_displays** | [**array**](VirtualAccountAlternativeDisplay.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccountAllOf.md b/docs/PaymentRequest/VirtualAccountAllOf.md new file mode 100644 index 0000000..65eb03d --- /dev/null +++ b/docs/PaymentRequest/VirtualAccountAllOf.md @@ -0,0 +1,14 @@ +# # VirtualAccountAllOf + + +```php +use Xendit\PaymentRequest\VirtualAccountAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**alternative_displays** | [**array**](VirtualAccountAlternativeDisplay.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccountAlternativeDisplay.md b/docs/PaymentRequest/VirtualAccountAlternativeDisplay.md new file mode 100644 index 0000000..ebdef5f --- /dev/null +++ b/docs/PaymentRequest/VirtualAccountAlternativeDisplay.md @@ -0,0 +1,15 @@ +# # VirtualAccountAlternativeDisplay + + +```php +use Xendit\PaymentRequest\VirtualAccountAlternativeDisplay; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**type** | **string** | Type of the alternative display | null | [optional] [readonly] +**data** | **string** | Data payload of the given alternative display | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccountChannelCode.md b/docs/PaymentRequest/VirtualAccountChannelCode.md new file mode 100644 index 0000000..b54081f --- /dev/null +++ b/docs/PaymentRequest/VirtualAccountChannelCode.md @@ -0,0 +1,13 @@ +# # VirtualAccountChannelCode + + +```php +use Xendit\PaymentRequest\VirtualAccountChannelCode; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccountChannelProperties.md b/docs/PaymentRequest/VirtualAccountChannelProperties.md new file mode 100644 index 0000000..9af2123 --- /dev/null +++ b/docs/PaymentRequest/VirtualAccountChannelProperties.md @@ -0,0 +1,17 @@ +# # VirtualAccountChannelProperties + + +```php +use Xendit\PaymentRequest\VirtualAccountChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**customer_name** | **string** | Name of customer. | Rika Sutanto | +**virtual_account_number** | **string** | You can assign specific Virtual Account number using this parameter. If you do not send one, one will be picked at random. Make sure the number you specify is within your Virtual Account range. | 262159999999999 | [optional] +**expires_at** | **\DateTime** | The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. | 2022-01-01T00:00Z | [optional] +**suggested_amount** | **float** | The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) | 100000 | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/PaymentRequest/VirtualAccountParameters.md b/docs/PaymentRequest/VirtualAccountParameters.md new file mode 100644 index 0000000..2a5c295 --- /dev/null +++ b/docs/PaymentRequest/VirtualAccountParameters.md @@ -0,0 +1,20 @@ +# # VirtualAccountParameters + + +```php +use Xendit\PaymentRequest\VirtualAccountParameters; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**min_amount** | **float** | | null | [optional] +**max_amount** | **float** | | null | [optional] +**amount** | **float** | | null | [optional] +**currency** | [**PaymentRequestCurrency**](PaymentRequestCurrency.md) | | null | [optional] +**channel_code** | [**VirtualAccountChannelCode**](VirtualAccountChannelCode.md) | | null | +**channel_properties** | [**VirtualAccountChannelProperties**](VirtualAccountChannelProperties.md) | | null | +**alternative_display_types** | **string[]** | Alternative display requested for the virtual account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout.yaml b/docs/Payout.yaml new file mode 100644 index 0000000..8d8418c --- /dev/null +++ b/docs/Payout.yaml @@ -0,0 +1,836 @@ +openapi: 3.0.0 +info: + contact: + email: help@xendit.co + description: "This API allows Xendit to send money from an account to a channel\ + \ (banks, eWallets, retail outlets) from across regions" + license: + name: UNLICENSED + url: https://xendit.co/en/terms-and-conditions/ + termsOfService: https://xendit.co/en/terms-and-conditions/ + title: Payout Service + version: 1.0.0 +externalDocs: + description: Find out more + url: https://developers.xendit.co/api-reference/#payouts +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /v2/payouts: + get: + operationId: getPayouts + parameters: + - description: Reference_id provided when creating the payout + explode: true + in: query + name: reference_id + required: true + schema: + example: DISB-123 + type: string + style: form + - description: Number of records to fetch per API call + explode: true + in: query + name: limit + required: false + schema: + example: 10 + type: number + style: form + - description: Used to fetch record after this payout unique id + explode: true + in: query + name: after_id + required: false + schema: + example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + type: string + style: form + - description: Used to fetch record before this payout unique id + explode: true + in: query + name: before_id + required: false + schema: + example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + type: string + style: form + responses: + "200": + content: + application/json: + examples: + With matching payouts: + value: + data: + - id: disb-5594002a-d0a0-4cd9-b3f7-f5992abc8e48 + reference_id: DISB-001 + channel_code: PH_BDO + channel_properties: + account_holder_name: John Doe + account_number: "000000" + description: FX1234 + currency: PHP + amount: 15000.05 + receipt_notification: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + email_bcc: + - user_bcc@example.com + metadata: + external_party: xendit + created: 2019-11-01T12:34:56.007Z + updated: 2019-11-01T12:34:56.007Z + business_id: 5dbf20d7c8eb0c0896f811b6 + status: ACCEPTED + estimated_arrival_time: 2019-11-01T12:34:56.007Z + has_more: false + schema: + $ref: '#/components/schemas/getPayouts_200_response' + description: An array of Payout objects sorted by created time in desc order. + "data" will be an empty array and "has_more' will be equal to false when + there are no matching data. + "403": + content: + application/json: + example: + error_code: REQUEST_FORBIDDEN_ERROR + message: The API key is forbidden to perform this request. + schema: + $ref: '#/components/schemas/Error' + description: API key in use does not have necessary permissions to perform + the request. Please assign proper permissions for the key. + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: API to retrieve all matching payouts with reference ID + tags: + - payout + post: + operationId: createPayout + parameters: + - description: A unique key to prevent duplicate requests from pushing through + our system. No expiration. + explode: false + in: header + name: idempotency-key + required: true + schema: + example: DISB-1234 + type: string + style: simple + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5dbf20d7c8eb0c0896f811b6 + type: string + style: simple + requestBody: + content: + application/json: + examples: + Bank or EWallet Payout: + value: + reference_id: DISB-001 + currency: PHP + channel_code: PH_BDO + channel_properties: + account_holder_name: John Doe + account_number: "000000" + amount: 90000 + description: Test Bank Payout + type: DIRECT_DISBURSEMENT + schema: + $ref: '#/components/schemas/CreatePayoutRequest' + responses: + "200": + content: + application/json: + examples: + Successfully created payout: + value: + id: disb-5594002a-d0a0-4cd9-b3f7-f5992abc8e48 + reference_id: DISB-001 + channel_code: PH_BDO + channel_properties: + account_holder_name: John Doe + account_number: "000000" + description: FX1234 + currency: PHP + amount: 15000.05 + receipt_notification: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + email_bcc: + - user_bcc@example.com + metadata: + external_party: xendit + created: 2019-11-01T12:34:56.007Z + updated: 2019-11-01T12:34:56.007Z + business_id: 5dbf20d7c8eb0c0896f811b6 + status: ACCEPTED + estimated_arrival_time: 2019-11-01T12:34:56.007Z + schema: + $ref: '#/components/schemas/getPayouts_200_response_data_inner' + description: Created payout + "400": + content: + application/json: + examples: + Missing parameters or invalid headers: + value: + error_code: API_VALIDATION_ERROR + message: Should have required property "xxx" + Amount has more than 2 decimal places: + value: + error_code: API_VALIDATION_ERROR + message: '"amount" should have 2 decimal places or less' + Channel code not supported yet: + value: + error_code: CHANNEL_CODE_NOT_SUPPORTED + message: “channel_code” is not supported. See list of supported + channel codes at /payouts_channels. + Minimum transfer limit error per channel: + value: + error_code: MINIMUM_TRANSFER_LIMIT_ERROR + message: “amount” is under the minimum amount supported for the + channel. See amount limitations at the URL below. + Maximum transfer limit error per channel: + value: + error_code: MAXIMUM_TRANSFER_LIMIT_ERROR + message: “amount” is more than the maximum amount supported for + the channel. See amount limitations at the URL below. + Amount Increment Not Supported: + value: + error_code: AMOUNT_INCREMENT_NOT_SUPPORTED + message: amount” needs to be a multiple of the minimum increment + supported by the channel. + schema: + $ref: '#/components/schemas/Error' + description: "Error when creating payout, see error_code for more details" + "401": + content: + application/json: + example: + error_code: INVALID_API_KEY + message: API key format is invalid. + schema: + $ref: '#/components/schemas/Error' + description: Invalid API key + "403": + content: + application/json: + example: + error_code: REQUEST_FORBIDDEN_ERROR + message: The API key is forbidden to perform this request. + schema: + $ref: '#/components/schemas/Error' + description: API key in use does not have necessary permissions to perform + the request. Please assign proper permissions for the key. + "409": + content: + application/json: + example: + error_code: DUPLICATE_ERROR + message: "A payout with this idempotency key already exists. If you\ + \ meant to execute a different request, please use another idempotency\ + \ key." + schema: + $ref: '#/components/schemas/Error' + description: "Duplicate Error, payout already exists" + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: API to send money at scale to bank accounts & eWallets + tags: + - payout + /v2/payouts/{id}: + get: + operationId: getPayoutById + parameters: + - description: Payout id returned from the response of /v2/payouts + explode: false + in: path + name: id + required: true + schema: + example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + With matching payout: + value: + id: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + reference_id: DISB-001 + channel_code: PH_BDO + channel_properties: + account_holder_name: John Doe + account_number: "000000" + description: FX1234 + currency: PHP + amount: 15000.05 + receipt_notification: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + email_bcc: + - user_bcc@example.com + metadata: + external_party: xendit + created: 2019-11-01T12:34:56.007Z + updated: 2019-11-01T12:34:56.007Z + business_id: 5dbf20d7c8eb0c0896f811b6 + status: ACCEPTED + estimated_arrival_time: 2019-11-01T12:34:56.007Z + schema: + $ref: '#/components/schemas/getPayouts_200_response_data_inner' + description: The Payout object + "401": + content: + application/json: + example: + error_code: INVALID_API_KEY + message: API key format is invalid. + schema: + $ref: '#/components/schemas/Error' + description: Invalid API key + "403": + content: + application/json: + example: + error_code: REQUEST_FORBIDDEN_ERROR + message: The API key is forbidden to perform this request. + schema: + $ref: '#/components/schemas/Error' + description: API key in use does not have necessary permissions to perform + the request. Please assign proper permissions for the key. + "404": + content: + application/json: + example: + error_code: DATA_NOT_FOUND + message: Could not find payout with the corresponding ID. Please try + again with a valid ID. + schema: + $ref: '#/components/schemas/Error' + description: Payout Not Found + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: "API to fetch the current status, or details of the payout" + tags: + - payout + /payouts_channels: + get: + operationId: getPayoutChannels + parameters: + - description: Filter channels by currency from ISO-4217 values + explode: true + in: query + name: currency + required: false + schema: + example: "IDR, PHP" + type: string + style: form + - allowReserved: true + description: Filter channels by category + explode: false + in: query + name: channel_category + required: false + schema: + items: + $ref: '#/components/schemas/ChannelCategory' + type: array + style: form + - description: "Filter channels by channel code, prefixed by ISO-3166 country\ + \ code" + explode: true + in: query + name: channel_code + required: false + schema: + example: "ID_MANDIRI, PH_GCASH" + type: string + style: form + responses: + "200": + content: + application/json: + schema: + example: + - channel_code: ID_MANDIRI + channel_category: BANK + currency: IDR + name: Bank Mandiri + amount_limits: + minimum: "1," + maximum: "5000000," + minimum_increment: 1 + - channel_code: PH_GCASH + channel_category: BANK + currency: PHP + name: GCASH + amount_limits: + minimum: "1," + maximum: "50000," + minimum_increment: 0.01 + items: + $ref: '#/components/schemas/Channel' + type: array + description: Current list of banks and e-wallets supported for payouts for + all regions + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: API providing the current list of banks and e-wallets we support for + payouts for both regions + tags: + - payout + /v2/payouts/{id}/cancel: + post: + operationId: cancelPayout + parameters: + - description: Payout id returned from the response of /v2/payouts + explode: false + in: path + name: id + required: true + schema: + example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + For API Gateway: + value: + id: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 + reference_id: DISB-001 + channel_code: PH_BDO + channel_properties: + account_holder_name: John Doe + account_number: "000000" + description: FX1234 + currency: PHP + amount: 15000.05 + receipt_notification: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + email_bcc: + - user_bcc@example.com + metadata: + external_party: xendit + created: 2019-11-01T12:34:56.007Z + updated: 2019-11-01T12:34:56.007Z + business_id: 5dbf20d7c8eb0c0896f811b6 + status: CANCELLED + schema: + $ref: '#/components/schemas/getPayouts_200_response_data_inner' + description: Cancelled Successfully + "400": + content: + application/json: + example: + error_code: CANCELLATION_NOT_ALLOWED + message: Payout cannot be canceled because it has already been processed + by Xendit. + schema: + $ref: '#/components/schemas/Error' + description: Unable to Cancel + "404": + content: + application/json: + example: + error_code: DATA_NOT_FOUND + message: Could not find payout with the corresponding ID. Please try + again with a valid ID + schema: + $ref: '#/components/schemas/Error' + description: Invalid Payout ID + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Errors + summary: API to cancel requested payouts that have not yet been sent to partner + banks and e-wallets. Cancellation is possible if the payout has not been sent + out via our partner and when payout status is ACCEPTED. + tags: + - payout +components: + schemas: + ReceiptNotification: + description: Additional notification for completed payout + example: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_bcc: + - user_bcc@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + properties: + email_to: + description: Valid email address to send the payout receipt + example: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + items: + format: email + maxItems: 3 + type: string + nullable: true + type: array + email_cc: + description: Valid email address to cc the payout receipt + example: + - user_cc@example.com + - user_cc2@example.com + items: + format: email + maxItems: 3 + type: string + nullable: true + type: array + email_bcc: + description: Valid email address to bcc the payout receipt + example: + - user_bcc@example.com + items: + format: email + maxItems: 3 + type: string + nullable: true + type: array + type: object + Error: + properties: + error_code: + description: "Specific error encountered when processing the request, can\ + \ refer to the API documentation on proper handling of each available\ + \ error code https://developers.xendit.co/api-reference/#payouts" + example: SERVER_ERROR + type: string + message: + description: Human readable error message + type: string + errors: + items: + $ref: '#/components/schemas/Error_errors_inner' + type: array + required: + - error_code + - message + type: object + ChannelAccountType: + description: Available account types (applicable for MY_DUITNOW) + enum: + - NATIONAL_ID + - MOBILE_NO + - PASSPORT + - BUSINESS_REGISTRATION + - BANK_ACCOUNT + type: string + ChannelCategory: + description: "Category of channel code, as some channels might require more\ + \ fields during processing" + enum: + - BANK + - EWALLET + example: BANK + type: string + Channel: + description: Channel information where you can send the money to + properties: + channel_code: + description: "Destination channel to send the money to, prefixed by ISO-3166\ + \ country code" + example: ID_MANDIRI + type: string + channel_category: + $ref: '#/components/schemas/ChannelCategory' + currency: + description: Currency of the destination channel using ISO-4217 currency + code + example: IDR + type: string + channel_name: + description: Name of the destination channel + example: Bank Mandiri + type: string + amount_limits: + $ref: '#/components/schemas/Channel_amount_limits' + required: + - amount_limits + - channel_category + - channel_code + - channel_name + - currency + type: object + DigitalPayoutChannelProperties: + description: "Channel information for digital destinations (banks, e-wallets)" + example: + account_number: "9999999999" + account_type: null + account_holder_name: Adam Gilcrist + properties: + account_holder_name: + description: Registered account name + example: Adam Gilcrist + nullable: true + type: string + account_number: + description: Registered account number + example: "9999999999" + type: string + account_type: + $ref: '#/components/schemas/ChannelAccountType' + required: + - account_number + type: object + CreatePayoutRequest: + description: Information needed by Xendit to send money to the destination channel + provided + example: + amount: 15000.05 + metadata: + external_party: xendit + reference_id: DISB-001 + receipt_notification: + email_to: + - user_to@example.com + - user_to2@example.com + - user_to3@example.com + email_bcc: + - user_bcc@example.com + email_cc: + - user_cc@example.com + - user_cc2@example.com + description: Cashback 2020 + channel_properties: + account_number: "9999999999" + account_type: null + account_holder_name: Adam Gilcrist + currency: PHP + channel_code: PH_BDO + properties: + reference_id: + description: A client defined payout identifier + example: DISB-001 + minLength: 1 + type: string + channel_code: + description: Channel code of selected destination bank or e-wallet + example: PH_BDO + type: string + channel_properties: + $ref: '#/components/schemas/DigitalPayoutChannelProperties' + amount: + description: Amount to be sent to the destination account and should be + a multiple of the minimum increment for the selected channel + example: 15000.05 + type: number + description: + description: "Description to send with the payout, the recipient may see\ + \ this e.g., in their bank statement (if supported) or in email receipts\ + \ we send on your behalf" + example: Cashback 2020 + type: string + currency: + description: Currency of the destination channel using ISO-4217 currency + code + example: PHP + type: string + receipt_notification: + $ref: '#/components/schemas/ReceiptNotification' + metadata: + description: Object of additional information you may use + example: + external_party: xendit + type: object + required: + - amount + - channel_code + - channel_properties + - currency + - reference_id + type: object + Payout: + allOf: + - $ref: '#/components/schemas/CreatePayoutRequest' + - $ref: '#/components/schemas/Payout_allOf' + getPayouts_200_response_data_inner: + anyOf: + - $ref: '#/components/schemas/Payout' + getPayouts_200_response_links: + example: + method: method + rel: rel + href: href + properties: + href: + type: string + rel: + type: string + method: + type: string + type: object + getPayouts_200_response: + example: + data: + - null + - null + links: + method: method + rel: rel + href: href + has_more: true + properties: + data: + items: + $ref: '#/components/schemas/getPayouts_200_response_data_inner' + type: array + has_more: + type: boolean + links: + $ref: '#/components/schemas/getPayouts_200_response_links' + type: object + Error_errors_inner: + properties: + path: + description: Precise location of the error + type: string + message: + description: Specific description of the error + type: string + required: + - message + - path + type: object + Channel_amount_limits: + description: Supported amount ranges for payouts to this channel + properties: + minimum: + description: Lowest amount supported for a payout to this channel + example: 1 + type: number + maximum: + description: Highest amount supported for a payout to this channel + example: 50000000 + type: number + minimum_increment: + description: Supported increments + example: 1 + type: number + required: + - maximum + - minimum + - minimum_increment + type: object + Payout_allOf: + properties: + id: + description: Xendit-generated unique identifier for each payout + example: disb_4203234e-48f5-11eb-b378-0242ac130002 + type: string + created: + description: "The time payout was created on Xendit's system, in ISO 8601\ + \ format" + example: 2019-11-01T12:34:56.007Z + format: date-time + type: string + updated: + description: "The time payout was last updated on Xendit's system, in ISO\ + \ 8601 format" + example: 2019-11-01T12:34:56.007Z + format: date-time + type: string + business_id: + description: Xendit Business ID + example: 4203234e-48f5-11eb-b378-0242ac130002 + type: string + status: + description: Status of payout + enum: + - SUCCEEDED + - FAILED + - ACCEPTED + - REQUESTED + - LOCKED + - CANCELLED + - REVERSED + example: ACCEPTED + type: string + failure_code: + description: "If the Payout failed, we include a failure code for more details\ + \ on the failure." + enum: + - INSUFFICIENT_BALANCE + - REJECTED_BY_CHANNEL + - TEMPORARY_TRANSFER_ERROR + - INVALID_DESTINATION + - TRANSFER_ERROR + type: string + estimated_arrival_time: + description: Our estimated time on to when your payout is reflected to the + destination account + format: date-time + type: string + required: + - business_id + - created + - id + - status + - updated + type: object + example: null diff --git a/docs/Payout/Channel.md b/docs/Payout/Channel.md new file mode 100644 index 0000000..dc751dd --- /dev/null +++ b/docs/Payout/Channel.md @@ -0,0 +1,18 @@ +# # Channel + + +```php +use Xendit\Payout\Channel; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**channel_code** | **string** | Destination channel to send the money to, prefixed by ISO-3166 country code | ID_MANDIRI | +**channel_category** | [**ChannelCategory**](ChannelCategory.md) | | null | +**currency** | **string** | Currency of the destination channel using ISO-4217 currency code | IDR | +**channel_name** | **string** | Name of the destination channel | Bank Mandiri | +**amount_limits** | [**ChannelAmountLimits**](ChannelAmountLimits.md) | | null | + +[[Back to README]](../../README.md) diff --git a/docs/Payout/ChannelAccountType.md b/docs/Payout/ChannelAccountType.md new file mode 100644 index 0000000..8bf46ec --- /dev/null +++ b/docs/Payout/ChannelAccountType.md @@ -0,0 +1,13 @@ +# # ChannelAccountType + + +```php +use Xendit\Payout\ChannelAccountType; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Payout/ChannelAmountLimits.md b/docs/Payout/ChannelAmountLimits.md new file mode 100644 index 0000000..0e89eb9 --- /dev/null +++ b/docs/Payout/ChannelAmountLimits.md @@ -0,0 +1,16 @@ +# # ChannelAmountLimits + + +```php +use Xendit\Payout\ChannelAmountLimits; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**minimum** | **float** | Lowest amount supported for a payout to this channel | 1 | +**maximum** | **float** | Highest amount supported for a payout to this channel | 50000000 | +**minimum_increment** | **float** | Supported increments | 1 | + +[[Back to README]](../../README.md) diff --git a/docs/Payout/ChannelCategory.md b/docs/Payout/ChannelCategory.md new file mode 100644 index 0000000..098fcd8 --- /dev/null +++ b/docs/Payout/ChannelCategory.md @@ -0,0 +1,13 @@ +# # ChannelCategory + + +```php +use Xendit\Payout\ChannelCategory; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- + +[[Back to README]](../../README.md) diff --git a/docs/Payout/CreatePayoutRequest.md b/docs/Payout/CreatePayoutRequest.md new file mode 100644 index 0000000..975e3e9 --- /dev/null +++ b/docs/Payout/CreatePayoutRequest.md @@ -0,0 +1,21 @@ +# # CreatePayoutRequest + + +```php +use Xendit\Payout\CreatePayoutRequest; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | A client defined payout identifier | DISB-001 | +**channel_code** | **string** | Channel code of selected destination bank or e-wallet | PH_BDO | +**channel_properties** | [**DigitalPayoutChannelProperties**](DigitalPayoutChannelProperties.md) | | null | +**amount** | **float** | Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel | 15000.05 | +**description** | **string** | Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf | Cashback 2020 | [optional] +**currency** | **string** | Currency of the destination channel using ISO-4217 currency code | PHP | +**receipt_notification** | [**ReceiptNotification**](ReceiptNotification.md) | | null | [optional] +**metadata** | **object** | Object of additional information you may use | {"external_party":"xendit"} | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/DigitalPayoutChannelProperties.md b/docs/Payout/DigitalPayoutChannelProperties.md new file mode 100644 index 0000000..61726be --- /dev/null +++ b/docs/Payout/DigitalPayoutChannelProperties.md @@ -0,0 +1,16 @@ +# # DigitalPayoutChannelProperties + + +```php +use Xendit\Payout\DigitalPayoutChannelProperties; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**account_holder_name** | **string** | Registered account name | Adam Gilcrist | [optional] +**account_number** | **string** | Registered account number | 9999999999 | +**account_type** | [**ChannelAccountType**](ChannelAccountType.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/Error.md b/docs/Payout/Error.md new file mode 100644 index 0000000..17440b9 --- /dev/null +++ b/docs/Payout/Error.md @@ -0,0 +1,16 @@ +# # Error + + +```php +use Xendit\Payout\Error; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | Specific error encountered when processing the request, can refer to the API documentation on proper handling of each available error code https://developers.xendit.co/api-reference/#payouts | SERVER_ERROR | +**message** | **string** | Human readable error message | null | +**errors** | [**array**](ErrorErrorsInner.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/ErrorErrorsInner.md b/docs/Payout/ErrorErrorsInner.md new file mode 100644 index 0000000..18e82ef --- /dev/null +++ b/docs/Payout/ErrorErrorsInner.md @@ -0,0 +1,15 @@ +# # ErrorErrorsInner + + +```php +use Xendit\Payout\ErrorErrorsInner; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**path** | **string** | Precise location of the error | null | +**message** | **string** | Specific description of the error | null | + +[[Back to README]](../../README.md) diff --git a/docs/Payout/GetPayouts200Response.md b/docs/Payout/GetPayouts200Response.md new file mode 100644 index 0000000..7b1ff42 --- /dev/null +++ b/docs/Payout/GetPayouts200Response.md @@ -0,0 +1,16 @@ +# # GetPayouts200Response + + +```php +use Xendit\Payout\GetPayouts200Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](GetPayouts200ResponseDataInner.md) | | null | [optional] +**has_more** | **bool** | | null | [optional] +**links** | [**GetPayouts200ResponseLinks**](GetPayouts200ResponseLinks.md) | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/GetPayouts200ResponseDataInner.md b/docs/Payout/GetPayouts200ResponseDataInner.md new file mode 100644 index 0000000..8ccbf5e --- /dev/null +++ b/docs/Payout/GetPayouts200ResponseDataInner.md @@ -0,0 +1,28 @@ +# # GetPayouts200ResponseDataInner + + +```php +use Xendit\Payout\GetPayouts200ResponseDataInner; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | A client defined payout identifier | DISB-001 | +**channel_code** | **string** | Channel code of selected destination bank or e-wallet | PH_BDO | +**channel_properties** | [**DigitalPayoutChannelProperties**](DigitalPayoutChannelProperties.md) | | null | +**amount** | **float** | Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel | 15000.05 | +**description** | **string** | Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf | Cashback 2020 | [optional] +**currency** | **string** | Currency of the destination channel using ISO-4217 currency code | PHP | +**receipt_notification** | [**ReceiptNotification**](ReceiptNotification.md) | | null | [optional] +**metadata** | **object** | Object of additional information you may use | {"external_party":"xendit"} | [optional] +**id** | **string** | Xendit-generated unique identifier for each payout | disb_4203234e-48f5-11eb-b378-0242ac130002 | +**created** | **\DateTime** | The time payout was created on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**updated** | **\DateTime** | The time payout was last updated on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**business_id** | **string** | Xendit Business ID | 4203234e-48f5-11eb-b378-0242ac130002 | +**status** | **string** | Status of payout | ACCEPTED | +**failure_code** | **string** | If the Payout failed, we include a failure code for more details on the failure. | null | [optional] +**estimated_arrival_time** | **\DateTime** | Our estimated time on to when your payout is reflected to the destination account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/GetPayouts200ResponseLinks.md b/docs/Payout/GetPayouts200ResponseLinks.md new file mode 100644 index 0000000..cc0a991 --- /dev/null +++ b/docs/Payout/GetPayouts200ResponseLinks.md @@ -0,0 +1,16 @@ +# # GetPayouts200ResponseLinks + + +```php +use Xendit\Payout\GetPayouts200ResponseLinks; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**href** | **string** | | null | [optional] +**rel** | **string** | | null | [optional] +**method** | **string** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/Payout.md b/docs/Payout/Payout.md new file mode 100644 index 0000000..8a016d5 --- /dev/null +++ b/docs/Payout/Payout.md @@ -0,0 +1,28 @@ +# # Payout + + +```php +use Xendit\Payout\Payout; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**reference_id** | **string** | A client defined payout identifier | DISB-001 | +**channel_code** | **string** | Channel code of selected destination bank or e-wallet | PH_BDO | +**channel_properties** | [**DigitalPayoutChannelProperties**](DigitalPayoutChannelProperties.md) | | null | +**amount** | **float** | Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel | 15000.05 | +**description** | **string** | Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf | Cashback 2020 | [optional] +**currency** | **string** | Currency of the destination channel using ISO-4217 currency code | PHP | +**receipt_notification** | [**ReceiptNotification**](ReceiptNotification.md) | | null | [optional] +**metadata** | **object** | Object of additional information you may use | {"external_party":"xendit"} | [optional] +**id** | **string** | Xendit-generated unique identifier for each payout | disb_4203234e-48f5-11eb-b378-0242ac130002 | +**created** | **\DateTime** | The time payout was created on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**updated** | **\DateTime** | The time payout was last updated on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**business_id** | **string** | Xendit Business ID | 4203234e-48f5-11eb-b378-0242ac130002 | +**status** | **string** | Status of payout | ACCEPTED | +**failure_code** | **string** | If the Payout failed, we include a failure code for more details on the failure. | null | [optional] +**estimated_arrival_time** | **\DateTime** | Our estimated time on to when your payout is reflected to the destination account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/PayoutAllOf.md b/docs/Payout/PayoutAllOf.md new file mode 100644 index 0000000..7bf0fad --- /dev/null +++ b/docs/Payout/PayoutAllOf.md @@ -0,0 +1,20 @@ +# # PayoutAllOf + + +```php +use Xendit\Payout\PayoutAllOf; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | Xendit-generated unique identifier for each payout | disb_4203234e-48f5-11eb-b378-0242ac130002 | +**created** | **\DateTime** | The time payout was created on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**updated** | **\DateTime** | The time payout was last updated on Xendit's system, in ISO 8601 format | 2019-11-01T12:34:56.007Z | +**business_id** | **string** | Xendit Business ID | 4203234e-48f5-11eb-b378-0242ac130002 | +**status** | **string** | Status of payout | ACCEPTED | +**failure_code** | **string** | If the Payout failed, we include a failure code for more details on the failure. | null | [optional] +**estimated_arrival_time** | **\DateTime** | Our estimated time on to when your payout is reflected to the destination account | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Payout/PayoutApi.md b/docs/Payout/PayoutApi.md new file mode 100644 index 0000000..1639017 --- /dev/null +++ b/docs/Payout/PayoutApi.md @@ -0,0 +1,281 @@ +# Xendit\PayoutApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelPayout()**](PayoutApi.md#cancelPayout) | **POST** /v2/payouts/{id}/cancel | API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. | +| [**createPayout()**](PayoutApi.md#createPayout) | **POST** /v2/payouts | API to send money at scale to bank accounts & eWallets | +| [**getPayoutById()**](PayoutApi.md#getPayoutById) | **GET** /v2/payouts/{id} | API to fetch the current status, or details of the payout | +| [**getPayoutChannels()**](PayoutApi.md#getPayoutChannels) | **GET** /payouts_channels | API providing the current list of banks and e-wallets we support for payouts for both regions | +| [**getPayouts()**](PayoutApi.md#getPayouts) | **GET** /v2/payouts | API to retrieve all matching payouts with reference ID | + + +## `cancelPayout()` + +```php +cancelPayout($id): \Payout\GetPayouts200ResponseDataInner +``` + +API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + +### Example + +```php +cancelPayout($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PayoutApi->cancelPayout: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Payout id returned from the response of /v2/payouts | | + +### Return type + +[**\Xendit\Payout\GetPayouts200ResponseDataInner**](GetPayouts200ResponseDataInner.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `createPayout()` + +```php +createPayout($idempotency_key, $for_user_id, $create_payout_request): \Payout\GetPayouts200ResponseDataInner +``` + +API to send money at scale to bank accounts & eWallets + +### Example + +```php +createPayout($idempotency_key, $for_user_id, $create_payout_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PayoutApi->createPayout: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **idempotency_key** | **string**| A unique key to prevent duplicate requests from pushing through our system. No expiration. | | +| **for_user_id** | **string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. | [optional] | +| **create_payout_request** | [**CreatePayoutRequest**](CreatePayoutRequest.md)| | [optional] | + +### Return type + +[**\Xendit\Payout\GetPayouts200ResponseDataInner**](GetPayouts200ResponseDataInner.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPayoutById()` + +```php +getPayoutById($id): \Payout\GetPayouts200ResponseDataInner +``` + +API to fetch the current status, or details of the payout + +### Example + +```php +getPayoutById($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PayoutApi->getPayoutById: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| Payout id returned from the response of /v2/payouts | | + +### Return type + +[**\Xendit\Payout\GetPayouts200ResponseDataInner**](GetPayouts200ResponseDataInner.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPayoutChannels()` + +```php +getPayoutChannels($currency, $channel_category, $channel_code): \Payout\Channel[] +``` + +API providing the current list of banks and e-wallets we support for payouts for both regions + +### Example + +```php +getPayoutChannels($currency, $channel_category, $channel_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PayoutApi->getPayoutChannels: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **currency** | **string**| Filter channels by currency from ISO-4217 values | [optional] | +| **channel_category** | [**ChannelCategory**](ChannelCategory.md)| Filter channels by category | [optional] | +| **channel_code** | **string**| Filter channels by channel code, prefixed by ISO-3166 country code | [optional] | + +### Return type + +[**\Xendit\Payout\Channel[]**](Channel.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getPayouts()` + +```php +getPayouts($reference_id, $limit, $after_id, $before_id): \Payout\GetPayouts200Response +``` + +API to retrieve all matching payouts with reference ID + +### Example + +```php +getPayouts($reference_id, $limit, $after_id, $before_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PayoutApi->getPayouts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **reference_id** | **string**| Reference_id provided when creating the payout | | +| **limit** | **float**| Number of records to fetch per API call | [optional] | +| **after_id** | **string**| Used to fetch record after this payout unique id | [optional] | +| **before_id** | **string**| Used to fetch record before this payout unique id | [optional] | + +### Return type + +[**\Xendit\Payout\GetPayouts200Response**](GetPayouts200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/Payout/ReceiptNotification.md b/docs/Payout/ReceiptNotification.md new file mode 100644 index 0000000..d80e857 --- /dev/null +++ b/docs/Payout/ReceiptNotification.md @@ -0,0 +1,16 @@ +# # ReceiptNotification + + +```php +use Xendit\Payout\ReceiptNotification; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**email_to** | **string[]** | Valid email address to send the payout receipt | ["user_to@example.com","user_to2@example.com","user_to3@example.com"] | [optional] +**email_cc** | **string[]** | Valid email address to cc the payout receipt | ["user_cc@example.com","user_cc2@example.com"] | [optional] +**email_bcc** | **string[]** | Valid email address to bcc the payout receipt | ["user_bcc@example.com"] | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund.yaml b/docs/Refund.yaml new file mode 100644 index 0000000..93d8e42 --- /dev/null +++ b/docs/Refund.yaml @@ -0,0 +1,479 @@ +openapi: 3.0.0 +info: + description: This API is used for the unified refund service + title: Refund Service + version: 1.2.3 +servers: +- description: Xendit API Server + url: https://api.xendit.co +paths: + /refunds: + post: + operationId: createRefund + parameters: + - explode: false + in: header + name: idempotency-key + required: false + schema: + example: 9797b5a6-54ad-4511-80a4-ec451346808b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRefund' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Refund' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_404_response' + description: Data not found + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_409_response' + description: Request causes conflict + "503": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_503_response' + description: Service is unavailable due to dependencies + default: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_default_response' + description: Internal server error + tags: + - refund + /refunds/{refundID}: + get: + operationId: getRefund + parameters: + - explode: false + in: path + name: refundID + required: true + schema: + example: rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + - explode: false + in: header + name: idempotency-key + required: false + schema: + example: 9797b5a6-54ad-4511-80a4-ec451346808b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Refund' + description: OK + default: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_default_response' + description: Internal server error + tags: + - refund + /refunds/{refundID}/cancel: + post: + operationId: cancelRefund + parameters: + - explode: false + in: path + name: refundID + required: true + schema: + example: rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + - explode: false + in: header + name: idempotency-key + required: false + schema: + example: 9797b5a6-54ad-4511-80a4-ec451346808b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Refund' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_400_response' + description: Bad request + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_403_response' + description: Forbidden due to permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_404_response' + description: Data not found + default: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_default_response' + description: Internal server error + tags: + - refund + /refunds/: + get: + operationId: getAllRefunds + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RefundList' + description: OK + default: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_default_response' + description: Internal server error + tags: + - refund +components: + parameters: + RefundID: + explode: false + in: path + name: refundID + required: true + schema: + example: rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822 + type: string + style: simple + IdempotencyKey: + explode: false + in: header + name: idempotency-key + required: false + schema: + example: 9797b5a6-54ad-4511-80a4-ec451346808b + type: string + style: simple + responses: + InternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_default_response' + description: Internal server error + StatusBadRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_400_response' + description: Bad request + StatusForbidden: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_403_response' + description: Forbidden due to permissions + StatusNotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_404_response' + description: Data not found + StatusConflict: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_409_response' + description: Request causes conflict + StatusServiceUnavailable: + content: + application/json: + schema: + $ref: '#/components/schemas/createRefund_503_response' + description: Service is unavailable due to dependencies + schemas: + Refund: + example: + country: PH + amount: 1500 + failure_code: REFUND_FAILED + metadata: "{}" + reference_id: order-1234 + refund_fee_amount: 0.8008281904610115 + created: 2023-01-24T07:05:07.859363326Z + currency: PHP + id: rfd-3ece8615-41b7-4983-a3f0-a037430b6036 + payment_request_id: pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee + channel_code: SHOPEEPAY + updated: 2023-01-24T07:05:07.859363326Z + properties: + id: + example: rfd-3ece8615-41b7-4983-a3f0-a037430b6036 + type: string + payment_request_id: + example: pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee + type: string + amount: + example: 1500 + format: double + type: number + channel_code: + example: SHOPEEPAY + type: string + country: + example: PH + type: string + currency: + example: PHP + type: string + reference_id: + example: order-1234 + nullable: true + type: string + failure_code: + example: REFUND_FAILED + nullable: true + type: string + refund_fee_amount: + format: double + nullable: true + type: number + example: null + created: + example: 2023-01-24T07:05:07.859363326Z + type: string + updated: + example: 2023-01-24T07:05:07.859363326Z + type: string + metadata: + nullable: true + type: object + example: null + type: object + RefundList: + example: + data: + - id: rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822' + payment_request_id: pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee + amount: 1500 + channel_code: SHOPEEPAY + country: PH + currency: PHP + reference_id: order-1234 + failure_code: null + refund_fee_amount: null + created: 2023-01-24T07:05:07.859363326Z + updated: 2023-01-24T07:05:07.859363326Z + metadata: null + - id: rfd-db61bc21-8686-49d9-9be1-168cbf45d83f' + payment_request_id: pr-3af41122-a608-4356-a0fe-1f67f5cf4637 + amount: 1500 + channel_code: GRABPAY + country: PH + currency: PHP + reference_id: order-5678 + failure_code: null + refund_fee_amount: null + created: 2023-01-24T07:05:07.859363326Z + updated: 2023-01-24T07:05:07.859363326Z + metadata: null + has_more: false + nullable: false + properties: + data: + example: + - id: rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822' + payment_request_id: pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee + amount: 1500 + channel_code: SHOPEEPAY + country: PH + currency: PHP + reference_id: order-1234 + failure_code: null + refund_fee_amount: null + created: 2023-01-24T07:05:07.859363326Z + updated: 2023-01-24T07:05:07.859363326Z + metadata: null + - id: rfd-db61bc21-8686-49d9-9be1-168cbf45d83f' + payment_request_id: pr-3af41122-a608-4356-a0fe-1f67f5cf4637 + amount: 1500 + channel_code: GRABPAY + country: PH + currency: PHP + reference_id: order-5678 + failure_code: null + refund_fee_amount: null + created: 2023-01-24T07:05:07.859363326Z + updated: 2023-01-24T07:05:07.859363326Z + metadata: null + items: + $ref: '#/components/schemas/Refund' + type: array + has_more: + example: false + type: boolean + required: + - data + type: object + CreateRefund: + example: + reason: CANCELLATION + amount: 1500 + metadata: + foo: bar + reference_id: order-1234 + invoice_id: 7a2c81d4f9e052a870bf37d2 + currency: PHP + payment_request_id: pr-3ece8615-41b7-4983-a3f0-a037430b6036 + nullable: false + properties: + payment_request_id: + example: pr-3ece8615-41b7-4983-a3f0-a037430b6036 + type: string + invoice_id: + example: 7a2c81d4f9e052a870bf37d2 + type: string + reference_id: + example: order-1234 + type: string + amount: + example: 1500 + format: double + type: number + currency: + example: PHP + type: string + reason: + enum: + - FRAUDULENT + - DUPLICATE + - REQUESTED_BY_CUSTOMER + - CANCELLATION + - OTHERS + example: CANCELLATION + type: string + metadata: + example: + foo: bar + nullable: true + type: object + type: object + createRefund_400_response: + properties: + error_code: + enum: + - API_VALIDATION_ERROR + - INELIGIBLE_TRANSACTION + - INSUFFICIENT_BALANCE + - MAXIMUM_REFUND_AMOUNT_REACHED + - PARTIAL_REFUND_NOT_SUPPORTED + - REFUND_NOT_SUPPORTED + - TRANSACTION_NOT_FOUND + example: MAXIMUM_REFUND_AMOUNT_REACHED + type: string + message: + example: Error because the provided amount is greater than the allowed refund + amount. + type: string + type: object + createRefund_403_response: + properties: + error_code: + enum: + - UNAUTHORIZED + example: UNAUTHORIZED + type: string + message: + example: No valid API key provided + type: string + type: object + createRefund_404_response: + properties: + error_code: + enum: + - DATA_NOT_FOUND + example: DATA_NOT_FOUND + type: string + message: + example: Data not found + type: string + type: object + createRefund_409_response: + properties: + error_code: + enum: + - DUPLICATE_ERROR + - IDEMPOTENCY_ERROR + example: DUPLICATE_ERROR + type: string + message: + example: "duplicate value on idempotency_key, try again with a new key" + type: string + type: object + createRefund_503_response: + properties: + error_code: + enum: + - CHANNEL_UNAVAILABLE + - OTP_DELIVERY_ERROR + example: CHANNEL_UNAVAILABLE + type: string + message: + example: The payment channel requested is currently experiencing unexpected + issues. + type: string + type: object + createRefund_default_response: + example: + error_code: SERVER_ERROR + message: An unexpected error occured. Our team has been notified and will + troubleshoot the issue. + properties: + error_code: + type: string + message: + example: An unexpected error occured. Our team has been notified and will + troubleshoot the issue. + type: string + type: object diff --git a/docs/Refund/CreateRefund.md b/docs/Refund/CreateRefund.md new file mode 100644 index 0000000..54c4aed --- /dev/null +++ b/docs/Refund/CreateRefund.md @@ -0,0 +1,20 @@ +# # CreateRefund + + +```php +use Xendit\Refund\CreateRefund; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**payment_request_id** | **string** | | pr-3ece8615-41b7-4983-a3f0-a037430b6036 | [optional] +**invoice_id** | **string** | | 7a2c81d4f9e052a870bf37d2 | [optional] +**reference_id** | **string** | | order-1234 | [optional] +**amount** | **float** | | 1500 | [optional] +**currency** | **string** | | PHP | [optional] +**reason** | **string** | | CANCELLATION | [optional] +**metadata** | **object** | | {"foo":"bar"} | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefund400Response.md b/docs/Refund/CreateRefund400Response.md new file mode 100644 index 0000000..b94571a --- /dev/null +++ b/docs/Refund/CreateRefund400Response.md @@ -0,0 +1,15 @@ +# # CreateRefund400Response + + +```php +use Xendit\Refund\CreateRefund400Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | MAXIMUM_REFUND_AMOUNT_REACHED | [optional] +**message** | **string** | | Error because the provided amount is greater than the allowed refund amount. | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefund403Response.md b/docs/Refund/CreateRefund403Response.md new file mode 100644 index 0000000..a149bd4 --- /dev/null +++ b/docs/Refund/CreateRefund403Response.md @@ -0,0 +1,15 @@ +# # CreateRefund403Response + + +```php +use Xendit\Refund\CreateRefund403Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | UNAUTHORIZED | [optional] +**message** | **string** | | No valid API key provided | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefund404Response.md b/docs/Refund/CreateRefund404Response.md new file mode 100644 index 0000000..4be967d --- /dev/null +++ b/docs/Refund/CreateRefund404Response.md @@ -0,0 +1,15 @@ +# # CreateRefund404Response + + +```php +use Xendit\Refund\CreateRefund404Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | DATA_NOT_FOUND | [optional] +**message** | **string** | | Data not found | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefund409Response.md b/docs/Refund/CreateRefund409Response.md new file mode 100644 index 0000000..0330cd1 --- /dev/null +++ b/docs/Refund/CreateRefund409Response.md @@ -0,0 +1,15 @@ +# # CreateRefund409Response + + +```php +use Xendit\Refund\CreateRefund409Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | DUPLICATE_ERROR | [optional] +**message** | **string** | | duplicate value on idempotency_key, try again with a new key | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefund503Response.md b/docs/Refund/CreateRefund503Response.md new file mode 100644 index 0000000..b3c2f8c --- /dev/null +++ b/docs/Refund/CreateRefund503Response.md @@ -0,0 +1,15 @@ +# # CreateRefund503Response + + +```php +use Xendit\Refund\CreateRefund503Response; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | CHANNEL_UNAVAILABLE | [optional] +**message** | **string** | | The payment channel requested is currently experiencing unexpected issues. | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/CreateRefundDefaultResponse.md b/docs/Refund/CreateRefundDefaultResponse.md new file mode 100644 index 0000000..41a6b14 --- /dev/null +++ b/docs/Refund/CreateRefundDefaultResponse.md @@ -0,0 +1,15 @@ +# # CreateRefundDefaultResponse + + +```php +use Xendit\Refund\CreateRefundDefaultResponse; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**error_code** | **string** | | null | [optional] +**message** | **string** | | An unexpected error occured. Our team has been notified and will troubleshoot the issue. | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/Refund.md b/docs/Refund/Refund.md new file mode 100644 index 0000000..c9eb532 --- /dev/null +++ b/docs/Refund/Refund.md @@ -0,0 +1,25 @@ +# # Refund + + +```php +use Xendit\Refund\Refund; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**id** | **string** | | rfd-3ece8615-41b7-4983-a3f0-a037430b6036 | [optional] +**payment_request_id** | **string** | | pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee | [optional] +**amount** | **float** | | 1500 | [optional] +**channel_code** | **string** | | SHOPEEPAY | [optional] +**country** | **string** | | PH | [optional] +**currency** | **string** | | PHP | [optional] +**reference_id** | **string** | | order-1234 | [optional] +**failure_code** | **string** | | REFUND_FAILED | [optional] +**refund_fee_amount** | **float** | | null | [optional] +**created** | **string** | | 2023-01-24T07:05:07.859363326Z | [optional] +**updated** | **string** | | 2023-01-24T07:05:07.859363326Z | [optional] +**metadata** | **object** | | null | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/Refund/RefundApi.md b/docs/Refund/RefundApi.md new file mode 100644 index 0000000..e9f1fe9 --- /dev/null +++ b/docs/Refund/RefundApi.md @@ -0,0 +1,218 @@ +# Xendit\RefundApi + +All URIs are relative to https://api.xendit.co, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelRefund()**](RefundApi.md#cancelRefund) | **POST** /refunds/{refundID}/cancel | | +| [**createRefund()**](RefundApi.md#createRefund) | **POST** /refunds | | +| [**getAllRefunds()**](RefundApi.md#getAllRefunds) | **GET** /refunds/ | | +| [**getRefund()**](RefundApi.md#getRefund) | **GET** /refunds/{refundID} | | + + +## `cancelRefund()` + +```php +cancelRefund($refund_id, $idempotency_key): \Refund\Refund +``` + + + +### Example + +```php +cancelRefund($refund_id, $idempotency_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RefundApi->cancelRefund: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **refund_id** | **string**| | | +| **idempotency_key** | **string**| | [optional] | + +### Return type + +[**\Xendit\Refund\Refund**](Refund.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `createRefund()` + +```php +createRefund($idempotency_key, $create_refund): \Refund\Refund +``` + + + +### Example + +```php +createRefund($idempotency_key, $create_refund); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RefundApi->createRefund: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **idempotency_key** | **string**| | [optional] | +| **create_refund** | [**CreateRefund**](CreateRefund.md)| | [optional] | + +### Return type + +[**\Xendit\Refund\Refund**](Refund.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getAllRefunds()` + +```php +getAllRefunds(): \Refund\RefundList +``` + + + +### Example + +```php +getAllRefunds(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RefundApi->getAllRefunds: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Xendit\Refund\RefundList**](RefundList.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) + +## `getRefund()` + +```php +getRefund($refund_id, $idempotency_key): \Refund\Refund +``` + + + +### Example + +```php +getRefund($refund_id, $idempotency_key); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RefundApi->getRefund: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **refund_id** | **string**| | | +| **idempotency_key** | **string**| | [optional] | + +### Return type + +[**\Xendit\Refund\Refund**](Refund.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to README]](../../README.md) diff --git a/docs/Refund/RefundList.md b/docs/Refund/RefundList.md new file mode 100644 index 0000000..70ba329 --- /dev/null +++ b/docs/Refund/RefundList.md @@ -0,0 +1,15 @@ +# # RefundList + + +```php +use Xendit\Refund\RefundList; +``` + +## Properties + +Name | Type | Description | Examples | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**data** | [**array**](Refund.md) | | [{"id":"rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822'","payment_request_id":"pr-f4a6f77c-4835-4630-9617-2cdc34ee26ee","amount":1500,"channel_code":"SHOPEEPAY","country":"PH","currency":"PHP","reference_id":"order-1234","failure_code":null,"refund_fee_amount":null,"created":"2023-01-24T07:05:07.859363326Z","updated":"2023-01-24T07:05:07.859363326Z","metadata":null},{"id":"rfd-db61bc21-8686-49d9-9be1-168cbf45d83f'","payment_request_id":"pr-3af41122-a608-4356-a0fe-1f67f5cf4637","amount":1500,"channel_code":"GRABPAY","country":"PH","currency":"PHP","reference_id":"order-5678","failure_code":null,"refund_fee_amount":null,"created":"2023-01-24T07:05:07.859363326Z","updated":"2023-01-24T07:05:07.859363326Z","metadata":null}] | +**has_more** | **bool** | | false | [optional] + +[[Back to README]](../../README.md) diff --git a/docs/header.jpg b/docs/header.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8730897b5837a9f1e004696080e29de657b9503d GIT binary patch literal 113176 zcmeFYXHZ*BwL^MIwiCB@|c9=_VsI5kKDU|@5a4b_ee;tU){TX?atkM z6y%hoPpGJASR@U7607k~=~yLB{QA*#7^F-@SMH&dpn-H~z&ogq-Bs%`4kCu3vxn@X0;Wn|DaA z3RlL-?@-*OWO*XY`syClQyMl29RouvuXyYbwTSqO*Y4h*^YSa(NAa}m$|}10K%dYs zcx+rk7N+XQ@QA1wK+nSyF}TCQsbCF)1Xs-MhGgfIH!IrNS1%P@PLPn@xM~ym4RR8B z66o&QyMp)s3d=vQ|3u)Q2>cU)e68f0{P*yYAHBLzuf{`A{-5W;_vvS* z!|?cFa}ISpF@V75jscb?=WnK4v`zAhgDC^|%s)?4qv?f9efSb^b(*&)VG1I6Vvy4Mbd$ zI5xbz;7uM|yfNBTB2U<~Ke6%u{h@R(=Qky$vGdLVYA$sn@wevMon8HpFJ(>7hW}*X zgF;oBsv|E+c;zwD^c$Z7&KhYOyMiib{tBW}`KO-$6Y+VoUV2o8n}{}qk5$uXXxRB` zJko=CT#^XI?C<42ZjIJMWN|TuF{w9}CYC(r3(l>2E4-6@E};f(M3wD$tu6{G`48y;(A6fuLxbJxzZ=fbhKVbg8_l-sq8e{(^x?3jT(0 zCYByZK2Q?cVcgl<3fX}gDj84lHIUELGiFfJ3OWl%w0vI#pPI#!**w%I(hL070YbYo z>a*nxkOduwPcX|lr9-AMv1z7%dC?PH%k#D~boTs3>L{{*+ZiUAIs0iCS-UJ+G=3h# zMqP&hR#v<2hJO_h6y#|uu#UEunJ9U(n<`ELvp=75OYQF%ftCu_Y#I`ql6ofs_8PVz zEe1D%>NRURNR;!>oIAEo-$X+@C@C|RQ8VktV}L0GRA^3ci-E0^7z-HetRuY?3$v@R zT3r`NrSQ>^L7!;(Cr*th=Vi)n*HSJjy!}HrEFT>Ga{Erh@#}zaC*~Xz`<=HpW`1YM zDFPl1mWZBkU)v7+naN5Qwt`PSe?oHHxS|bzpm5;)=7N;Of7X+$Gc@ZAkRNo5VR|F|Lj*&&%#m5yn?4jim7KpB51OJ4V4 z*EU~%$}8QTv^i60#;<(W13k!PI$l)9Kkk2TIyTmh;NOlob8_=irQF2;rZy54a~F zth|ni-n6~S!tsvN!HcJE&qlc%e2$XZw)PUZd>o_SEZ2RXZj@v~xJ&Y$rWuF|Yt#`$ z#@CE_8_s?FW!EqhUou8L{OgNS2b|N=_B(jifC3YUpLMR$=e{E)Mnw{CvW+f|mSpM3 z!l({^YM2gnj33Kkhn@S&|EnhLzo)S`9&c~Aif^9gj9-%AJZ>0x4XkqDh1QKnm=81r z?PR6T-Z?a(7(qMJ6c^JE8o4bpf^wJ|E=kx6_dQK;eE(qaIz% z(>Lg}So{xQ+*Ln-UU10yUc7rNSLYRe{o6#xu6wDx@S6O_-MQ7+{7VvzhWm%qsE;?Y z^{d8CiwGaLm*npfBzO8Ae)rh zfrgv%Z%3VB@bV7^g*Jaq&WEfnp9!ze?y1K}D4`H#|1TP&{f-dF%!em!SRCC}#`ZhD zQnq(dkJKDRpl;$(n(dR=t+)4m(ZeZ6ALDNi9dUIO57e3Z1w zMNiovAsYo^q5`nP@g>J^(oqU6BbFvV6`re3?&pE;wW-y+UXnbH0x0PNixp3KWreZW zce^hx(l_6)8(z;~6>$b+|&AC?OI<6SJy; zkKhxQhTG|&XSwP3U55CMku72Otm=cw_jgwsj%-@^lh%}tSj@O9WkVSQ=B8vOY3~+% z)f`re70B&i_fTQ@+1X_s4@K~RJZxa9i%wFKZ2rJLf2J|ElqDp#PhTIX#KxDhB-!f^ zL_49(##phv9zb%FMWE8Zh?b78l6FxPPQGu3|NUT|_hBtl~?WKjp@x6VKgbL9DW60ckF;)j*k979OGxjiMX|k7Q7*EL=aQq%`uX3^ z0sO-sy3H~>8}2f>uY$QGfh^rFUe6rTD7M5`6w0q8nDzSk9DE-PGLY(+tL6ApOCRvI zLFSS~S=RqTO=oEZ3o-Z`-UXn3YA$jenZnJQj5oH0=?|%~_rw+=k<1*dj`^<_J0vTD z<7&E~X&~DEmyzA_CQR2RmvumZ3jUOYOljUT3A3%fvC>VGff#znIv$m8tGz#cT7N$| zbkE6WE*EybYYHBfM41}uAOJNHMyn1Tt~&uLdQ!fbgbEW2dM`Xg`eU7)x^Iac+B$Z> zl3(dQS91A0-lk^hWyh|}paT2j9)>avKKoz?!n7%V|G>R+U*b7|_ayDBW=e*-Nh}BL zg2!mI0YRBxz#}d58qD9~2*rd)F?C4mo`rY_neLk;JN+7&d2&he>ZEj+WB6mF z=Ou}K%d*Ih#q^OTNEn7cmZ}q(BPz&!`DR_rLt6q;q#b{HHVOsl9hlSu)ha{}*#0m(P zq}k^*W-e2j)CW0l$lW{b7a-iLoV(Mwo#PdmBq zS4%pkD%3bB_aR$zcq9Qy_-OI~n+PjL-c$BK=hgnE&!Zyankv3O)=wskQuJ({7cq6z z-5UX#CA#&=0baA97yO~99!BSDi`66h{>xxXmS->iIEEJaO9%rsGX*s9rr3)gWxx!@8tiKo zT@P?{f~Ui&qCn=N{l*{tiCWEyi5ZWh{n`XRE7Yf-mI-kD-l1*?Ri?ZtF?y(RG+OMw z&!gLd_Xal$#3V@%^VBzNKd^R$Z@895O<>?w+)65Z_RIns>rPmfBB4xq+k3L(xe|cpel7QPb`3Gv!=- zhcP8fxgFH~Y|` zyA_S;LfmiWft}b3np2{xMMHbD5pNsssHuhR65qeE7dSs(sC1A+e?Y8iE0a5I`gTkW z6u(IkFueA}SM&33*ZPy#@2hLW?QLv&4G3G;LACKn?2tXz{c^F4xGn!KJw74{(@zN`LsZM#AL3MS~50=$^Ovh%k zrTA?O>uV>;GSXW4AlANjt-HSEW2?UAo9{2M*@iSd?EQ5EH~UDcg%F~(GYAJUO?u1k zBR~&U9LBgVvlEwA0NxCaOELl2LRe8*a2z*bszi-_p~0r=esllzI$F*SjLn`ND`4OY z^@9LgeV>)2awC`Dl)`dc7$?~&kBJ$7&8;s7UJWc7rZTGXlL0UA8uoYTpNsm4W!7u+ zvghbC9*+*zM(rPPWt>bVnCq4KbG_V_R%mtDTHL+BJh=Im?+eN7YoN>hWe+ zFK3jI>FYPo2#TpS$>Hj+f(1EHHAW|_dS2Aks%;R@I;Nzs?z{w9kyDo11gAEzo8Dn6 zT>#=px$Yr_@qUsRT&Hl=6=Y6oCp>z(W$;_5hd}u&=eOxBn`hPJToB+jkINeEhYF~@ zM=bR>n-Ax~6=R{V+yjC zo!&V4g#vsaDCwBXEZ-JNN(pTz)1#KVE$AL~zm>RaJmn(O|A<3HIHI$8^2K?E$Ov_z z+2?a?g#p%hPeIJ7u*6V#Ia?C#w6mzM+TsoEb-}IJ@EYZK7e`U0B+MZilGwGVjKxH% zB-wmOqb829A1n+9b+n766~h1L>Gq#ex(0Sr{=IA7{b*p*_jlbpDvmwXtF4f%(C^Qf zkCcCDx{+G$$;};WQ2kCAL}kEBk3xRRi&DrpiLyBbz=ZO~-ZmL{HC@wten~m{bMn>j+eC2;uTI}Mu^7`<9zlnLXnj5jzw4(Jx-u4}{Cbm;x;!f!p(rIuu-oYv1{Wqf$aX_pjUj<97 zp{V#eVoX^exoD9`VHuVFzz8(YUPdZMckuLGc1|EptwOMPz@bm+TLKTLYKgUT4NJ}# zqe?5p^TY$6eqjP&Pu?c3YYViXGgklLDi8T%M{E|oyxZ&6i|##b?RHsY(gl}$6=<90 zd(f=1?tW;aRuiQm@I2uW0jDxH&ma7OJ?PLG^`7`Chjl41{juS-{$|lL{#V}u@8W#0 zA)5}r$Fy5rYq zC*D#gUM@~qTH(?Ely3cBE1?Ms`p8o4*2mQGrzeT70v)6#hzT<3|Lc+@+t@>Rb$0lM z(jTLB=FpYIqZOCk*9ZH5Xb!heIaE@!N4t!!)ZR2YjCRE4eb96${Rt8%mzwE=6d9g6 zplj^r4egb8Z(Z0lOit;rBr{Jy)>W1Bs4N<)zBqH)I~V33@nh9lb%zz=XsRJ%uKpQim;YtsYLx^Ah7Tqq!#2AMJpE3r>ie!_;c@&HHp(8I`)#f(<-t@0`Q zBQj}kW3H&{)$8Y#hzjW?TO~jCjEJ3c?19=eg`C~X^2WQ1$;HqKy*J|6YG;!whfIjL zrY1lqMBrr^M|47Nw=OUmtjaz&>=H6>@sf$XM751w-8-XDKm7F(H4T%NhhxRuQ9!x< zg&9bKls2j-*(`XXARU$AQe?=wj$-YAkOi9=n_CSS^v3d~5sCf@L#u+~OXA4EBk32( zYp>(}q_ZW&RT^;S-lLGH$xYZ5I z;7FSkm^mLY*8npJ-=yH}r`G#%yOR_6RF7Sd4D40j6W4DO(3RJe)MHcJ-hXNdVuLq1 z`G|8TPqPl#jTU7T!^HR5%O!h3rrp^>9K|K-P0sYU)UgX5btdD#N^ibV@<{xutnvh` zWkEa80-mYG6C1l{KDm2kr;H8h4-OErM_pQ4!dvRL}&1 zI$IXjInUB*&10Q*Bv}~0L7atu{}R zdr{2t*@()x-R%u+{{$Y}pnE&kkb?V%Ua*m|x`e;lkBdu$@e_52Ga@ZZMv&>2*>A$ zj8B>bjgGgvPkxg+L(jyjmd$Qz8M^j2mC$5KVn^w zQ??A3;b^dSdxRSsYF{o(5W!9J`e;14hXIL*=XKe+tB#>8L4e3Q*{csMP;SBuldm*O zBm=`A|mzyCmV;7=vPqCbqP6rM$Cj-b(`MI!iDO1O8}C zak7i!fZPMusEP-U1-|KR4=|WKJ)lGF?aD=izZ#}<5w9W<&d6qzVU2o!y(Y~_{5Sp0 zac=$b+?F1YcoA_s>3eL=J?e*s!g_k5{Y+?CY zsec3yghnh%P98?+PFgM%*#2%xI%l(4ZV{9EUwhBL@7yr-W%)=TGjnQS$+1q;+|E#) zwE}3N-VJcu&J{mZ8<(1VGEP1aOq&p!jA?FGNbaz{D+51VV15B2@;t1!@mk;-Os8gs zjS`PsdOjqws8Ay2B?KQa!dwh(_b^IqOdZq8GbnAQQa2k9eyYY+5XL+<$lF2iaUVha?7@=j}<>4$U#0 zynXg@=aU~}r8!!h!B359^Z-O0sPM4mfv9P@sHk0}LJg4Jy}X!=(K3ILPDuPmpVHR^ zJ~D1RaWa|S+ig*R(BQW?WL)jNxHnPl)Y@;@Cz~qTu&*sv>XFG_e${31X3Mp|oVK1_wbe#(z9lCbmLVPwWD=Ul5t9H4+NJ!qvsqK2i z1biPgc)-;KRnwUA>+hVl$-r;va5uG3t5*Zd^}M=teMJG%ioQ>!z8xW3qcvf)1I~p- z;;_5G_jgRT^)Av3XTF@LpD(60B~Jgs06E_BHix0KJGWM-Y_G|mjM z&RSy4Gs$5xhrV&)UMKG+@QTzp3e@wRzhK1gRmtaGV5y44u((X9P!sRCtrj<^VicP!3FM55bF zJwB-E+ErJ@mG5D}-mJ3m#ImsN(% z?=gX=CyfTzFB%;+8EI4yN&72B64gh~9_lbdU`^qni-8&CTBF!u%Dj>>S24X&6#$Tm z$~k=_Ksx|}8SJ7@>$-{o#(>6=W5Sz|t2iKzieXey|4Nj!wO{_fQ*VM&QravTSDJh2T=7ZS{OW{lJfvWG~<^CdTbm)+4@>Kr8sMD^7Ts+6m#;- zp=B^0YgW(7oA_$&w0NaV1kp`!FfEvA$?6V)@-@u z>1u9y`gr$jNGxcl;)3Rr-5T_%D-d;XcRn^xo%#8$naJ&nT(o1H?M@Ve#6dGmb=2ru0A0#Vki*m=o8C zAlJ~@CqmltgE1DDBnW-qS^=~8Pk%Ry3bMfFK&H8OrX1cZ^$4iu(GtIbb+Nm{7;kcL zi`u4kv}#CyGCu{J{GA{^{m5np;Yc3c{MXs|IYu^G=4ne8FEmb3+ejOpzx4JA)IoJfgvaQiCVk1j;e zQ^2*c&H9x`uvl{uZZ{k>y^^`HYL@1tTD?bc*jtJ$7};W;M~A}6DL+!g_!~@D9L8D| zQH_hyI?Z{J?pODs`wF;BOsV%t+w`po&DQ1?ygZ_|Abz_GBgJv_LeT&d+q|9!HmVKe zMM^0}y=*GbTN!Q9fflKR!bron{gk|iR98olV^UHd71CDt-*gzOjgqm4|N)tW}jUB6SI`vqY_aPJQlmgv4^<6D{2-{j}e8i}KjGhEHL? zbOlT6!cx-=!@B5K5`=m$qeF)4?Md;E~b$+C_46x~~d>i&k+8=#- z#Xs31;>S^^mi(Lish1=z_+{r?HA?6nzUgp6{OI)cx}hqoeaeU!SWk1*QV%b52?Mn>FH< zq@sFZ5lBTPOU1a_F|nM^wgfVPWsP`k{=WCf1U0Zb;J@1vpwxqjhDCWK)Xw_7wR73| zs*_AB`9Z_Asjc>}O5KN~#YoET=c`zRa1i?)osKF$D~>_4}r+E|pBTm+P*$ z)TMjq%kFFzK5D38ZXZ&jMC^wbhNGIFb~44OuU#E}`LCkgg+FG1k{dCB&#c`;Mh@i+ z)|02m$v73L$^8YRp4*Cm^4*@iH*^%$ zvW2d{s8kmDg6QG+_WrC+RN|p68D6cM_w!g(`^N;iZ;d}j;t)Siq~Z;7?vQ=eS4=of z{cDYHc!|7-p1jYtuuj53zm%Uem7)^rFgHraAH|7K=RW9Y3A>q8TMZMebUaJI7R+al zaOM?*c;}rKMU0|DdP{1>bgc7k5gN_ffPE;JPpwbVnE8lE`oL2Kf~>76qGL%Z#+i}JB#Lr<$+Jt2Vq zXMl)i;fBGlay%+0FVn_=ulJHfi+1ziU8#UULFq#;`pCxcdcT^kE7lM+TY$8)^ zaZ%m}y*!C*80~$ey}2pN+-Yd%W};Ru3Fe3f$kgqBFi;+?sie1sA!I^%;I#+OU-gt4 zY5)mO@c0~RThFShSUBOYmTf?ux4ZzsAmO$2{*bHuvt`L=M&v;9dyZht2i$$<(yf}O#+gNcBwV))spXu~X{SOKC6k6b^2GQ1#36r~EeL)|+%*U%7)7KEgbxIuc=+f($`9 zQe-^S)Lc=ie0JHt<@B8$u~URswIAF@EzvgY!zgo9nE}*A$L4qm`+yjN_SoIB4dY|; z%7=_|D%mGmu^8f5jCCB(Hgh_c(F==olJEX}i6=B#@7^-0ci2Vdzv@wON#uFzx?0;R z#aC_g)tE}vCXPqz%>wlUvY+Fjd{o3xzx@`5pW0;51lp|l!jrs61HNQ-UE#g}h;a89 zR;TZZ&41Pk?|KpwX&@&F^3Op?(k-bmL_@F}{tV$u4QQ<~KxgErl9Hmnj9R{zmLi;G zL@JVsefSMda`f%#57pO?Yr3L6m^paVb(cB&-DAj3VkXnZCypgMN1XW5mU-DsMznza z7UXo{;Yeg-cn0#L4i%7`90=4QCzp-~&V+|YtRYcbuO}IvtytyeR^GB6?Lq!Qs<@hq zrb>;DN10)*NEyAAP-Z_yZO9|Mf;)}we%4P&_iWS?r7lnY#1}*ZWLDMpF$?f=J*@p4 z*X9|<5?NAcr6UaPoNOKG>dNTECs?|6k0GYaM|am*tMcw9PsO$v5`(+i@INeE4)$Bn zP2v?=Te}7uxZdF3&d49$PA=`E@zF<4kg7Y`8jf^PvWazAYlNGvau8oJqFF-E$?y?? z>A+Ndm#Kj}HP9(HT5hnWYsy}LTirsv)@6FsDmK<=(^Miay&{xS=xsAnCgc5)^lc?> zi{sd!mZxsT{vX5pCQ&%L{#aY}F#uS=3_zy0_AY@-?V-T}5>wv8>Bs@|doOD;?x1oj zM5T5cOumh(`9paJQ)fBE`v%%tTxKWK_pz_N53a&ylXt@of`R^3?CH@tLqzl}Mo8;6 ziKtvxM#GHUZmJkp?79ZFQjK(A(RcRedB7ZO>T z&FY6dRd7X69KHf=GGGT*g<=LjB>|TAn%o%vwL^YB7@;$5&(ksWt+ZfY7lxF z5E+7oHbUnug$JD6`Er4f;!mhSri76QjHph5&;#Y-gc2JU^=&Px9`<8)eaP=qdnZ5; zH&jtkGhin0UX4PFgVi_M@#h@_CLO9X%PJv&i4v;42^H zc+&qoKu+^bp{@ASh=nFJ9kx@>(RKcKL&0JMqaqB;iR$EM&bF25r^u6JO*b5^SahP`}LHcT76%8&w{5fe4XtX*U&qm-0@tr2+LJ;XTma^FP<8 zz;KxQ(XVRVyOvF!$Fjq{wIC1SDyRLNymlfVU{!{o zpCRrMhv#t7kIS`HGg8v@iQ6>bIt6dM0HyfKbdO_xrPl+`v{Es4GN4u%e;+QX4IS%I ztWq(gA{|TJ_ZIm$bii7%olm3fIN~GfAP7k_ZK~RBy=u+Bnp8i6F>C(W*}ZzIX z4d%58#vclX(Ah*Tc4mpNkY)@25Sv`pILgMMCRn|A-JqQXq zTJ)4}C8%tt9Y3jgO9(BIE7t$EB?~8W!FEB}lrfNe=AE$B@aTH-kMtN}4 zgA0H(LGin+b3l^_AFkVaf){j!V{ChT^e0M2aLwJYoj=25`T{oN#`~fC3vH}GC386>sYh1?Zi1cIUoH~93-IXdM(x!Ux^Q>Y*#+^E(vSAyAZr7 zjx#~@cA|RBnMMOB6bWDv(yx1L;Uq>L1+xmq(_==TrUHtS%GQzW`<@(56SX8o9bkHf z*Rum+@s+AwA`qw?s~R(hfqQtFuQfczJ(0A;L>^hVR$Kq-WHl?7C?aLA&a+S@b9j%v zC~gAs&@0`a-X-(8Q&R0{e#B|2SMIhAKGT}a%bz?KY^T}iY#kRUyt8TluE10lH{eVK zEywq1KQgA^&#PhFNd|P;K{vB*mTY>yui_EVpsX7mrN#`TM-HfFq+=aM7EE^0IKE#A zdd7cJy8O%4BqfJ8fL`Vr6O6v3nR9Z_TcM9#^Zip;XTR69KI%GY*rkpyU)Mbp;?PUX zAz0Evzb`l|;_GnmD&7w@_3eN_$@F2_&4c(ozkRl%1NpqldDY~ik<8GYRYB9v$@sOR zW}KyL#}O{@l0-onfLd#>{E^y`<#zk%t7x`UV^FrHoooc+zC;=_SBGcLiA4r3+J2Ko+rvqS%~I_u5_i4ApG*&ODy_Mwg`BVeCr zgtkx!O1V`WNLTb^>{oXSHDq5`(V1?_&3b2fxW1KwQ?R7LbqyPUdhy$v|Hl$5FTg(M zTS_ZLF|x1}RvEV#5uF4 zr;fp0N^a!x@wTjxazF0{%+dmcob}Ze59bCJUpKpAWCtHSk{Bjb%Ltkmr$`FUyDXFg z2QNC{$P+h}S&9bo!SRs6BU9v|F<(Qkg-x&#R|>Bzo8{*HzdqWr2Ys|tEInng)Ieu_ zEMEV3J>N0&AJ~07Hb^n!+JskrU4_P=n|hB?VLa_sMg$=tm%>2V;=0_cwTNe_#hj7$ zkU21%6?F4W@()roYMLkT$`3QU*CGj3{I)V%_u_>KQ&`esZ%hQduT-1Gy8b}`EX3?s zoO>ejSV&Nx7^q(+BOlhEV%BQCIo@GoDO>EtCn_m&YywO08`NOU(OH2i`N!)Nt&CVa zE|4jaL_zB~UPkDR(3WCm^m3>zd%e~)<0^PayOhd7bB1!o@Q8RB{pKiN-(AT!u5%D7 zQIU>9gK+_g2~IoQL%U%%<+e?V>Zg+x;&SB1%*m{hl%Xi&sf;w%teeXn7(y53n{+pn z;K==Y8FEP?5asUNjwbqNj?Yj9`uf~k?}|*TvAocxL3NnWA^<=(q z3fAD>K3DE5zoMC>Uq%wRiZ66~i2Gs$DW$AQ-7wR7doOC#NpXIW9%J-y zWiiSsa*HYDys~>X_})V0xZASJtLw$C7&0Lb;Y#7a-k8qhVa3x_{)^SCR70!_6H%rY zU$X3RFwGvnt$kjgRgY+20Ulz0cCq@f>&h0cd%M10K85GHDf6*|zDYeYgLvp09W)YR z;Bi?K318hs+Ifu^*@$taS{+6UGDV!X*>a!973%?jyeb_jDRzn%JcVGp7YDzC2vSy6 zARlw}Hb2~ko{)-`Kk!+@4SIN%J-u@y_N%8ZAJQZlYRGyd*?Dx%nVmmEI4m}p4XOUr z*Tz3SiAJw3ggWwd5>a-1?~i)uawaFmgpoV-lH?|hk%cN;druGcFG;>j%;wR%of{$K z<=w(F(PVc{O2RKmter~J2l8e|dJ|_;XE#Z^y(|~x3g+$k;zrKw1a(=H%-yvrtkPO1 zSC5n8lMQTQ;tx-66fWOmCi}KG*j28$|HT``NZ752x!0gI>4zP<;x_Y;)uI~ZcJ5IC zskflHBdIsJEA$(ODdVG?#TY|WH!|JD!g|NZA%rGM`}sQc(}B)?_$eKg(UOwB9m4DWU4 z4@FOMjMhaGozPl`(Yb_TQ?-IyBy~aNN=Io>7q86pQ?&Z`D=T~hJp!mMfz{qd)!mrc z`#}pA(Sy%ZWTyh9U(!PF+iljQV_&&j`?%n?Z&AiK;h#OQxAMtRdg-JD=*_ltw;;HC z`0WlwkB>>fW~rv%?Ci^Bp;u_k7(`r+(n>}q_n-I0BH~WgpO0cRXd{5ZVc1dIS_wwC zXXj8K@nM#a!sLx$1Z6g(z?j65Z8`0FqQ#UFvh2L5@W=q%i=oehIg7)u_!ZtZ88s@; zQdWNTgYx>L>Rt5VG@qU>pUHx`VbZ80;BIR+Uzzafdrz8j)sD9Wou0O|#*c@S@rHpM zJnXAexs_3gy1H(RO`dbzm0XpZ^tac`h(~=W9%l)RJ-P?cW9!-wgMmzSM=s;o!0t+v zbkIn;9Th4Q>_TLNLsl^NJb0-c#BGH+6gH~G=ynW-#IFHEsMta|{Zk@|9#cf1p_~eC zNcC89PjqjN(k&TNUIo+=d zqfTu=b-o)A_VfEdHWCtrCZirQk2Pv?F_g6*aT2`mrab=3sJbh9PpY&d;@-noV0x!T zE||_2SlHOcn)VFRtePLY*F+mj-dm?fW{fSWpWxxpam8p;bZL{e)h6D zRCH~&UNMR9BbTw^4gF4ZlNi@QzcEXTBeB_*`!DkeTSF)N&tsy^4ag6!NTuayAZcQh zGU+9WB!cNaQrwX>Gvt^CCM-MgH7|)vFa7zvw%H6q>$TpXy6A6*>j#UncJ&Ph3QTg z5|E1c(Xgv9e6sihcXZX%XsUa?ha<{SAjTEhW=uqxu<6(H1-hWvR`e)ho~?VoQ1=h~ zwpw@7hCgA|*dzUitm#2T_O!@KBLzRT7FNchi5mVyqFm>DR|PIn5r36MXqV?)PD`8X zA213Y_LmU^x|kf!DJxFY5{?;T-D}tDZX5J1``~uQJVxUjbK*aSX{Ayf6>sta1m#}`4EZ?ceCBlTV# zSBbliqk=gVl0_abx4k-tpAJqQYx6?VeiT}!>ows%RHUScS+t%bh004GEzj+gT#^i) z^*Gqd;+QW53`!p$WN8GO@pGoeADdvZIl}=h3{{};ak2_>nMBph9b+URJO zY|z4`KW3M*)ReypW!F9hpPPD!jMpbGNC_?yt+60q`(#&Wcdi%N<`%#?tiOBIVCc5r zC5iq(z1f*GuFI9Z2XiXQXt9<(TZ6RXK><6IXlYMS|LDg z%c%(`KZ)4?S>Dj6=B!~?5=|fU^L@js9|Muyik+LnF&~9^JCoLv>eRza5Y(j)Jt_E1 zdg6hbuwJ!h6o-wd5;NW2C5ahfr2EfW{{ABtety;68_U)Au|@?VLZD1`iw)Kbz`QfY z4@PDU?!(=^!T$V zGg#*;X@f5hrwROK4%AwuS;GT|)C59ca(?Rve`J-L7g9_z9^FEkGKyb^S6kxSvByfkjkEM!%cxLA*8^FNi;x-@RMQS>M1nD&*}_=W?g% z9nQp1+$G2mGfVoNz-Dl2%y3CU`GZntD*-LSC)&lJ;ZHAJ>-NZ8L^FnG-!{2)`fIbX zv->yIR---N@H!hcD)e$=zG%{w*U^bJ4G_j|s~;_>C9VA)c~&n!ytgJArVT=`o^&N^Y;f^_`i*lA<3+xW6eAHzKF`x~QNXx1;JU3<%$My)8hFOGNzNWM z%i%t`UW!G641^;vMz~p9&mv;>R;(e2yjnC6=GUe<>ZINtP!(#hjmCM&ikVSZW5mhp zlp(aVI)e>Sf`T!{9z>>DLlHyiB;mCsEVGoRD8sfj0+16K$*7kOgn2#84h1Sb5!dq4 zmxF-Pmc=0;hK{ai5DlTLB5k=tj&_1Hs7$HB-uBuC~}f zD(1b~rvhJ<7Rq}oiEg}Y^Ui10hm`O+&hpZc!%$G-EWIPG?x=Z_X5CRG-H7p|M0~w$ z`1_PjRXJc!cH78!XI^-RuA^#~w3b?W;G)b|jveUSP_^k%K&Yw1QTTy?+MyvI*+WEq z-EFO5TSWfD`*0k>@H3`u)7WvHcOnvn!iS9JcfNwue_r>|C$1hbmGDcoZpMle8Y0!m z5f${hR3N*~t{d>a1Qp2(O>Uw#$5onY1Bb2gvxFq-#@B9F$1A-Y$4$d*Czq#dq;op8 z%nD`-;r$*wUkU6!r!EYmf*bJ_+y^EV4jH6TisWh{vDBKMSC_(23v+GG6W$eJ9WC@A z7pE6y0RsLeBW|ACU?$sSi*S_K5i|dAU1AU043hZiR3OKu*Ep~@!(Yg+XR6c~Y$Kpr z41|=DV{JAF@uGywLd?~it8v}nJ-&A4!vjV%lqv`aqY#D-a%+9hmx|K99E~G%qUg8BAHHONw*KwiVsAQJd03TXUv_HxDx( z0KGq*%Bx3X;S~>PL7mzhMebS{HmgvgG$ntm(oG6kG)9N1Ozsh2ur)S^!Gx=@gDUIP zr%fOptq)Ubn|aDXTmY(`-qP8y`%zr(xyMnVC?)-RLnT|Hc$W*IeKir3|T?tvc z&>RzXQoCL|ZRf24JV-Za@ULU2%-s{1!FUZBnIX=;` zc$}eeZPG>B`r&j8SY(4X*|s#&X2Y1Jl+hD9=GMpT5zvYzWWi`g{VlCOOdU0H6QPcv za$l=1Xp`WYo6UAfsf!=6x&M7!$c*oceEavdWZ61z`7o=`Stc14;ZeTN!&6WjfKEU(9VbRuU<3v4zfn0@N=W6h4D+stJ7Had< z;QT|XhO6?L+br!4aT`*2qJ4U1w#oee!`@p)wY9eWzO1#{)zy}k;?N+)ix+oTZE+|R zNrF?{p#=9;!95UMibF!60fGlgaW5JORwPJp2@XAZ-f=!W`;2||c=!9B{q5vKl99|g z$2~GL=Y3z-_5c5_fv|g?qszs4vab}z`xp&pN0qt9?L};?RI6Gl_@9S5>@o zUlEh7Vr5RsVx)=~j_4li-9Smg5O|YnNS%m=_473sbBTxUY4N2zwkZB9P6wZIq7r1H z2Dmpiw1fu9Fw}cW?HSd^xBM>L8KcgXyc50W!ONUMnbL(AWc}Wh(C!1VkMDEizo!(z znKgaYX{4sPE~+7VIxt@U2FT-(kgOgl;<=ra!tG3CugIG(hlecPOK^P1r7JUm!4WAG zoLsXMC+rJND)H-89wq~AoVDhA%D^KJeGRL?2AC>(p3W2$>^o77tw}D4)9H?k@!+;S z$!1L}##ZX1>3@-FScLXJjolhdNvXQ$y-k#mT$z(a+8r&MJJjrZ-!;p=9HA*SDRGIk zRQhO14tE@?$p1b4AU?69w=?cib-bQ?7w2Ar7Kx^obaVLQYrXi1`dn7GVLvJ=cW|?- zF5VKjL8z`UytuYr7Hewd&t2TnvE+yYS7QcWtr3BXYu631Q8nsbP?&W;HO3)fOK!#LMb?4ZDWaKR1Y3mzH z!dCveJ#+4>zO$(q6wq`M4Rbn*;0U7Y$WfWLe&TPK=Gu&UGW=A1wrt#e839{nW398t z-`g_*&{F((oMgW3p^tj%Dmto5)uWL%XI{Xav0KK9+$R|>N0Z%uIA?m zvJ0XqH409%j^Ns!c!ZYtFr}F@g6syZvU7p!KbhL%sA- zjBEO+*`SQ?60Z`n8N2XAxn z<$|!Eiq!~BOE!vK^~}}Ir=7Yer8ICtWp*QR>oK|BkYoI03H7W=rN&k#TXYmWcVsWH zX>i1UcXY(a^W!M95>kq`$*9yF@bp!x(ThmZ zJ+DHoaC6K99+GAs;lE|yOpya~LWj$&0nU!anitn9vW>Zs%yKhGyR1x;x4q)A53lS_ zwGbYxa;w&+WmY+;AVJfL?5Y9?Kssj^A0Z`T*Rzo4(%2#*F$`9bkXhWsC3*-PBd!$6 zaT@~ET|_W_&x$U`HdF2DdgCI|esS2tJIX-p1-ECU7Rb$0C_TCk46__m-iC@gW!KHh z16yn~R2k#)0EO9;{V{ZejW;#9oCLc50z2E&%op{z)aqg_YEgfLr|6P+WZK+6=iY|PIzQ=_d2GheL;^Y`YGie}r5j)iVR29y zi5+c-8o%C7a$*nGW#&`{K4p^yCrK>INmvEv!V1I8NSVyaqL~eeoq!J;zGS>NV3Ow3f{t$ws8g=DnI7&mP6L-<)7M!G$lT{R87_0bTT%!D8$TOKSOUrqy#OOpM~ID(fCco6u%_zY=SGFnswz7I8Qv( zgQfRWi#p@^qS}g{Q@}wDM1SAHqo46EOmKDRA$VhhsZrYMUA9kPqpqx8HG4s62KETEZ=Y(U^H2{_lbLk;_@r2(!53c#-c_||iibFGbWSKj&3(w>078(0q@mJ%&TO)+4%eTR zJ-SRO)r{YqW;9PI5|x$gISH}9=5mGuSj$4RhfWrI^j(3P^rmSMb)a``X|z#<#LOR> zqYioZIB;n^4&T8NrW}nrZ^rGd$owqe9gtDA62`uMfYzC926KY}@EMdoY$k1vd zW#UQ^84{w1aqbSR7SGR^nixx)H9~0CZ3_l$OB)|!ac`!;F{8<6tSa6-M2<25U6@;^ z6}Pq9c`H8fasR64G}BDss6jrXMUKG_gwiJ&{50Q+>loA;#<*c$jLNQ&Ab7G)PvG=Ss&s#?ox2LE8qI?LEH;wI6 zSJ?*h9QE$;b4fc%NieJ_9W!F)#Dbq`S(z%o9QTZid$WZlZ+Xz(Pa(vv1~e~g@37hK z^ypgA2kUTfHW}=GQ-u=7su%aT23}9}TjX{BgXVN^NX$|n8;R(GsN9`*>rSvOfg(+u zp4FNQ0JA+jnpMR@v6b&?9-HigB}Wvm7-qS97vq_dja-;}gWX;7A4Rof)PmDM5{G@2 zuxubAumihQsaJ8l`o`5=YUg=ja!$fH*5t}&U+4J}=#9Y7G(P)&tVFg-wuNYh=;Iu^ zqE;92=%~Bz)uGxrO?zrcTjZtg%Ep%k%WnOq4@>Vew7a8{-JDI`UnO8_#=cHE4_eOb z8{5io#$ph=8KyE%b(}AaGyvkB-IcnO6WBWBFsM6|TJx;c!u1*}tZU zuzBGhRcaQthQxRiq*v2IJMtcd=9~!be%>A)d4bLQtRkko#hg&Au?XV|v6Kwy__}@a zhV^xVPN;>&4dW;&uDwi?Ysg%ey55{ za$kB@!PYh%yJi1KR@EVR)P}DwdLWmDRdrtSA?0+}c0jC0^5&@6j6+1Fb31cv8Y8Xd zkWPrD{8+<$4jj(DsiMQ-=N8}o4j;z9_Aarp3^Bs{bWmR(PqN8B79!j`qMV?TJ%Win z>)~DaejJ$gxmwqKxR}7lvp4RJ28I6<8D3`a%mn#*QSAEN>>*=%K_vlQwcKo4X%5|! z#q7=0mfyMM(s0$Qw**FKEa{R5~^aUy)ki z#q3lGLGK}bTVZ9YG72X67%+!fJ`AWLxm4ON?E7Z=RZw_qR-$#N`lf=HNloW2U(p|R z1rRM2{H>G3?za(sVOuko-MDFM`6PgsSzn{Lmz;jZ%%+ml8JZ|e+ zF0aL+N9acGehkiM+j-0W+lKKS5LX5BC?5mF+abbeXZ7d_Dq6wm>72yYV#2U2v0#$< zA@9We@xjG?j@mn8$V&6`Mi*hdeQ!6|!I=Va!)9i4=Wn8)Z9FhRqrlrsL-125!*epS zC$KHRwPx_~^|vn}zS~dkvY``KRxLtpCc|bZJ12PF+@=T86NEw6_mnH#s*eq7ZkC2Z zDQmozvzY(axBTBuE?q?Ry~g>rYMAAmq26{oMA8g1-dL{}Fd{hMe zBCE?Xk{MiaU1ccEhl<#=AaFhwVLt;sUiC7CY42QV2cHFpEcS2a(=#s>@`QzFG>#qD zhK;!STAz{9@zyW)&w?!vZhw&_5)*#tSr%vhYgmWu&5t!;fXbB51Mp3T&2klWAg-#& z;rUuue{8s^j0$MGEa$ASS(CH$K>@khZ+Ox!_gL$J{NMp(R-)I(*gAtfpNp)Lnp){$ zMg~(_=WeETcHajU3jI0@CuXgty?RIFShg|9*!Oby>nH0%e-q&I*Ot(&ut_X*L5bdn zeOrG>UT9_Y^@R!+QakMB=vcf%%_Q#w73AWgzoT|?C7wq8-J=pWZb#rPPDxoiRXb9U zMJP%+j+~@$IqmoCpvz`_%5B30k-6O+3u#Dm_{l0hk42(M%mm9WM9C7>4F${cp65;2 zG(`67p{<-vy5F#f@trn=r!zxzc(wS7z^N4hi?3;cGTI-}K`ln{gM|y~s{iW~_CNpj zPxT4Yz_S9$aQ^o$GM_rk%MIck-Yu@))2o4V%%?Q=OLpn8T7+l5D=LpJUxjBuM071` z4A0p&cDwx)l>TTV%wm-6OVht*UW(c5b<9uqO{PS?wy&&mxsI(XvjuG#tDa#S?ubdy z4k^pUJ@(>4+KXJwD{ot}#eW@?SR;aDOa~MhGZH*9?;JKA7)1lA9BqT0Tcvk?Uj^Mv zkgk@xT%>fyMPT>k@0!u|=%LJ`vpwH$>s;K^mu8s>DRxYS%C>*4^XZ9aKYhi#W7`5j z8@qBw=I51c0`eo>D_W?weVyvC8%lTPxu5yew}p6EO>k{GM;d`P1{@*9Br{i z=d50X$~`hpE2(`KSX3rScu8||J`kAbP6ku9x7YS5x#elQLF->b0C4 z(;i^YbvL}=((_P!LUB;D1yP4LF7Zu&8~-*uwPu(h2KpGyQqwJxH!BEPH=ZwUseu>F zOQ+Wi!EKX6*V>tFESBWeh;F=B21jx_cvv<^_K>kN(#($2i|$mXlc7Ax##4MO8CdoJ zRl(#VQin?n@yBkZ_iu;rjko?H<3hhbf9hJ1SVUEp@BY0Aic!y5140*OukywB_kckg z4OT&>{No>5KQEb5rf!9nbu}Kp3LS1C+;PZK(KLwzGr>`o-@7NUF)Z}AIv2K!SF!7 zqO5(3eJ#p^)kHg?jJGw@2Rrp(;ZT*;gpF<|Psi5VXexOZz-U)_#UWEr{=ze^fLV;* ze07s_Rf`R)=0C;X4QM8Lnz^WYm?tY^!;>>dCgG`z6R^zS3uO)RNT}WW*8&?{-;2H; z+^jyRekHE9mE_%#O>-*dckJiI+fYh-y3s^ya)>%f0S>@}BuspMx=e46ZLvZ`6@zqy z4P*gQdZ&^b#d8ZW2?8OmA%PD+nQoE$ERnp+uE9;kvFpRu8nhL^`yv|m{94DAFkgR> z9p?WcBToDxJF{wShnoH(J0+EuFO`0gZQ8e9OoZLG-N1j5-S&h%+?>gX;Ef#?NbMdW zH?T=)>WFc5=>3xyg+b*w^s-2go~$Z8zIPa^VZz5JtU^h0Sm_1E5Aew?#>5s}7G68; zz0ISB(Wfq*8=mnwFP68jGCDGxFiE`YMwA%`Zna4E$pm^ICFcpnaK3R+)#9tPJz9R1 zX;ub<^^1ni!%ICEvYKl-Av1YKh3f23C)|f zHbd6B8i3^&naGaK(+la{eTW3*=xVy>e0kMs)4W$N|Gq`tqt(YFnC7!PcOZ7EiWE++ zf7$as`K%(I*<;FOEUq10_OUcm{S)NfXYCR;kvN)?4v{ztZJa`XjjT>?at%Ht7FUmf z_#tx6WL+4t(zr+}bg+!s1rvOOuL(%9vFevd@*Pgih@lIVU4gYS(j3kldH^OVhxn+d z9Cmhz@_)SqvUymlRbNq<{UTG}#_s(Ir~TvTb!eWy$F|3ZYb7*wWaqu{W422~e<=C) zWb-WwT%HEx3Osr9Za`(q{}r^s9}bxg@3>Q`n&i)_pCj1 zb~5H^RzTXW+0s7(CmSWbayIJFrFVrya!3*_O|y3;J&NS?cS%q00!9w$qH_HR8-GRr zBFn$xJIKpJq~rp_-T;AM0{qCtQVR$!lhsvhzd%PTZxFcD$CMhQqVk<6HATISuihV> zog~cXw;z8zxmLR2kbQaMcCz%1Msu5BIYHrn1Keo8KP$kx`O|P#63dj2u@WCRHL4B{rf8x;3Wuv~3Ip7(0a)j|Q_ ztYv7<$5+j-&q66}v6tWNt_n7uKnX&M1wIKT!=l>%)Ubo*I-0GWPt&PbF|_jBm%G?V zT|pK8Q2$IuPk!RFySH|ZX>!t`)3bFp#c234=-KcRkb-sa{>Q_2hF3oWtcX6_^G`B6 zbheJs5Hsf287Ip}sxJ zh6pu>U)CbeA7oaw8s0h)6C1^DpJY`1L_q~|GjLLeyk%`JK4*J5e;>28-nunVOzCu- zo6NdDJ-hz!=_)bqru(<)jk;fCj8}l;%hjt+ZUr9au*`Umy+2tG++LN}S{{v(xG1@lM*c?!sMj%NoAX*Uu1nxD{3$QIGLOLMRpx@!#I@YzwLDB zzHfPB`u4_i?5@Q*`}I*4{SDZIq{bCnYdgGqQa-D+^))OKRq~|!gtqN}z8L!d=F|T+ zz>kmX7_71^qx_KdbW7*;ks&#L9xWO|>|6af9H-cn2()oq<3L!q?94R?(1`4yX+}(IiyXDen{%gzlynLc zvi`mB-Oi}TC1{JN4|Uf9Pbz7ay$a{V&aoDcCZYcq`7 zkkVIFQEXR`-q>Q*7oEBO>{(>ri|n@p ziKwaZto<0k4r~}lB-CQPn(T7^C_!4&UBb~*qI9k*b|HF{{g8ZX9)v9r_~u}%yGu*; zL)lUT=p-&yEv>a6Euzsq)p~7qRMq7v(ygd*_hm0%-S! z68Xl;#-+qdgA3r=O}aw=Pf;St6UP>!?QS@QSfmYjv-iNN?hV6NM>ZLmo`q*??(fqh zJU^%Q3%EE)kH|riVWW|O883=Spae=Q`|T=82@Cyd-S1sxzlEDeTrg=E#RmXZ{VyW?qw7i zvdAS{`G+Tl{H|tX)YnjtwV&@X=7nRgR6MnB$4Q$&Kn=DUNXCuEie{WiI1sFos)|@ktw% z>iX0x;%>7mD!x9;(XFvuGz`C-OVX3- z@{6ZJI_20B@ew+K$rdAB)vwjLZ|3g%EkO>whhv{CK3Yp`U}H6Nb^1ltzhc?^HnhY8 z!a>4};4QJFDxXPcLywsm#XqEf**%NV5;b0xfT^pp!KbdVJlVb+ujSopW_mN=@-fA- zEsK^0<7q$=RZw)f^PU{@DT9!;tR@#I5vE3NJ5%2J>7cw}qDxBi7F0CdI}Cs-C$_ZU z16Mstfnc;=5H(!`ovwv^ogaihKxJCN?$o2N9de3xRyjh-$(^s_LaG{2o})_l-GgMs zR`+*T(f)=%#x@Nr-~Lx7D4DbdELfo_sKP}s;0|HXw^c{93RJ*|7ZqgVVXvZ6yJzfG zJX>U_wTM4HLp&Q$fC{lHyk98tN#jwearHM>`y+k!lz+_nAVXGc4dPe22YLzmlYfz9 zLG+%`BrYdShbN+}{d(_E_6x+>v@n5$ZauiPC}S(P1IXhu2$NOa%HAoOd((wY1Jfe$ zI+i3P9I6{&&Y9ryl&JG9l)=-$_~dp~E6@_XOliR`vb*oSb9SN16*qLOK5B|GvTO^q zJq7@))Wq~EWpzPs7#g`5z4y5S*EI%iLjotJ+_Jk^4LFB`xHftrlhVxm;OZs!Ktpcy z+A3=5=LcE=JBXycYXj>aOjqEIqr!EDZPh{XAKpW1+Gy_8Ym%PyNq_Q;7}aS9bF4sQ z+f;>ZN+KW3D5LTNCq(k;*jf8#V&>l21!K`kyPgGa6M{pIRzY{>E4dIZ-&Up2p|NV_ zsKXBKC*74gsAeZ;X=b4a;j(!VxX!h+5OB*-wcJCwda@d@5G+HqkVkCd3No;wbT5M3 z8=STtta-KtF{XXTc?HkFxYTV>s&iESHVu!M;(hX@SHU;F7{A}96huy-U6PJ?ewC!} zcq>w$oBHbpS=hM=CJ~>z7t{6Fs5qF)2*H!K(Nh0UP?^q>_n%|Ugh$yA>X^r)CD-Z9 zv%(GfJU<_YGYobM6;Km5H5!RewZ3a`TXL)NZmUIY+^;mV`N0iq`YHPX@$QV-dRute z>%_W6-yR{~H#J`$=$nC+d4^H#v?~cjq_<(pOTvGV-H!pehuwuvdohyJS+pQ*Me12C z{O4nFC%Q%(;RDg@U=&qN;8CIPAbDJJTY^Z&z(@`zOqu_oMpaIrvqVj}>=fYfOtm^q zMvrJpgPiKDD?6zP%dO1dLpfT{92nE-bM1ftp%?Hvxz$K!305jVZst>@y(M#ntqc4r zm)xYDhiXIWCtCV6&TQ9$c58l$sDh72jZ%P$P~(;4+J;~~bT)#IN9peV&_Z)m8)6%8 z7H=@t7L%7>Xmn0Uo;=QM{Tp9=S}|Qy=lk?p!MEcFuU*=?V>fD|6C%{s2S6?Ifu>>;&%1+Z}`!>SUe}axdAhl=cggmH0^>L z=AP9=Z(>?~gR-}n+Xs6m@BJd9bpAzF^nB?Y#S!{GpCW&97jbQ0d;4vwT|Ututn~d- zAUg?Gt(2ZvPI1dVMH-V{`=QnG=kws(GB?XriTu+)Hj)V*CnJD;Wy{@rM~B4Uevx&V zv~Lbb-3loF`vHTG6yDrsc7|-m-V{8k9~3AV$J#ZHFw=4))9xe0JLWhDyQ91c?Cbh} zZ%PS43@ODLT=1M4Im_&}#fOp)SGe|g7{T{rdaTOPyClWlc#nZ=qA{nN32hO=oHIEH zq*g3~;tVVTl4PekG-FuzH%U$IH{s4REzaFdQ}Mgb!}j1|K6J(AG-7e@Y2Mn&&nBrN z>`i1U%^z^253R1{Fk`!hdB6V<= zs`)bgq;pXT7_k4{SBvgadICA`c&j=c(?-6>;XKU)a$Be7)-3)StI0Y?R4JSQkqY<#Xw@aBFJ)34_RJVp`cx`FQY#)79#i^}F?x ztIVzatmNG2o74K3TgHC!qgtDYR7mN`KVfnoF$UhCPY=F6?}RaAB;6c!BQ z+gH}WEQ9Vznd2(qe3E8U>Xc!xs;bq7AUtLAg(lY3Qz{;R#g58GZjm(Sj^=+Hi*Q^W zi%Q+=Te&p%c}R3HJ)jl4cW7`?Hm&$`^!$}|%f}w|8ebd7rLNMv3nX@_+4GN~h~ta; zc_pCSy=51>Mwg|dKPmPU#m;E%ndVJgJM4IjZYS=OXPo3#+}caDH!_5EpdSu$k>5#3%BdzEQ}e#RaTI9d|T+i%E6p;uk><3+Z=$VxkIS$a}m)BgaS|5xVt|Li{h zUB)iiZx!>c%Wd#=yT?>zUu}iz=HAeSXyp~p;hMVwOMgs)QRLgMwMaE66+0d&bTTdBjs=#_9Y`xKZ z1*szNg+vN984^zDcA@N52>2H<6cfQOnB1|1Ozkp9CH5Jnv|-?*AT0n4j^$A-Usp)* z;!IE`QKU9RRhtqZ0_yo?^h%O$aH+rDZ`vz4{C_NLmzhdIar&CQFPG-N{}aKOCI@`& zV)h~cP~avxk$e0mw-!D})dTXWqt!C%ovx(gw48Vr@##of_GPh;)71`kf9EnyfgMvx zS|!Sv0DMGd>#~gLT*_vX8<+Cw|4w`n#t+2WdJ0m+p{}O33 zWj?U2owN-$Fe;gu+^H~s8vSaBQ0W>p;d0dp*{awI7!>C_umB-8 z5wC#9)?-%@Lg@JpB5ZwhqGsxTf67#m-4nrCIa^5@@l@0GzJR?$ji1M1Q0w*U#2|hDN{_PF}e7~U&hv@3K>InzL^&M(+C0SS=64P`eLtau=gm! zUm!18b$zzRy4=28*34H0B832Zwvq_CU^Y(>pDe^uO~E<9M0TOsh~TT^1uXdM|G)YgAD>@3dja zIUwG{y81a*h8pVGH7M~P*X{qgb}&z?ivwyMx8|lySYfbcCY|ruWm}Q&MQE-zl!;nnYGhlP@@@iTN^WyIbc@ik_01X%tFUASzD?L7o{$!*3)VpL2Bammz) zf`bpb*(K)rYE%^zm`sE0b`#YjD`4&(39yl8`j@_2A)i0MuXH^vTq(xdUX%@#5hli7 zRIRQ5sBLx;qjT8Fqf0?Ndj1n$!V(m2S5!tpAI|wfIXVwBfYN}>C|8!x zd|vVWvi)AB;j(W+sly-agH{bQ#2KgcAm>iIK&PPi1iWR^%WH$e;UQiagR(UL`T-?* z!L!*$U@O1GKNkp?`NE!MY+~#$GFH|p4zOL|3(WKSM;%(O7VUFS(KQ?2t16nYE(79a zji%o+47X|<)#giz)KO73_+s&SmphP(fiZ;lSEy4WPW$8xF1%HCGf(xpGcS{g`KJj# zvggfRU@^`TCGK6-n+nq0s4ZcDL&~>eu!CN++0=iPAt<@>{{Ai>Q(cMhEgRBOpoF#I50?D za@Da^sfU87wE*-ej<)Z*uSbN$aWZRX#SwpzeSdGTQz^tFsw#MK5ql!3+rml0rJM9$F|+If&`zW(Lp zd@W6mjO+YBqx$1Ya|d5sYu_3Rks#5B*1mE$VxQyZ(tFp8koM3jVy`Gz-afFX`KVcB zSq0olyx{`>z8$uHVm&5xw;a!T6Db`8ZUDa=)#B*_ZGXmN((XRDs6~fQcCld$FWm#|1 z8!iG&yO0|io>tgc7ul7sNwym6{nxa3jacP`JfpEmnkK#apOA#b*@LZBi`V`2=JdFI z)4rkXqfBaT1qj{V%Zmw#|Df=PEgl;@(UHGtdhhod3D5QFV7?fZh zgEzJb2GI2zUk5ybMeR#5{u5-$qyUxVH0at@ZOS_SM|= z-x>0Kph(~Tbii&#`BFo|jaEb%2dIgXq7o|#aN6{(7wk(9DVxrdz~UP+f17(Lp7 z_$+cUv#8v@NuwQ0lGb1zWe7Rzb*Jeue|Y&Z-x7yA7<3s*t#g?~M4ITkYm8{ZOfH@k zq=zVrA^^M`4+A_?TK`cl`#WC9!MN~wi|70P89a;ZwL-(YuEFUL9cY!`U0|~NBtki6 zr}WQSy(EVg4rQ`yh<{_ag4#WVJ};{PKgXNqmpFeR%fQ==i>&v+YyvuoC%H z!~(a38Gadk^cYXf9@I;p8gjAq*|ULK)GEk_oXBATyP7g`TqGniGY3BRd@s`XF{mjzIQG zaNG{1SA>TaiXgp8nv4f7$_shCqb|1JpAFti*VOaHhtheR1jwjSJmjd8PP9)}NkJHX z%=R!^9@s24mMKMv95mprEXB~kHN#Jl)iWHk>~DqFDY3#Vu6wf}7 zj6bvU^`Kl_Zy5R7$6gJEkNA6)nEU{tY21L9%t6rixmCbL#X55Z!Qh$#pr26s=b=-= zWSqt8RybNzqkoAwh*e7l32~0lyy2mHkOQygez$Vn^@wlWx@Wk`LOYL6VI=MVyuwO7 zZgy*`z2IK*h{rt-kYrb))?D9?>ZAg>A)Ekan}-+9aS^%O=GB@h20g=kuirGds-Xg} z#;;ncB=drPv&8w5b3$Hnar+j}${QvcgBXB>NgucY|3)>17szp=0U+N$-KtwMRA*RB zlfCKGh&?!_bWgM4q2=rE3QqN!9EJwH_ zFMpU9*<%KL3vG$W=`=ao%9k8^W5X8yX6I!wAh--vjboMrNDD77zMI8}(BhaE|+L61J{2aHwQ%#@d}H&G5-swf*wFx9R&G)K~2Fa~`w^~Kn{Sz_7dlkf#$ z?Pne@(}$PVeE#f_4v9shMuH@{tyV!Z$HSBl)-|p4ZJXRXv~wCqT8DhVWem)pDB*Te z^5g(TFAgwu9JYX@1<9tb)=ZkRZNw=~xaWutV4@*Az%6ti=JaWKtL>!sFoG)%lU4Si zUx_jSAu$&qh4l%f#8!=pI*3leA{ZBYf`!>z@VN#FGwG=>p3T^cnm-)dzU{;+jmr|R zKET8Iu9KF^@&K1}Kf@??m9GvuPFnjy;YXIAUKA@_{v9?~!?R9r5qh+w+KKu7qsMKL0)1JVfi#YM*2v zJ6o3HOgg#0CSZ@i+oiuXVqyQzkp!bV7!zWW;rD(NQiNcW0owk15LDEFIM&y@NY z=yf6bPSvd(geH^^YkPl@=?c1;Kksp8IA>KD$+KH)a+hB9PSpO>6TOM&c9sZAMkBFZ zCb@mR^|DDbS!$xvW+%AYr@m3|=W<(_D@>UH3fvtJ^KN^Dw3ydt%AOwO!fQGNH*HkB zfD?+O_D~x|puo$vgPx!aGpp}`ds4WTptmC|7b>w@1N?(>cNzFu-AihLHZXSCtb{=s zqsil+ezmYZ|9QR`51`^RsZY0cHkWc!k8ff|Yn%b$bU(f7bLYRV>`3~~blI1>P@19i zQ5%LezsNuxYFv;3^xlUks8*H9qulMctMv4_IUO@*X|i+&P_t+oZ*aM4m7#J-R10^w z!jW;so##jmrV^^+B3r99i>|@1LA3l#TlS(N&^KTkHWnhhRAoY{a=tVrttzYXb#aSN zAG8minW86}(bOXxgU&j8_HjY(2@YZZybNhyhZ?o$4lseL$Wy=CP!rHsT?;0~iXywq z|H4)BLyby4II)UWL?+g|B44xq%9&x)_Ig*5ddp;11!nx%Yc{xE zLxYm8^cJf1;~=>xWqqDGFi#kxtqwcM9pTaQXJ{EiXJNjmb`x*pn%hg&aO1uCT6Pr+ zq>*i2*O6QvBaMi}xH_I_@pQ_95r# z?qLiy^kPhS_ru+dm`WGp_J{`Ni_HxN>^_hfgxp9-rcUQDtZ3x)3mG96WViq+jx7>pQwS$ zU$-&6`Ve^ycncT6Ue~5wm4%%dmR@)V=2)2%UiW~HG?(f2xP=d#@@0A+rk{qWe09;& z@Xx-Q*VGdGyYV(BQ`?61e#Ga)Sk)f2P7edbGzoIxP23(Kq1>xu=ZM$24c8WN2z>{> zYxPCLS>^{QT6YA2bQi1izL4E)zcS5`&s8^Axa2L1Z?E1Lte%Pl;m+>q-o7^Er5xef z8UC^@#qB9brRN9LMiW~vZBYn-Knuj4bnynf!Km6dpqS-0Z7 z|3pD6{6W2Twqs!RY8U>(3Tv;A$0JFv(`-;Ic% z@ROSmEKN}4(RG8tEfeS@%r0ztY@KZdY9u9?HU`ix+9=f?L@|t^r%dQ|^+6yxKj(io zYxG~)?!VDO+0ExZ0X2C)5zH(${<)3@gy!`ZXwCX6 z{`jG1in-c4qBnA9je*Zk?Si z-q8K%=_Bs&%Rhjfk^|0^J95%PlyjWlzP=!x59#HKDQet9e+839 zmkN&ie`y7LS$*WlDXQ6Q{QTo6zRE6^A!{@buFBvS@fo;U@*shH*)`|!|E&;?(y35* z%jK`Us_l7}kmb|MD?=QZjefAtB)!ebwKE;y!7@y!1?bwTCxbR3rqQqKfB_N|Z1-H%a&=rD?mYW#G%!n;#8=T7wp)Ou%W`ZExkC5|s1?TzbsBc5)?CB0IKD z6`PEsf~kjOZtGE@C^h9hY2Dr@FN(h(X58v43YDP&oS3uh0|pPg8t0FvRQi(Mm1xHbW7SJlk;%{;Qzkpv5W(K`VrO%WfOwj+<(olM;C2 zJk&09DjAS6lRQ3f+jq1RpL?V*vP%+B1uP?7^q!ox5jQG$@M@Em2qurKj*$yuu=Wj< z(74be z(i3_Cw+D(LmefkN?KltJUt}>wN55_HOy}>M4quBZ{`=^@{SSjn{Qt-H|NgsKg=}q} z5<^y}o*LLYFZ?1aXlg`S6-66kM01%*lf#Y(vVVT7zQz1cl@Gc38Yn~WX;F*r$IHu6 zz9`p?;*lQOJze z@WvNf|J#i4+YxtZp$p2xetn4zK+BY1rVzL-!>7&_mzr^S(2?Ln^R~Y@hL?uqbW}GzKl2(nHom^V@?_Z*u%S4y}Zgo2850y35e~|)I^_K+u$>I;u8Z^ z!EC3G{9Ic;qy9GJexh1ldoC_a@t5t};Az`p?@GR5sB57H!yfyO?_sy$JD9q=78t5yfLRc zDBph}w(8F=@BHaekH+hF)BG)iqj7PAPVo0=)ti)UHVW zw$VhBK~7kEy6w@5n(w27&T;OkAP#p>WA(^mrQOGWLjH8~k1{z5vNOKBIk8`ya>Vvf zLC&e_Es`b^AO|gtldYWs1O4`Z9l8(=ySZnrY*JUGmN%r98H(6T3^;!;O*$hZs#;ld zbabHi<+qMr#f_R{+{ZveEdP%+ z5QWR7dbQ-^Nz~R}Ml1b-*-4llq{#Rtk!)m&R+A@n+4dpt{d>S-vzBqvAG-%2y&P@Wi#DaO ztpj5Mi#2;EC9TqL{LC_c$T0O-Q@JxAJ4t6oMN9T8#HYqWZQ(m>9L0=PvGu}P0<{iq zX&TmT!k&t{G0hi|cwEKWZ2y&H`zp;^j#B-tb=uj)(WFvCkcQVIyO5m@N z^ooixSXu(cn7i6lw1Qg5HT^!6-GRoEp#1x8L{O(TcNAQ3nWtS7Y9U z|8efKe5sXl5i;6lH5q8^ILA@zsQAJZ)^PN_|4(bX_!Q5sLdOZiH*67v3aB%P0#Deg z~JA>Yaq7`Yvf{i}}*oln?NHexJ)4k?AXLkfL)CA}0M=az@K z(v<9tc;!=WdNIZqMfASyvL+pf1#XTlQ&c!5&aGnGwr)pl+$m2E)JIb^fz&xjq#y zG1OJ9EpXwOpfe`*1!ZWaIPWZ=`G>%AEZuCnZJgS{0Z-)DKGG7efEr)K<97U3?7nzv zLRI$TxqeMpj{2d~6!V<+csgjS3R8zaV{XI5j0|j_3$$ru^-yjS&V)=({7{b%rFvZN=THeT_kKeUu`gM7di-5CnpMYE+YdV}km6KM> zHH&xz)36a7u2B1C)=sfNLAP!LKr#+U36`C@x6GPmZAAK*dr@lFgM~D{X*4n_yE z-?1VOcP#wzQJYthe={K_0Oa8)_M{hCq%%I zMrg7PR_aAR)Mx4zkQetc8^|)zo%p9e3`%q= zogM|E`MPGFAuZ@QjLBcT>QSL_RYk|Sn2^v{PG%FM5-rpwwE`(Kwc;r=dEjOZ`z(iM z4ZGw$px0XR9;wR!U(?9Hz*q{ZRc2!E7gnVnO88FM=AgZ24ZbYbekT9F*n7{YHkNkJ z*Lyn?Y?CvXY_b6h5OEumqX`m-XmU;>n&iE)!6XSJa<<7Jf&~anwn+k!gAf^G5SSoL zFgf_@oC)VW_kOuEv*yFBHTu$})z#hARo&H9Pd(4?4|?gl*rg#{UKL*=99xwY?>Jq4H#u*i0`GbcDcWpm7w%9vMISLaC>~|8+}(Nnp(M9c^`p1GtdtvvKqWe= zfG_nm!5*j6%nAAVZM7n7I?VVosU@w76astuvWzOkYAM)u*x|#-cJdhr^;~HuS_{=F z8Ed8qRtu=kzgF@v_w+Zk-zd(R|xN+ulr*9dEA{TVm~%y*_W*4gxvBspDcFie5jaI>>OT^R1o0h{b$r+i|Bjio?DO+{-qU__! zI<+vXYRgF9q?*#?xlg_UaMNa=lE!*xQqh79qq-A7ACJ=?7jQ~?jHg4@uH~cNQ*vcwz!LA z6FZhW)zl2mqP<6q*GTE!HRefN%QJy3yw@Vd#Z1CKV)Ca)E7L>~yw5TeUQd>0y9r(5 zsuwbFLZ2KHt=5`pWE%aetVP3q;0FT*%X~a5>t4q14p&AnSPxFPyYb&?9`%omo#nAP zQr9dz|JdS${n46W>FjP%I)=9of<%OCczg@mOJLuc7mkJ5MpcFS#^+Ur>iv?S49H5! zaVb5;Rx&tSF{i|BUqQ5?N$KeiH&`ttB~dGSd@=O$TXMJ;A{Gl8!x29c;cmI}& zcZA_Qi_~62-X|}}=jDYXgPsafkOS!_!eUxRd5Zj1nc9dxtG65j9O+Vh**X1$cQeoku=|ketb^4(amj&!b!2UW+V}U$?X|R?zyIROpe5`h2DerERa~6SJ zy6L&6SaX$YiZ}3PP^v2DMnol^Xa@7sn)XUYXefI_5-`kF#GJlO1s(zKLXuUnx>O-W zYQx#;q}IZ*a)Z6Z_8fdPzlh85Q<`II^cN>+8jHK)`Y>PGvOP?D#d8PlS{yF?3sIFW z+gwh-fT1BiGf(BJDXu(AeQ02Hqylc~SN)C^CRuht3Xl452=i>&DxYv44;vWCOp>Hd ztc;^u4ESjZdp~U6e15wR_4*%ywX!1u}K}lB}NHoaNUQF`^*t$i;0Pe{+m;r zk|B#$EP#2SI{$>Sl=?lZRXO^*gx#D#I{xXAisil^3MJ=Evapz5-3E*&u`(Ssn4C3E zc3Yx%j0tgcFUk@%^d}pRJ<=E`MK? z$U#RK$#i8X%woN^uuz!3eS>{SJs~T+BEJ^bH}Z7|de>_}O|QGdO^`u|{oqihRdatr zG|f6^T^s=ltud1%=_Eg zDQ5K+L3OSI@nqC`JXmrEDq=NdYWi5hNHA*pqItIZ8CYbreuF9>BM4H&mv^+xQcH?hWyF8_t6%ATZWPi%np%Q&1q_vhqTv%^96Vp=?(huT zphKd>Ek3JlRz+;rcB zOdTvm2!>jRT(Y?x%A89#3=R>UPS+AOO9y_-7ZindD@u4GblK+0*R|Q^2xyWixS9On zRb5rQvmIR8NVH&li`%AG&R?L>o5!MFXY9eJ!|3pqe0n2d;%admYM)wh9<>s5(&-E- za(#?Z=>oPzHn7s&&JfOpUzgPjWE9&zL6$>)VZz**B10y~E6_P@dq=di#uB&_t~8D{ zUgRqfKvdRUsUL75>J>uWzBAp-Ewg27v3PqsFB%pHmA;~+N!@WUnd6Y>QHM2Lvv01T ziBr3$pfW>%aQBmAxUw%cg{%$Zh*ykQG+1up9t;wLCV8iZP6}nU2=ul9?;49+q-G90 z!ZyI;9%SjIKP}{w^#>rPSX!p%mG z*IV34|R#u4hq(uJ|4jL~7aW7QO zQe_zvGcWJPJ$%F@>~OlJarUP{J}CF-vS)5dM*SDWvENzHnUb}=oOqNipM{6?;4b>``gm zM^}YJCG51}-Pa@Ozp&Z^4wb|v{hxyQ&9)xS^_skCAK@rvfT+XP%L)rrwKg~xBP!Ep z(;EUF&e4ZCM5(yM`RYHc2_bcR&$wG;r{A@zfYpjK%z7}m&0?MfO^Zm+=0lK-!wQ1Y z_9gUnuZ>h|G_`&LHtDS292>OGDr{?X5@ffm&)x-nM7TUYPjh>Vk$$yz0u1aQU(IA1 z9d}>*k%?lsJ(69jHe+&oKmp2M+kZ9PDCY6k()LaW)pV!*$g++5p7VY%+Qg93w_#?} zF8=b7vN_^M6@-}pV8^@H3Vkh6)FYxHUMW@?3`nxHbHd$c(1E08i&fsx<*fbzE(>i| zEXu5zm8iZ-fZuyWcL@`;&(9>@Wi@vrz3e^VdFCKkg{h_~>hnIv-)=31=itAO`_2vq zR^0-%zGL8?APc^!)4q)1#+fkjb3&U8G6JRgRvQiP8k|&o$Z;AOq#D}-o{^QGrP2%7 z(ON@cS$t5*{&l6wYJU(r-qh51(pMp-g!3UKdyYmkJL0?F5F%-KmGxMuVZ|f!xMc!J zUQII^Hr3?87#T6h$)6lsrvH>t{t`4EVErsG2-EDkSyyb`n!Y{K31S$7@Uj395NQTA zkX|1TS&cfY&gxtDSYJJR@^s!kQ(dlNdwm8fjfD({7?;9N3^midyU+CFc_IctFKP|ay?PtY-%wLVo?5T zAB+>rrdWlfa^I^ca@mH$oVk})_;no9j$Sju(xr5g2SnZtk)^Sz>^DexU8^#B0=70o zX1XD{yHdwoLZA_U<31IButo4=Gl0?1p~oPv0=c`YJOLQ>$A_Z{B>OsgXsVOB_iFWY zyRoAhD1KNwOOe*Mt?*cv&3dl9ygZj2m4ACT!~|~$Q*0>xQX&?Na?hIr>$A-rdEwlu z{*2e(xb-}kUR%3lUb3mHGccMF?!&&1k4|t9$X&ApC}ON${FmNt8oln2D8Pz!4(XEj8!Se9z5DY%Hp!c# z6QT`d<2|?5Pq;5g@okqW83~dh*%veV%@w^jSfcT7md$RBrk62Q_6=9Dl0Sr3Gq%QT zX}(;IX{D_W_X?l32xBO6p{Z+kZqfEKa|~~kD~ulU)Sl~~o6;zBlx+!{Ofc>gdIOqf zKeMXW_12*;g1fY4$V04Pj#ACnHDPO-B7}dR1`0b&_u8oN<8Y!}Z0L$d#h?Ic<4#Go zQre29ithR383i5nONY{5T}Td=sgG+Pz>(>G85K>wJ@8hjDjg%?8?0URjgE9v3$isJ zYpCg^)GS3%u(s5MQ;j`Wtvlu$hVIb7GU>xbS{>CtKRR@a;lb)S;buF-SpI3Y76+7j z+&gdO^m?7Dy>FK4WG5eQ6KT=p_6C~AUg=-OT(p)?)f|d6FSQUi1SAXp{{L&n_#e*q zzp(uFB#`d=Pvwv!!iM^h&FV5$P20poa`s;h6IvV7Y_V6C+n^E&&laZkomozgutBEP$FWUy)vfAnXd?s@XyBu7!`+S$t+wVb=J?WW_s_bGEE4i7z?aRgH&19PsqpuW zm%F7GcWNhd-24kP4?R4~>H(lQhM}ycaxcEqxd6>9-8Pfz-`BCLzlP61R1Esgq zzWm3@{%h)wY3YHv9exp16Brk50c-&HiN64OYpY8O#f~d*_SNcIdK(KBEv8NwyMH-a zNQf#mrlY7v(%sgILnxS@u@XeJb*s!bv{1&?)wFAmge%eM66#IQ-8Gt8F&xiAw)CNe zJk8wpKoIMcCt%<1mVSYHU7}jHYmgk@oBM->RhN9p7&ADC`NE`WheBRAwmsDivKbw$-+ONdeBY@igwz`TTG_%EMxb4AlPq>L-o@0(kNfTZ25dm(alUEu{MQ8H9xZFsTSd{3;(Hf z4b*l|b!y%{Cu>`SEm@P|T8650+5~iF5H7b-Xu8E5!5+6YJ&#eA65?~AmASX!U1{;?{{6IZ|;LcB&pt?sNe6>pL%Iv7Z&^hmTOxfFhU^Jw3yC@nBgCz=@jW*M3!SGb~<#k;mavAT`q~m5K9c8Cf4|vAlti^laJE?~-Qe3LmHP zxXisHa4xXrx>*Y(Nw)trwf$24@8OD0W*!ZtTFA27AN?3zOIQT$9ZF zH-D;~$9Ha>>;*m8BgC?LytRt>=(nmxa9G(6IE{(Z8!2NQ$i4o8A-1UJcUW0t1Q^ol zW^5kqTFC{}Cq8wH@kO7h@<=Ha`Stpzjeu;gmtB7~H+6dfM<2-Bo|2ls@vf~@`#tnG zM^}DjlFnY=OOd@l9duiN{2(WW4nx>N^gUhdx;NODbros(;3I!=7LaSY*`mDS_l;!| zgZK{!!3DMeT8#>q+5itWO{@nh_tgKj6}A@5xa^EVPuJk>Q54bt4BZrJ^_0dPVJuaR zHV3AS;$y0sV_}f(TRc)xH%WZ%HM{O%lXzw2H~ZHn8%M7czFIFT}!i~1(xad7+uNdt?t9(%G>zJQFpNr^@~8o&Zf+r7;GQ z0XimI=b?V&g8mw$9uGbG6+P2n??0JfV-t2!e&{bF^3#1H8}$oSqP8I@+ZdV z6I(!4Y%#-ALh*&C*chm?7C~VlzV!VO^w;~-Cal3d!zDTOj=5CUy1a`=>TEwfUFq3YJ2C3P4 zXY+5hHusjF9ga#*$bF1?GCrXzS_iCx%K%2h7GUnemE4DEJGE@YJW|Y)q5!0>NDjLn zmJKwD_z5jy?gKE4`lpda2*?yc3Hndpr&Hck2tDNYHssVN<-sqHuX60tBa0hQ6$1?5 z*E<`?8V29CgxDiad9cCrU_*wKf-p(mjD!!w3gb>gibaZ~LM4TGs#Hm~& zsF*fVFzinIEp)KP)~TE`QpjdN&?&L%OyudvIT8I9wGC0bs2;pP1F5zbD8Sh;S3=Jh2*zQnRZ(ASHt|w8ARhr~Zt+};%cF5LDk_JVdt=owJq8JWz8^E|l zSzx?qp_|>n_c8ZLVY_Ex`rXRw)ZYj%BISKoktPfH&)x=_hm@K1`-ZRDm(Nr_rF=I3 z##8W>8x$1nml)t_@77{dJ}cbpSY;?$yXvtN!1w1K+Q3@M{C?GcdX#Q^eBStdV=ifn z;r9*VaA9Xi!0Dg3$NwqIzyH~mUYErx;9EDs3?r!ESQuP6}@*sc9`AWGPBH zNyYK=n6Z$a-!|o=+|R1=452E}Yg63{Fyjp_VF}5wFYF1+6S$*$v`eU$a6ggdVn}UH z>hEAwHn$s=nrs!B$~P~r{i~k2Do?+=WVZD_n0or{HOM^JomWb)T9meDB$8ql$zSV^ zvRQLj!&V6m)oZd{=|-HVH4r}^xW0CVXR9nei_%xCs=Ke<$M;>mKKMz0gL3#ZksAyV z1(Ku%m065h2Ft$r6)8FgX1v%UM=GEDr%g&v?aJ$8yqumI8&W}b_}_h5a`=E-1r4}& zrij*k8T9nnKVeVcR{-1ZB+p#k91HTI3!i_o!#uEESrnX@%@)jgs9JnNabY}LCqMU|ge`|^lAMHfX1B{)4Z zE)o%QwCRjmm+*Mb^SPAp5S5-+={mG4xzP5>2-iZ-0jN=t&E2av39IMP zwz6KFD=K}}{F4%~if?iktTHy2@+Q;S>(>mLB1g1Y?@S(g9p~A}1tjw}lUXSgVxUn!`nos3+4{ zoaZ@{YJm?X9snB&<1!vMg^$uX7Z&sVWUiBOfs;OtHpXVNA+4jR98DCM2WYk{(3Sd8~G=% z%a$ZI{O=lSOu#ZQ|w% zxbWu{*v*K}qy>n{+a;KUAspawO8XNQ*_~#Y=pmpd+#kbjd&iEtnGkzk zD3aBq0cV3>t-70Xu%E7# z+V)(l7v}zpxw&iwf};?rw8XxwbgT7F5!chUIN`hUfoJkPlg!aC<8-vIjKQ=5$}i|@ zxz-nD7D_kQugZ6iw!m#yE($M%w}J}cu2tQ)21rkfoE%~C!GwSc@H}h1F=lO{rW$?A z(C0FBXOX_}DA!5k*YpNe(sN+oPGe# zubdKQ`Oy{Gl04V8%WDJ5^QD>7A}3gq6|#+P&63h6xzss2)6=NG<4Fq6sS#_&hn8aI zia7H4dMhkgb=zR|!?d0kP{hf%+P{EPLU`5@UX)+C$q0*ejPC`vZ!i4-9pHZkAZ1#e z(zQ8~uf{@Q*WlfcDux$qB;TYr{fiTk0}6&qxrVDbDjTTLE4P*3H@a)CpPW43l0CC* zd3U9<iZs z>3ptB`JdmD0yvA_q_vhCPG0w2SaJQ!HIwpdRgTKY;S3L2Pm31smM;^%x9G@@jOY%+ z-2>Txf;xlAlQO!~)&EQ{(gC9?#b<8c9cpUL3G&>1ZZq5^Kj#xC&z_tHY0(0>rsQ#BOwLZk%^FS;2gj{GC8A&Y z#C)KIdd7@+?EI7785f=+8~OL%NB8fY&fa2K%OH%_CD6~u~{`OYi(Gv#%Yd=-g^2{Wux9W>uSWwxToYFD@@<8$s3duUuE zDP7uJKS5xJOw5%k$(Ejt2XypCyjQKtU!_6LyEjGu#B3PiWV6zkqNcB&f9~y4e#h<` zSy)X{4~AO3s0!UyEv>?iMl_MGIcLjg7r3D z-A>C$j<+WjGT?NaQN_0JI&Ule$d5a2zLI!TTey#H%gu*J06Zc9pL1?&qR3~s`B&M%w@)EEm>s-4KQaJrER%K@p_K98i%GqOQ}LubkL&UQ=e5cT-i$wk;To? z`^W7ngFk=Y5R!cyKJ1daLSU_GD=InE@dv4CL4&QwiUDb|?iC_V2C5G-o>)@&IMDvB z>L&a)BOcH=Yc8mK-L};?C+>A=0&#RO8?<`(6S`NuF&+U@**~{klX>-U#jsPC4*ArW zm5`WAjlyZR&s?auX?iE5S_VR^O5Eej;Aj(faX!R=)LUo9ZGPmJGvt}s14>vRZwf-7 zGFT#I)1u}@$ox^Y3O!c&dN2oTw|!iuY`j#@P78UX42!8Uh{#$ZYG_g!YaMA|aDlT` zz1G2ZGe;MpGBvy$?!WQ|v2W_THrePR0Z122a^KXcAyNZVUIXQ}QA^=@QW_t!qtDl$ zC3)rZ=cCU;epkP5j9EFb>|ZCny=YU6c=nYl5cSoD@wnIK$x2+?;XJ!h5$jT4b0f$|}_ML%XIsnSMJ%S%G%Sz|u&)k}swW0IK_zOP53OZ<$8f=MlazeV) zE$07NoV+gfQfLCp#50I~6;Ft-4U)6dIcjB1^VHOV^^0R!XOVpx&ckjj{25&sYhf9g zmV03?R(~P2{!6png%n730GFzl73RXWHh(mXB1$gLJ2BXwd+#GfJ2Sa8c6E|&Tt>RvZp8q-aaU>o53b|nIlv$9+e9I z3bAid)*`v6l+IC)Oo6|)4nl0V7YLSL)|@;{QdgsO49pI8Ups`TAAL7HHA0wl14>6fD4r5`1#lL1k)^wFLjb$iuw0N()MFx%h|& zhqNiA>c9k5ttzu0U50t{Rz!L+u@BkWbuMhOHcfvSn6X?K6vXvod5tXAY&iBmB0g&d z{rX!>F|LGvL`kK4*sCuc4OR=fnSCpt%eFZ0dn=E7ePy#jm@x6lOC3U@}=>* z2;Vq3G_GOAVle`Gs!lHAbONUGZW+LrYvP)t@Cc>LwB?l(5ZvHMa4S&Ic7+I4YSN3i zdsBh(bC6SCQL3$%g6`*m;%z#B+v_`tg4?vv`YknJ#iVY5<*@Jr=fNQ7-l=)!Cw@o% zG>NBHD8fQ)$Ir_MThxyN)4G>jJglJ~4m-sH9eoM&hTv{W$F!|-n0>PmV;d=lG+f&x z-d3=7HTS~t;HG1zpCCYiuZ5CPFG!YidYR6evURCgx-70K4?{_;@a{DmFeot_ zH7=gEwD)-Umcwh?LpDgfwuiPW_*e{^NjHQuxh*OK-SeIxa5JvuJ=t==Ox`K#D14N+oeHZAi^X zTWYlj$3BDYURhbqeHA#XS1NlS-kLFFTanniiqiGrPVRgb=r)O>109Sy_l!9Dsk8Es zf$KbB^FK}9p>C5+$ru|L#pFV>JNUUpwJX^aJEFV`kqA8@86N6Xsf$F{OM2mwN|%=EkQrC9@LfDiC!ta2RyI4$c{kaj$&c;Lxs6C-qn7T@2yLSW1RUY?u)|9NvBU zYGHQ@-e)2b-K{TTw5dH(A3CMDzb7i+=2baMM@Wt8O)o3!CW6=y5u+`zYi-VtDu1!D z?ZjeLkm|)(u*QOpnSve#vZA=k(JXnE^hfJy_rgW_GTCL5?$;maj{f%tS`7v0#>ta; zy3@BCrlVIucE4|Y@xFd~qD-E?@rAy-y5Z?l$9;(u6WsA?xH|5+etd?P{(Zwb^UWSx zXQI-7y679e1nmnpFO>+iO006A-tQX(XRgaTKUW|6?-sp5YL*+0-RZmF;TqtXi0qp; zT=q2l{_y`6?0=!gu*{#s4l!Oq28W+poc$*u+nMwa4o1WBRZX=xJ`s4`Q>DC_9@uKUAT^=uoHyzjc@Ppx2vBc+wXk>BHC)Z z$cvB4HSIG~!(|W`@4}IW{CBT&1=DiYdVI%cP4v}^)@D)f7O?%Y!WG0I?-ZV1;kfFk zEC%D3hY4!SN8%;h7@0f~Srgg!4IP%H(N+VSa~`}%3l<6_FB$1{(+TEW;Veh=uw@(P zphxtd9-_B_?YcrTY$~dr5vP$%j$4Fzqx{W%If`4`xB1vH#jD zQZsDn_bd99#pGmP59~tbN_L)%A~7a?0KygDo1WLqo{&YgF6P&L->)Q~9FH#x01ilgO~B$2Pxwg$2Tlf+MuW>kl`P&1 zInA&A?r_!pq#IwY_)h~cTRV^<%Zf2t&-w~lI@5a)-{Ryab^?)0*Q=O>_Sq{1^y|6Y zF$p?7+Y&jhsUb|d&m2lxEB2~u?_;dcHD9yg9l8?25~1ip4#PBh+iun$Wo7oV!nIEp zBUb9cdNK&{AlFuJ5)+pl8GQhCklaO<2nYuijdRG`)a5oC?T^xpv;Bm$K6-_C{O^_b z$F$3k4?GwZJaU|W-V!P%z2^2txt8R2aml@$AhCY;LilQz-P6ME!I%G9*Z;nmwlV8z zM&bp+r`}7V8s%P>m>L4R;&_p5vAE9z{?U{~lxWs4a#b0ko93U$pqQIngdJ)10geG{ z@o`T2CO(8?HtUMP)iOSaSdcaijnRmMz$hW0z5JJ>>!zc-6n_|>U`%*}+-_-I!>ES1 z&+U}n?u9nMB>G6I+DFkB9wvzdd)jbbY|imd&^GPEMNrlw^rkF>wripnO@ycX%t z3s#>oQIG(Qs35C==Qiq*Mn`5J5epnf4U!Tl ze)d{Jv4iCB*rU;uw(>BkqD?GRaG7b3;I> z)?kId;9O>|5(P5XAvNQH5*${ge~GMfIE!0#ZSs}nYg8lx(A}ab;XIrUmS-9~5tt)e za+wCn=C*#T@YPb}_tMJhO=YF+?BkkgkQ!VodpPj6uR4cBROn96P!2wC$h=DGyR+Fz|3lI@xwQ%6f{e)G|{W zYiokPpSAgCa7!=61klLdUEVar;>$#P{;c#duVdpU)BU4zk;wucy}<+O{2n(fb(+ZP zvNdM{PTd(?_TZ8Y2dt{1MS&w8b-W_0`{uF@QVRygn*(JcrDS2mz zw`lf*YVlieIUmxg@2TG}@NQciY zO`l!56j-cTs#lT)4${B&e3$`EJDu;&o;6OX1Msi#9zqm#PMSTsx&Ws+Urbs{Oh&7` zykFc;t)=oW6bvh0LyVbM5s3`ujcj1&NK5p1JL{CTqhD3jMnB^XTB9E`;eO#GSNA-) zAT8xaF7V}1x=#^g&haf(^Ro9UB|*}==`JS$(FeEWWj~Pb^VX9imMwz$s>k~|g(SYD z*<3_u9nAyyEY%49sGflBy5ER=ju_72__4+D%wda~Dquz)0;m!cnlQKn_6_medz-rD z=<5@qVJY9K_subbN1IQF#X9>Q+q%5Pgu#@a_ibi^a-X}S`%E0%8OTr*c#i&AdF5MH zp{(x@)~aXotnqvZmYs9^?t}<4N|6D8nviC~GQw0u-Y~>;8bgJJo9URyqP1(D@U~;R zX)D7>34wAsL4ICzgEG(}hpMEwUQ7zf;vo_@snYY-vk?9=c!NLHWFSnEuH`K!t=LI$ z0>mPry0>Wuy}hk!njOEwlGU$h3%_6xZR$0s(XQB_K!gisqU=&F`Ea)fyx6`hJ!G5g z$O<&6oo5&K3jO81x<9hoXtn|%i%p5u3mNs-95P9yS;(Ev{kT9bakKV>DjC_G#D>GF zi@Ya8J>n6J5Kpsux6X72D2rQreEd+t{QQpTL~n*LkgmV2l4vl|Z*h*eS^XrnJrL}! z0jlHxcN+fVs`~A-Do+#rG>?+v=^O1&_(JQA5vW7K=XJ?M&kaBc+6Bs{{55A*YNF~) z@!FC*t6z@@f`~hk2BF>UCJS{#yHhJPY+XD&Jlvw_kgb_SFDj4>A6Z7Na;&Pyfaa5F zbh27*giW7p+7ZYG1Tux?SLEg`=c-n^DJ_?xcEuPn6&8BHOK)E@UR`OEjGbBNdFdLI z-~wjVY|{7nEUr>0n!17Yvi21PGAaJlLIUAJ0ZnC#4ud|d;@gNMhSbi#OMDF4sVk2T z9}z38!${)7l;T=-uBpY)HNW@)#!w+X((!9|Y*0<{w(?57Ys1lE!XF@l(DZ=$dj-&* zt{97up>=h%xHfIDiLFw_PUA%maR#i>;lLm9y75h{;>1Mm1fitWJ*%orf-!|&f}SND z(O#D%PC|o^fHDP9n&SyvBL>1)mgtWqd$V63S<4RdF-zg|9Dcy}$2nlWVP5os3I_Rl zj9>K`^)y0rr9>3Z>jgz_mjal#L*|t-+|Cd!T8p>vJBC@VdCv(gZ{yD#-l2Q;ioNxMr33Ec=!}hw#8q*cA1i zo%1M-ya;{s?;CZV2)%Fbv2p#LuZSa5R*nI!cPJSeULBmTd)JG9m;OBeIXBJhqO2sc zEv-rt)m7ya00oZYmfy3@&GMT18<`X&3|M!sxf0Qb^6fibxD$81~4$gfG# zR(T;sF0wijRnG!&>arO+_8uJ(KsxWkGs4o}qzH;RXY3kkwzFbQ%Qyh0!R~ znmbNs0;V1^I0R=vQwQjZ0}Pvtkj6+M@QA$6RIZ@$r=cbTbCip4H`ibl*{?YenDI^Y z(@BxF5=(9#eupfTtJ!#eVURkE_BvEHIrK#eJ@aA__Nqd2zJbN?PuaS0mzj||@1OT+ zK!rqO_mBC{N2G<{i6-8fbUiD_`=|0T%UG2fvOb#8iBIS%qdXq!xx4qhNf*y+NpKWr zqg@4kG%eI#$60u%Gsk0s01{LiL&-V0A$^iriWHtFp98YODRWORS#IQa{Is1odaA+# ztmv(As+*CrdbNO$z;d9x3jECCSnEvq?dX()HUef~HiPPYjRmm?PvoH5EUI!4?0j!= z#J*%HwC>vc8U^b3wOU|1dEq?%$EAF+Hh;pyr@%wkuXPok?76c@azs8$*ZXeL$9g_J z2YF?R!ZVYHbdpn2WQT8YdKrb`ZW&YN8b-XqSqYsW_ zLBlIFphS>aXi)c0#)(U%J1r6@?pb~)v`r%OGovJ^gSd)&Ly4`?|6V1;D+Z76fcv~qcoUTZihDlt}x@6-m?Yn;;Hp^?f!+<7Jn(<0qY zi`mQ_6(7=>HI@}_t_CY8Z02K<7Gx6{o70d}rczKFulEy3xhjmvs`x?@4(aNtfrohX z!Ogm^&1=+FKuqX?M~eI_9daEz&PB``+ShwBuw$O$>F)b6|Fn`3J(3Lp~4VYZb z?_b5QrnCdk{&=;Bfte;`i4~xHh8}r*LhV(vwjhux9`k?bA+)t-j=h(kC8U)LL?eae z?G{6a`Hm%MkSsD;-yO=&mtXEhJl$uT+=)b_&Mh-|*}8u*M_LE-20?hLEvnjQsfJw| z@o^ucEYqYZ1*8_^eb@ZbK43_I^V}2dK&zTs#QZrqCT_-UC3_Qk>Y1wVY)pRa4~CzG zgRwY#%#&pi?(BG(1xbVR#&sl@fR*gT^1JhlY#EL-x<>w=e)^d7T2-Qr600*Kch>~2 zBVb+#$7KNm?F6Wa=W%D6UroUu|THZs}j zmsmc-lg0rOazu~Bdv6GftOX3O(8Z2N(u@ZLm(A#3j|@I=4^O4)v1bddTrI1;nI~Nw z#vowHAjZ48QqgUmX!H8imWJWG8SATMo9u9VLT(4q%R$@g?s55CBHm_GYI9LaM@BdV zzCGrFlN5f)zfzV(L-$#$1p1;6l}0-dpB=~bi~-;7tjO{xbM2gNuZ&P;?1B zuyWdK%)Cx^)*=wen&GNf>*;MPWa(5+*sJlF{8lr#Df2O5DOf)A*x3?ogf`?>SXMRv zSeJx?OlrW8p~nsysO;EZ=DC&2YT#OmP>bI;U>4VtQxIjr0i_1Ps?mXY@7!l^ACQ;nu;<~k$LtBtK6+0t zkY?HK@9nNFmb#1v^qJ~pw#C9&^_?~9xV*JX{*`Ve`usgTHOs*_ z*XzuY2gbF@Xt3Asd`j+}X zuBsmRr59sIod|BDylzXF#Dbw}<)vAB@LY)k4QJfKbkSTT0qWJBq`P-jxnBE9nuWB^ zo~|_3IONCwdewc@g3a%EkdqoB_;i#l0~5gjLT$x6geB=+3m;JGdQxL2ZIh1|(ZI?~ zlyu;Pr3|puV*(uqQ0SGWMuID7y_Q7rsqvrqY?>q6yR%qrgKmBo z(3|3H=h44$E}{Aji^DTreVYfY*ERz6JfDgfwlH{MhY}Aw0=Lz_mGae(6i#E|xetU# zttj4GgOXnVg&|okzOWeQVa#u~*)alG45{AXafy(8cEqTMFbYgmW0m1SF=!^`JxKwJ z-K)ovp)|Ks1vSw-%z1`4GiUuzATOx@!CDSF?)Jl>&ka%~@`C}0!U0hf8^b3;Ty6Gi zn|`u9Z5V5Nj08(C09h2*_hno5K;}b*E zURS&I3h-!wepc?gv^DcJebU3C2t}~{$>MuJ!7Ld#-3liZnOD9%G)GG2R(S>oQw~}? z|MJ&;m?6KqEdwq(#jlpx(!N$Im1wOmjhSzmt!k+RXb=B`9nSxUzA;GI#EdJ@ukrn`Da_6ej`$0fe;lGh6Jfm>x%u}*xZakWm5sDV1CFel@$%?3 zduBjGQaqEaAgy_mg}LH319AaIn$qb#)(jn?>Qq%JgYmZfNyjraTD|cKMmkfD*<}-`Sk|T-_T*1n));>OgerA+ z1;A!~wrG`_;)t^yi9Xi3LU_yhPS4m7)kM$bV4?YeXkhHr8Z^rU$T)W`BLB7FmuBe< zsnw|Z9VQjiQ3z(Nt&3vK8y`J*N2rOpn z0m0*bZu%vF`|Er^`gHR{)Ei~W%<~ajIsC1 z^3O;IY_s#xkbiFyeXnCS&>cNr72>3Wtl0R{|6%p+UZ0NoQy;3W{-9dUiRl<( z#KR&mPc}12wQv3tR-e7f6H&<5TKohb#-5)P?w+?GlHJCVu(!nKkhP~>=YvoNa?ve( z>RU$-LD7RlA$KbaflT=7V8u|LT+7g3XhO=lbN7Hv{`{G^(N;^Su6)Y`C%}8zW6B}B z39^kHVFftdA|96dtsSSd?3BoSe06Luh=_NRQP+vLu6h5x%pSX&xtksGe)FQm664I- z@0-={gw!{baE7qhF!N?Z4rrd!Pjl>yJG!kyPk-NV_xG^OPRXtfe(3OHNqpqb>G?_O zELnB{WAn-Wgk<%waU3iFsdX$RKZ@9iQzT4fN3+@Jh!P91q{gW*%=WthFzm(5OZ%)G0h_%~$5?Y3Y3aWnxa26?CCkZY>4IA$#n%jz+Xb?^SO4jsoSe08R&F#foR#2kz=7g!He{H4w!PpWj z&0^N7(0yXI*j>6O4%&)vvin`j4CJ6!XuhvOBGr`4idq{O-Tx8!Gh<6r=UMf<3d23A z3r2C>jKaPbN}*I~86><~HFb`xpaY{Eb0rdz7KX>c)lA(Zo`sCbxKG%jEMi)5{)y6@1Y9wCW;Qaarc5eLCd#u2(%RQ4_|CL zb55fX%kl}4*OZ_r25+I%Whx+h!{xayM3nF;DMk~3-|XoJ>!ygTc_PgIam?o56&Lod z4w8K)H`^a-d}u6KsXki*8J?N>i)A9e-%CM)gN>StS3E~Tgw|lD2ipLd21z@+enisI z&Qo(*h#CO0wx4-B&uXBc)95sTB3QxWnH&=IWtsEvAVWpV8%d8|rB*sAK6`D^B%+y) zO`zan!;YuSD{M;-N{1~4Yd;kjhJWRh^*z4Lcm#2LRtsm&+&HLmuE2Ep%i5DeVSBu=?|2%;GAltvJk8CmiQWaPx zpAZ;L+N7COoLAQQv~}xTV2e*V^K5dVdSOhM(Vj@1xu65s&-txaI(&usgPxXt4=(9G zGd!O7|4{dqQEjbTyfK*GBskqTBoGJ? zAZUvOha$nH5Tv-f^k(02#=UpE@27J<-J6k-9cyt~Rdk42&t&(iX8hNsgzDvbRc* zbL0f?O8Wgtabb3}4s%Pdx0d0a&v~KudvogmGbs6 zVT@bKqM~kjmH_+QfqDr&2foeDdfAXs9q%Irb)H_u$KZa(f2`jZ(97tD))Qs5AH4kD zeK&^)yO?~Wn%t81s`@ttZOzYL@nM1KhkUd$jxAYX1*RkDu1sz1o2Q~CEQL7Kq+wt4 zv}akw%t{_-$n*ytz)b}D5LhXY#1{1#>;uVCxo2)a z7lB$)-`wYR{;oS5T+*HDZ^EqU>)Rsnz%ed71+CU0ZwZO6z}X((e@i`Lqm%UU)xe)o z!sHevQT~ikbAV@$xX5Qiyf%P&)3Gu3VJy>xp9Ie`)TA83;?z_&Nn;-I@5k;Pe!Y*0kKYP{W zYF@vs`;In<|B;zoE)rky!pFA?o}nEsO|=&k`;FwfRfrTc>oN3@sU;gyMn?54qYTO) zRAdCDv5S;Gi_GsfLK-^A#hS((3-4eqTSwZCv;c=vb854QEUV!At_4x%W2-_ndId6- zO(M_a2q&5XE8_VY)`>NJL`c+#Q%)%}%)oaWx$2~%ZzT>tszW%tCU?eL5RHrmhB(w; z++0@-_0IQU@jBx&-G;}veqwtENMn=C*DREEqD+#Y`)bGIrXSDknEJq|?n5~e8>O0= zywpN#$1hOvtHF;LNgtFS7u=9pq4HtEYuO^Ivjs>iDN0rH$5KvbH)nNT9TsQjXx9_T z-k#_-6=!gK4dz5pb9za!+?%AJ`0r|m6mp`o34wBIw|`YG3Qx|6D|5zei}GnPRhNok97t|I zv*P3X!t^V>xfE4DWF_=JAR+&8_Y&nvY@I7lYB$Hlc7fr|O+9+u=Iv_5WpMF#Gvl63 zaqe(ouo1tLyS78>s+dP^um0qvdaOs6oTwwqc>Y)Ml!#zgAg1)VzSo1f!3>SW|8hoG;uweuW2CKIMBea&dyPMve$} z{aV3B`5#;LgV4Hka($S}nFiYKWpTBkUbZBl6dN&X$E$fpIp~ixW*B%=&a4I}E%qYV z&@e8lX;tNBYImvD(K`rCD~Fqn(nva$T$7BnTHhl6@nfQ&3%J&!_+I|&e1t%gBZ?OW z)ad5bs6%%t)Co&de&vxtCq8$+@i%C|l!WvY%U1{SGc0%hJ#9SeS2+CsLNWMhk09VUxb z9^IjT0o*)}$7G%Jh3LnhXwHg{`glWlMbyyFJ|Wfb0MsyJU^PdaSCt}31A4`32V zH8sD%mC)R$FE^($0af>GlpA;CX%iVMpTDnM!@U{Z5SG_~R}fDvd=aCN+zzD7WDX;! zS*7B4ff^d8&%$0{Gwm1%> zQDl!Jd?^$ng7d_*wq_Pmi>yR(C1lu1YKy)@7~)CI*YXn1d5m;V>>WMsAD@_y2^Oe` zYas4>4nK6)&gcPWCy4;nB~QRR%3MVdJEWKwR@SKYQgXa1J|tjLgu0ovE|Pg0t;NS90d2BWcg0@%Y^iu(vFT$hEY6(zbGgl?XX%-VsC%c@8e&34?Lbr|w~Nv*qs&Q|8lFlC(5wZhoGJ5z547_(R}aIxLm@H8Fk-Aeb`y>plzwG$Hrrly}I!w|LPYKZfpbdg^Tew2|xW2H8M09njQj#Ae*VzPoIf&JK_ zXlwZX2}-Q_E0Q$+V`NKsZ-V384`xwj@_xpzXq7$aC}gZU;_FB{zXvy!rF zNB!~(3_~}r{d$X+Tfxtx-&wLZm0yt+G^uSJ&4$Ra>a~QPVZYlF&q3^mia0CVn%BPH zc{{RCt&0L#@}$4|s#^Rje%$eULKC;U`{n9Xf$dAvBW;0UB}xZ6i;X^EWz;fMZPfp< z2^&FmsKwn>0mL*j(gz1v1qK#s$J}SN0aPR(M zd$f2q%OHzlXK!7SQ(qc8X3SQ3tvG?m{&`#$KD00UZcXqce~~MSzsBnxr(s9dHRy>o zuVGn2k^aY~A018|lIz`~co=`0wV(MI+JI+muFU{6i|Y?QU_Ce746$(Tb@q=blhGw+ z8&0lQ%H1t;--?wqz(){Jyt(xs@ujhm`u&T~;`I_-IHz@_{z|E%=Z>kJEvCQT ze$wc4G$k`3`V+z`__U{=Bl6Yo_*0vBlOUtE;?b*u~GMC7$qy7G_8W1TX)7rI`ZZGejEmG)_6fZD_KHk;kCIa%dj#}3YYOA^^% zXFDD1V3)lCR_Fv&uLn#{Tp%@Jj4P^o57#}@mFQ^}jws<$OawF=hB*a7T;6UxM>%>4 zF=CK+y=YIIObJ?gW7t2JNfH}4=oSeyp{;DWK^MKy=UdLS0CEi-Cp;{q6v}s2u0IIH zbgCD62tA0$v%Y<1Rjcx<&*L!6cN1xtgBW{hvJXH+vxK#Ar2nP}9iT>~1JO-~^DlVw zM5mB%`>0A!nwg%OL2J{Pd>*rwje^btRNM8KCt&QswL)7!PiNp#X#6DG z+1ryV`1o%M*`>5YtJz~&)q#FXQ>(MLqqW-AxX)wE>vp3{KN4g7&nuRGWobzCo;IjU z;+Q0XRCps`vQ?Oi5m%3Q8%aflu+?;XN<{xTbh)~4Z0c1Cb&E3UeC+QK?kBR;*6#$Y z3acj}Djan7(1B}xG;M>|-+q*(+&X)-90|I}p#HWcKGfws6MhkOops_uv$X`rXTxPB zxbj(^^Ccg?+qc|6;bS2Fas6=3P@{(vz9%h7e{t$*z9Y41hO$=2jfWFW>rBK&cCIu+ z-XiR4uR~19&%i|z!?ZZMq5M;HgSgs9{-sJYp4>D(-ExtcZkQDOkEz`d|?Wu}GIIDpYuphd_{n$8D4=H6ED%yXs# z`4M+=Z&a}tKVG5hCEgqJay^<9%^&iV-6kJU%YpI`ysxFzWEK%=ziz8s!0HKoVgDr@ zx^URKCRwEKl0US}$>)2AZBbJyXkj|PNnq^=g*?aBd@zbBmqD%@6co0l_s^pZUL@2y z8I~CI4kU@4)}L_2-FI!48PGIQYBNgi%2WCCl5hHP{NF|IeX*X5DH))6VA+DQxp&d%_cz z%6k<8QI;`*PvXUpmX-HTI47b+%i7P&pgiCow(Dy8cHUmU0NlC8ZNu%@mD;WF=!Qa~ zP#XUUMxCR`)C0K5R|*hGP6X=g^VxQr9Ej*obaO}H%pMS_@@Lnn%+NF}@ncy3@ox)h zQ(fq9g#3?CZ_*+c-ZECpc+_xRVN&-FFvh=1r7HnY{@=wS|JhnVZmK}wT%x@6bolz( z7qon$$>nlTjXc>aIh!UZV`tOggy3m=zY6gD|F_wv5{F6GlFiSqL&bwiXHfv5PeOw< zq>!CC_rN<3RfGMQMQTdX7@IbdZeJ_mdm? zm(=&HvYD?D6NB|eUuTEuyB`0V`-{A{#|)#Q`L=>pT0r5}a!SYMzvo}r1u2x)JLrbv zHL-3Rb(MOY8ED42lnSyA_RP4jEv!PH`(r{+XLuU;G7}fU46(Eo0XdQ~>3frR8*xw*03WJuiPRI)@iL>nScmyUg^|HvT%_6jCEIZwoD6Q$i3y+kcbSo1Zx<51M zwDmSh9_(@DjYJ{@h+A?j{l%58?`o`LtUuX-g2J(DqV`GLvRg^8PkODKpJo3n4=HMP zB8nj}^|NLT*5&18(vR>uE-toCN|DCMdHx-onSD+Dcgq8fv&AjMa2Lja8~}{jbZM7u z94rrmdNo5k)RR>g-*Ib%Ci69~Yu+$ovP_xMw-5mk+G8)VjH6nk@t7*+P(39V+`Sp{wWf?Nv4C^mX6dXxXyAuh4Gorb-YemU-Rd#kK22r|^Z^G{uVaiv-x@|c@=1WQ!W^CT40e4zi;Q46&*EQR> zn4Q!GpZ-~b*JN_DwJsI`oxLz6QU2QG!_eB3+W7P5)d0GWJN391yt~)=d_%^~5IAn5 zigO3Z@Ltp;?GW(P2VmN_3FYnROPgkRIn5uKL<~kFdLrh4EO&|HMr&g{w$Z&!*#@iI z@Q8S2bJ)kX5<+)>Q+$exLKEYDQ-q|eCQzf$eK`>*r?=eohaJrCU?<>NpuIuLU z=S8FJnJ=0PIS%~465g)~AY}0Jdm|S}e7xZ1m z&)3wI{|x8SS6HkG3KkS{Lh7W0NKt0*TXZ{m{OC z_oT@xzSZoHHVLRTu5<$_RW2{+iR`w4Z#i$FGjWGK3>QHd4Q9k;CC2vzH^Rd1{#~Nm zru%X+wk%F^qKZ&v?Wm|l?jF1kds+yLdi%78dFA`NwoIV zlWq))c)8#-|7xvhcDc}*>gcXE+Xi#No;bzE=%Ew)%sb&_vT*WM?rCa~5{4xC{b62Y zsC5DIyRJq_Ud*$-=8qK#uAvtZ=EG0h32u(L!*71f8mHjl0S2>C zuBqiUG-k_u^`r$a8C%%%D?luxh9=^DvN`w|z2qXbj>opTJ+vHO2RQ7sGKEDtc*dX@ z8TIV1g;xO^cgVxT-El)AI=_>!_9|&0P1DyJlD=%6DwE*^Nv#xX*4s2Fzg5%Tgf)yG z(sMexlgq-l?yn12F0|Y?AR91}o^cDqTBkKDu8##>-(`{&+5o9-mbuo$V60d$M+$ZPa|fx zKuWqV9fZa`WvHgZ^C}#GF`j<+5|EHmg5uYYR38uGB6b9xA|` z13sQ9)omIEr3y%}r*0NRHP8Bnr@_aO#n~Q_lBc>2hwA6;j_^)YEhpYYLGW+yp4j5o z1d(wn947y>#~oVnWWT<5D&iIL0Wa9EHt4iz-b}tAjYfVl+ORFpY%kqHgTEvOaP1b1 zm?zsAxP-yB7wTPw5LJ$~Rt?bT)z1!-DQq`sH{RSl__o@*kyJB#{D$*~ieo}Azw_ut zxzTa|2-AM-X6J`pwi_)pp_udC37D=AR%EnN{dJ{sH+A_tc0)cXVYr~+IMdU(e2j=oz75kfla8K_5@6NHQo)Z-9J$T}#8K`Eaa(+A+ zcws`$QmbjJn16t$xE{nIRHia695xyKdYn4^w{Z^jni{QmFBU`iqHOCXtCUVX`n79t z>C7qsPIhJayhV<-mExaWv96hC{pcHW1Fc;bmD|4Pcle@|)V}ahuZdY4?y4f=IuQow z8q;J%b1Lee2!qkTP+_EBT1R-h`pEdsl^WQXR!p);rCh=EF*oL zX8o)8s<*i5mkeYw$h91LH(=TVB{y2Dbzx!wD!S|rpELI-RUX$?G57=bNt3Tt*e>o2c6CvTW5QG)9LbMVFqnw#p#M#OH<#qsBqD)-DBD1I8V zAXe~5!=L?dq)3`y8rM6`dWP3Wa2I6EICuCh2NZHZqGqMOjD3p3o0Tb+LoZVbORqVL z*Y`yvMBh8kI!%k0Djc2iE#exVmKttCcEMx^^;|eQKiFppslxdL2(}KZa;UThTd(n% zF1Z^=>VK@_UMu6N2HxBs>JY%@&z>gX?L_Qm@6vwY;UGWNG!U0ZLq z=ZdnQ8+&8L1p@CcIp6ClPnfKpDVrLt1Zv#Y|6HcqV!uRJT&!xAq#BMSU(h zS5;|;t#&g5eoglD3FBU2O$PcTO*V|a$JU}=e)>sRn1h+~ud<7JEhkD;82ffjUu=dU zf0+YlXBv?(T60z=#}M#&$QnC5ox&oZI&=PGIK6@HqwKKbG!HSwraqu$th@rU)MnIl z8%(qc=TI}WL*HOt`y1wh+dNJVFwyvgOp~#nw65qjjTtu&7QR(}baU#xqJf zgSRyvS=ly`b35T|L00GN@aUbTjz+QXn@w7MV=DQP7N&iFCQ9sA`T+eE1GX--wzjpa z^O^sTTphR8|IXFL;s1|ZUGAa5j~X+4|5cFBTLH-XYGqDO*~M>_d{(>yJubtg9}`gW zTO5kZ1^m5YzWwRF2_9ApcAQT%-K}Ow)DS}RRm`X_OT~x$>h{5%XbY2Xq|{?SvtkQ) z{ux>zWXukPj)7HZiasl~LD!w{xN+hbF{EF&an8U|8C#_a{KTwVf6tO55VLQY@H}0L znm;>6b){}aPI6|+K*7APOhx=oP9N^}MA)3H^TxDR^&0n4h6N87qV!!Y;Z;n5El+hO zttVI}NL7`Gl8*3a)BI;L{N_@qb&o}Gp~QTsk!s1qG+8@@J95oYd6`c>T&_@S2I0H} z1qO1VeMgVR7bO+?P8|=Dm7|eUJPTIWtXMI=W$S?tu{`~8EC*m|FRG zyBXCE5rA}wkMbaM)**J%`pn*9B$KAA#TWcrsA?%Y4>hK|MUxj}t}GS*#zvF!kpzEc zh=twLR0rMKDr6DHaB0xgn&f$EvO(udj46L3RZ%&-Uan1jh*tO6c5jgTBgt^WQOR-> zYKDKCx6!}FyPP5vo?d7rR7wKd+(JTtt-*?JiRdFKMkn3#n-vSNFj1{H#N3w}UKk1d(Z}R)f zKioua_GuVTY1($nY&=Jyk_06uAG&tX=t?d^AhEGpj0EB0F|p$8B?ld9nngv0DK?Jd zfB(n-1-3`rE!JOs%0E3z)Hvf21jI3eV4}UYYzQ7-4E!TYIaXSxN=x%h`NeQpydE!2 zzf);aDnZ@yS3HaF9?wYgUzWp!Zm(s`pywU+;Nd;DR(xp+I<;5auVFf(-6z(~x@Xo7 z(g27HWngj@0ME_R?4GrFwDDIs90lrc-~ce6tOl-!B@vzHVmsv)ah*2sY?IVqdpNea zd2#yL^jIU^VZ*ApOZgFh=XfXI%ony!;m*ryum|_wHC4(0dov}qBqs%p$4P^;iI$;K zj+diqNKVstb?SnTlxJP`g>vxzcrl27Ut-#vbu3)py^z4f9@h4ZYTbW5dd zCU13r#XVa2{ww*(X?PR!?&^qBv|i-YF%MoA@#ENH`hdFAPVD1=l4_bJIGTzv1JTo7 z5@*fBsTnJz>1pe;J@tvD|D1w$ef_LRwU6rKVcUXFk%j)GW5)7US)!+KuI>{T7dln5 zfM@GI(Go_gc}1^wE9kspGfMHgM!KGO5!I(f;%|bT3sSBucuJ0BrHMfUVSjCyWwZTN z`cGysp2M>HS8?$wC{EsMDo)WNejITcecwgo3Hf`+vLf zWM^^|dd}@(l!;Pg8utKnW|?`w6ZDjxMY;C{ql#@tmHtQ&kq{n4AXNG38G51~r*>D! zmz@-?6`l2n`HI8zwco%+)CD4xx5-w>QCehxd83*4I+Ti;6SgWp>XezMN5fLLD~b>$ zW$*m4S7Um4>~VR!0xOJjIdhDcW-dO#?@vywJAn9c{T4ac1O@bnKA#*7ao=k{Vu16G z;vV&PL1MNFsy`|IMnpnZnQ|pR`wB*J3GOe!_q9U1NBSp@8Z~dgW9=HsbV>0laEsJj zxWwZB!$h!RPRH5=6QdNFP|-SKu0sX{x;+p{dx!#RD$o)P8#ubW)V>saiS>@timd5W z^<5avj$Fw|{o%=j-Rpg=yR_?>;Ix6STLh`RL3F%3?%=SFrF&XybOiUva~q32ugtTt zEnN>+kqRJgzFn;Ke=6~nS)?#fJ*PSi5oPMhr5&?O z=!KrZKQ^zWmzN7^#>83C8fSXqsWtcMbnD_=ARlV)hKl^$+Zx#tF`t8ZdJzzo zhPUz(b_?T#Anp2}2#=YTr2Hf5EoDH%mzqvURb?&?RZq}z|18+g4VPaQ2vb7FHbckb zUl>=9n`qDa?j|(3yG^-GluNt*NL}__EgtoAUVwny8a!p(&7mWoqlk9B_AG+J8_PcX zI#?@Shn!a11pfd0qA}fk6aGg=2gc;%)lmfp|H#v;z~hM(Tk*^R-nU&pldAc^Mui*< zn*9d3V^VOMSUR_G-OZ?s*E25@kfxCmCYnblMU&Yjhw&~yJT@eId;)@-0aE&IqQ>Ph zk)xugrKP=4D5z3AZPq-dFTSTpq;wz_qbzL3A)1}OdH8yE{#K>+Lai*bb&8n`h$GCz zSzU6vdUC1Ls>9H1@ zv=%|}ihC-EMP#tM?j{2Bq5j%>=C^x<-|9+P9Qf(&=C(C+)f5C-YS&DjcQcy#r(XkV zc^iPBc`3LZ%`NOSZ)EKU>oLG9G#4kc*Ut`7Q^+%MtMVwpaK|ji&R<|L)3Ap4B>luXsKs8@76F9G)Q-(bSkPe3r8Zw=jQH5;(g^uWrVc1U`Z>`W&SGR2*>-~ zF=3elakgD2=puE4j~wg^Ya5I`+dikPN9;3dd74b~BhJb0RIKn^Y@@ifECF8hzzE+e z6`!Zl+C4$^unI93PK=#0gwaNjYE?bdyp(mpTzBI{taVMV@2&oMn!M)peM}BveduVl z!Wd_~t#{9pk70uzO3I*;d%`elNN#oYDx=03wqCVoYKD`ge(En(171q`4$A=p^)KGGm%5>_8_TtOG1J)U z^W2Q;3Uf~$@eQ)f*e*_LdTM zX)genau=#T=ULQqcxjs2aNo1Mm`nP!E}oM;>bz76S-TTM74vP&xnTM_1OJO?!RKPwR4Ep9EmB?8 zv=z%yrJi02m8G9V*{$Rz`oxDJJbZD(4>%g#rTr7|W^KlUAH;dmJGy3C@odI3We{Vs z0s|6>05|$nkvOWRr^W|`oCQb{RQZ=mB-ZT4b@Q}(k#U7O81jDW^vO!^`|#QqjA)O? zBD;5tzuRPZUfnd6JZ5(?8~e$p3wS+Zyc83>{!-dhJ`7XtA@BO#aSm`&s^#~n%+PU0 z?o%nQzg@1Eb&@*mrmZ}KGUKqE-r_UWnmzs0dKnB@L=jxZ>UVn*Xe0UH)D0|t3>L^N&c^<9#A{;D)+W+7;}1gNSlyY}7-xE1)PjDfW_rF*ZKx4!%5zHTVSbm zs*v(Yql&gT+NX~QL!got1V~1#f{ay0s;l_;icUOoTQ`zj8I-`hlx801M$G}|%bace zvc&dArScJgZlRoSu1m(hIw>^En5EW!Z6q83$Lk*j>N0n;qr&A~b+mWiIsfsYS+Z;7 z=-iLAa({Q&&Zu6~{O$)E`&m{&20+wH(z`r;uR|>L4#aqlcKZmle0k~9*B~F(&6Vh7 zZ<3$b%~9wpwG<1PJ3-IHZOx?MFko|?5;8OQdo2DI(U)fcnM$I+>(0+cb660`1CY4) z^2Cu-oMlc*C!L>@+J7$t)J?Tw^huOf{^hpqye%R|HIK72p)ab6tI{d^RI8SCL%Zb4 zb-vug&a+dl@zl459ogIvQl)P&q!Dg16790e4lOcIJA zJ$wDvhImTyI=8x)BgZ`mn*m>?rA?;}HW}IX?6k=LM^}8UnA&)0rQk$n)Gw%^FRJJv zXj#wbm(jUz%|iJm!`;n(b=m-Asgi1f>c_nrAY;h`?({~jAR#U41LgT3s*~&;ajyWq zM49553qmZLWmL(giKtKUy9*P^F*@-w-H^x_AeXVCx|VXSi_HW-9FbYIv>%xy2mZcq zJ#y-NY`W1k(0~)h@=iPQdBQ8UZOC%M(_>kp(l#rK9u4BA* z;NL_oNup;FtB=6@O2+}f_T78#-1a|SD)(rQ^OvV5lq~a6a+lK9jWTLVuv@3_>QTp& zmJM5t7R+Dp&{aP1{n{=Oo>{9aGF7DGYnMt`XE7exf4Y>D)xwotcZn3gXT}Fz=E{lh zp7gKIcgxbW(CYW2Eoz8vdWdioQJXB%kou|)Do7*NOo<<)>%*%ztKv#03dsg2G0OZz z2HXC3>AjSSszX(6oO&we%U(71rjvQbmsyWfOjJGGGEADhBD-mHQ<_xTm1e3;q(ic~ z_(Wea7}Z&?WZ*;`=g|zD4HA6$b`gNS=!Ntr1{S6VyQu|J?CovX3rhF?svB0sQi)yw zVQkt{#P5j5%!7wZMfHXN*m_8~`)OQ4pHcqkBqyQp?P`zLY!V%k%ha#Z^$q233Tp%2 zRwSuRHfqhX6a25SZz^v0LeB9@=LP@g5$Aup#=p8H-S!3!6VB#lyeRtFk ziDzoovA!E#)kUC+*MgkrB>k85?6{|!KjI)TL?QBy8_~x*gV`MvZ7wirL1|QAmp3uG zWl@Y;f(mW84W2#B(;$HRV5c#TW9aqCio>*6bLq*aPX@54iy_Ya23m3lxy~&4<$c`Z zo(bq@9l^#cH;r5>E^guVdAr~tBlj@N?!h)Ky_w$W&mR6t6fd?vso0HqQry)UDG^l2 zc15`6c}Y{`Ys}8wb3ZV;6TQWIU0;?Brj-*rwRnH!M?6v?AF}hKvG}B*4GMp3!__M? z_Do_=dw$8IAi#O_`pn_#=lLsKQzYRYsAilIAnwtuMJsB%^S97N8)WXINo#KQQ|YNC zkqqCpkDtd(G>g2d?U|^a{m`6MuW{C!aI(-@ni06yU4qO8>hL#_v#)XHOf!R5)?|hT zO*U=IgX9z6i#@Zd0&j=9ZZ^zFJPQI7mq@3?->fvM2sTd4AI2wi{iXngxo>U-Jw)h> zEhj1ENdz`5nU|xtX3cn4bc^iYjNOgNbnB9)^@Z|mL}YNukxY_Q??KDPa%6hm;vLa_ z;?8{kl4U*@+rMdqZ-gg<;2i12Q46AN(O;Wa?kz!U9Sy0UW<$)4Y^}?2Oq{q z85Te*-z`B9<&b|m`M2P_vZ#pSrG)^E8u_BWf1hplna;@#^2`-7S$DA+5dq zb7fahdm?bg4zMK=9u}mbjGl;xW208`GGn*(abW4p*yX04$euhOEpNqTSxMiE$`Y9D#x;4-4Pk$u6Kz!{p z6%d5^Q3bNxM8Y+`<9hEJ8jp^EN8=Ksza%Sjfm68=+Lq0N=ba;sDVkCi!&HfzVxqn) zfI{gPi7Bj!9DKuVR=I?Y)QiNX1fWn4(rLCw7b!kj25mB!bs!gvIPNIAo8@9AYj>D1 zBL0E;n`5X^8=SLy61i~eWAaKEJhIB?09#)=7u1B3_1a87P zGS`U$)d)GdOJM)FX5wsL-`Gog-#(&QcGVwz{L7A-vt0gkQXWb$QB5Y9>ErZx58gN{ zTp1RMj(!bV7mMQZ6)e&Wjw#b$$e=AXl~DjqRzi`YNlcQOG7w(Of&z<|7E&aRJh1Gv zkVZWyzVtsPJsm?_`*#7_z1 zM^p%`(e^{=2cL;3SY(m|%-*e<%!;P?zO`GRD z=;j=j-ChbQkp4zN!FMojcF^=BoDz>Mowt4Tg^}Zn%Vx?dSZ-|q6Q z{Je=lT}Xz_Ck^Et_RSh`Dk6_Xp@Nq;kY#0%J{Jp7l~?U|GtLbB>PEg(npJprl#2ip ztV9Hr91G1oZlheM&PT@6y}Zs3`rzYs$l|ETmF}MNYMh0ZT%Htt32X3Q)9J{z$73r! zB0SAMM|pc{%~wmD1mC~M1X$Zh}!7i6h6;C1Zv+X(oC&!Iob$i6txc?$ZBw}betB0&5H6igg-!8aYo(ES17LR zVJ<05({M{I5On*C2RlwG*UBN}O)xVpfY;@1W{*v+Kl6EQ8(T;FFw%-gbEfYdX9a0t zt90}|H_R$!Hd+k}7U*0}F$URPuik>M5~f4>6n2>X{Uy%XeRGA*XoE(xk1X~V%T;o* z5rPjVmo*Zia8+OEBVmH@r_FA*v@CuW8j;NSZJm0pMYdGD+$$?gUM`8H4&WBGlGR^R zbodI}fUI@)#oP0NO&m}H)z40OwbBgDNc>t#WnPRMx zmxZZxixpD1$hCgv!WY<|WNFjh_o#o{Xh;r*1^(;OA+u9#6OQ{w(nPNFW1t5!bCTv{ zTMUfSGClE8MmiCS>mrMp3|E?{jaN`YFH1V9RJe0<&w+9eB0N^^Xg+Ir!Fepf@=W|Q z_Gz?S`WUAU-50ko!MhLvt)5iPXR3PMyt!B^dQQHBWsz5XZ@bgDk7E}?ItNt#xD1RQ zm#z`16LSX(oBip=Rh81tj!vJb3AO4Lw_qIIpJvs1W`-z?II2&R%xukqZUhSSi#`|M7=Sz+i9|$vA#biUa^+oL@GSRL^c5~_}o~Upz$2lNqpQ8Lmg{-!x z2}>oDolEwH=>_W&ACP7Bp6I3_ZDXQOYWLsS4935fqm;!q{lFM!p6}~aK5hSNvipDF z!+)T5|JUPL$gc`%3GF@4kdHEReEJyJx?#zZLyhWrOvbOz#Z3PD!dw;LB`fY!Y#LO_ zs*olw(H4Cg9-o(NK%6br+Y`bYX?fMg8IOXtp+IWCjMig3El}GRo*fm@LXEU1=HhEC zdHYv+U=Ya6!Qx0siS#I5 z>F7KPG1S#ULsmeZ6WdBvYXoY2Q@+!+dWEp1f(Dl>Z;1uklpkPLn8W_uN29H z$q`Th@Z{o*z2*I0vM`gAZk*I@VhLNND)U1FJ`Rs4@M^-dIIupJ+(2Ebv=Gr$rU>Ow zg)@`xQ&9X7cAXg1N#DlyBW&;}1E<)r%XPNs@tdNKN&9DHEd8SBnpx6CLD?p_~etv=K(kO^rnKIaMAz6*w_5AlL zcSg&{_!q24gu>*gc9=HC(S~{oR|YS?#1DeJ?0gM)?zOq8{N>^Nb_YyWhHa&CLfDPY9RP3g@It)%pURh6fa2GL%_R1-x#(=Dzv&3#eL;l6w$%t7z!9n02U zC*CnG(5a~!cfist7j}4*W(a+8yD;G_HDT+i&XVx|0)Y;pXQ#~~(q^DHVE_DZ1~kJm zh#o2KxG!1P&%R9S^OzR>gq_$jW>#sib>7)A_@ zW!D?Tpi%qnT2%t~J$m_+u0d`#gPzi|WiU`%TRskWdPOrA366b(_o8Pl*AVyoJSCAO zU%~OjWwxNoV$#Mz^qKu;wn^8~tP;@4&NY7I`r{>}Pcq&&CDQt_%k&Y2;MJ{0waVs|74KUjCcH;vj+49hcvDu_B_C3YS1gYn_<*L(+(}`8}`u zoqiH_c16yo!UoC|T~La^VWqaH^8sDObxtK0CD8YfzSx#z=W?RO#Toc@0w;|M+g}#p za;$*CR@iCK>eWAPfNT_O60!p)L&7lsAnz9!?+Eue;AfD4RyLVUQk zP5k|-xNwY5pJh5KTXj+IxqCb*>DdH<4e2FOsCa_oa9(p`0?U;XT4uOf)E4$%$LJv> zO`a?PyyW$kKc}XboI6IMGX2%!xMDn32>zSQqnpNWb zFRpO8mBz{*%vUb7s`Mpl2kf_u3-``8T#U2y zs$7}8VWcOO&^b*dZ*9$gz-`3|3#$RgCLZ0L8uOe+GwShK29DRtTG}NRSvXXBWIWYf zXJ3)i#1Hj+W)IiEOqR#kG={omepwez{D2M_7OJQG*^82n-u3Tzv_9 zCKJPt#7)uEfFRj~uJf^lWk8-U)uBx~9Vu+qNN30>4EU_fk$bB?us?UzX~WNn@%WMG zTZ0Z+=^yoCzQWrO7&zr~*fLK-)cH8HTg*h*m7hkHDWQ{^!7}#Wv&jDoZ+AEs20NvP zRaX66uFOPe?e^7!GRu!UuNIPMTAdF9uA;6_2l~G2Tep+vY=Lt!o14hWdY#3Xw7%mS zN2hYl1^G?kDu2~4s+D!^NS?pXNxv!Fv|L=nXkPvM=VT-Uk^|>{nIp!!}RK7?MrM}Z zSd5V}_&V7R_`3BNUN9b5%Tp8aCPwL)+Y`Gbkz`b$ zy*}#Wkqn~IDVUyU-2hM~Y zO}W+!?6=ouM%@xEKC;9(a(DkXh_v4Xchjm8Hd#4u7DT|;-L{Wwy7MV9gts9Vc2qlV zV)UKA3EUeOX1N*!pUVC1ue;G6H<#S>9p5gY+=GG&H$B201g%+ApO!FgCddWsr0uN_ z9$(*=JLwOwWa#fD`b~hruOOxt(>K}OK9ff0LJM!h80niA`F*1>_(QSuwZ(;au|8+w z?tk1HVbj!WBm3?m(9+vKqGd+cNlev7sFV}iLaJ(*!1$st*pp79m`6;X+kRc}(P?G( z%_H0#RvIqcf33Ak-;ityKf`a-rb^B606Xp9;}K-eLbZEg43%%k;H;V*Six%cA|-Fd z=V~fAEl8CdHZ+aU1j(M;4~g=Q7jKab8#_$W7IwTN09zIyuvlOCY&3ay*!8 zM0jIib;9&FL9yJK@Y(}vGogPD-lg^0%T@N~WhMU6Bu{Tmy9H(@)$m^BsaWKOnxf9-vZ{tQS;OQ+hS{O-ZQ z`-pgbX70tPr=9@=&NJy`3iDD+-qP=^XHU5eMe7T&PfHj{@QzJftEVNItkKGYA)e;f zMqHB#K~y4h{9T#+TzxraC0gr7Rb%Vvr$!Tg$b_Fye$D^*=LrAj)ivSh4*=>UZgalg zRoA$=UNp~cEfZcCRaE+|33gGPtV^9%iftjDo0gTea1FJL=X};>Te%RO*OetX#Ej|g zlFEfaufS!4=8jya7>`AxcBBZxpaJu|1MakX^teHhP6(nY0lH;g?#kftDN6(pgOd%?2vP&koY5am!tq5K`CXU9iQ^ddGkb{ zvX=vy7ZWH-Q&X*+D)i)BoB0%#v@a@P;GA9c%{&**Qv_zd%)~T5!gkdMK)C(*s}QHX z1D#v?^<|9~$vm!s9V|fYzBD(UCo<@?{2A#&IJfU+Ams)XgOkNbSER!pi2Ghzi}}Y2 zgMJoEq$lSKlnnB~I=-k}WBFvZUW)x>Lcqfo2o_L|zIx9^QX1ycl*9&^OJ#u?jMo+} z<^`jwM6(jUEKfA2?fUC&N&57XjO_P9>~fQBbJLq_YWI{^G16bl=ug0I*?f4bq>{`_ zr+G5gSf@TbKAte{QW=Rev~%_&s;3dQzhl5lsw4h^E z^`x4V!0v!Z4&3Be_S%KcjLmN7r;9!7MdPAimqqnYIZ_fwnOs~)7-!cIymR)49mc`I zkqIQcvg1-XS8R{>LI2OdO*%TsvLe9Y$z0Q6TRC0;a(E!6-tRL%H$8qpq46=gS85E{ zAH_>iyjDH4(Hi}l2UUWfSN%6>|IQ{C<&7?0zZOO6uNk3o;$G85#PXZqDgLCfCjE9b zDOdA1foR=tf*X9TWNogvc-y1I{|LdI9IEA!{Id;(?{b$fmS6QAm>y93Ynt9dyMx9| z`v**Kqv*~BlV05^6T$yt|4j^nGi`j|3e}TZ5wzz}`{*K0bhjWXE`QFo{Sqx&vfKYg z62@&dQNER(>1VJ>M<^ZWJg<=07cXd!%!&Og9J2KAymx;nVRMJa4v4a?aLnkhzL6KCxGD+EouG%WnK>d&v8pb%_p5w#}Q%3MHkq)y6UvR)bqm zFYiR%cpbiAjt}}GUS-*wC#}nY{cVg2oyj_D3EeQ8WrcFD$j?UJ+ow{6ohgU|Q&e4$ zC0U(SrA`vWYwVOzQmIYCC~hW%Zwx&C5}rb%(U4svnSFxo&S(q{6<4uB^D~WTW-b+} zDRE>t0Qlabk)Z0r)o*bPT-E7(sv1BDS_-p+i;~9`15Vg+#ucD?BG~BEE71>L@F}z2 zpV49KVOFeGG|xmejc$BD)EY=1TOz%APnu{yvn6Nun}F(YVfXWD&>uHOZ8t~XZ)bf^ zb2a#pelE8qPy9Fk@@aEe(7)0;Z;t;>;KC>@PP)0uxR=U*y1a*xwDXBM%02P;j6V*& zvr6Z7IXLa#ab11&?IPocKNx>(>$Bls&FG6a{9H*-l`Cjxy!^)aYNmSJZ{(IA*F5*2 z|M8v6+Mug7wVRr&9nEA@*6WQMlNb1962V2_TvNqq`hh?1?YgY36XRH)+=8U(PS*m& zW%z<)O>6Vu!EN4yKGB_%bUZUM?85Qv&C$ERZi~%sFNS{;ILKb<<|JU{B>lm`awo54 z&8i&>Z*s3qd;RN3lj$FvAV|*!60V&8bJ+g)*Qous2wLr5o_}oEKx&gMG0;y&k}Ipj zbBEjX%TwQ{&bbp zIhc(uMP7%M3;rfR+4yFGCPHeo#Ctsyd!rje+ZXC3IDBHmT%kLZErfNv%WN^6rPFG% zR?NJ?-#a;4ke^^4K65%Fb2tF0f_7HM~Tp4mhRnX@4>;(Y=Il|(qc zrN&qMBFeJ=9@c%5E&{%AGiUI~Q;s%&M4O)~3YV?jG&x zz3K#Xwpw9zy=bN_`r!`f?4jQ~y`7tQW~s-tn%cX({;JnU;w;*=p< zmH(YCR^~ufPC=h#hE@-Hr$z0bvF9$ggKucaYQbo%X3@pa^5cQmm^Reczf}S z0cp7g(k*SHyzyK$o#yn#Ufy1a&%`G-0WnL^Uz0@>w*M;FB-g4;nD-&tnw zCZXLw{$s^XaOX43*H?eK(p$EnMxbqTr<|=1@JYPY&x;yNEo66}iz_+Xk&SvgSh=(A za4^1PTFgl&g>$){Ye)=srs;O$?>@G}E4^Bc{LG@Nu%~RLH)be97anm?2caPxOpe&R z*-?A8t@X5)Y!_~xl9us#;lyY)wQO9?19mG5p<+=iV+-q(ccI*DJm{Hp7%H7C)=8zt zeVTpJ7mOYtjBsdFu^Oru9V;x7AFzZ*9md%G$?7t#-d@8;-##F)cN+|!=tx*UlO_pixit)=w$@nS3~C%Xijv>1eReB5+O+?$BT7@l>Hf+ZhO z8VsYg?iM-l(!Kcc_XPg$@bYhH*2s=VgWlU~dbWl}2Er3KLBI6pY7D&6YzxB0-+MBB4?tvdH0y{OgGI^j5PculC(dmAq ziH8D?LSm7^11IC5u(ruLzeQtPs()=_;E|n73)0cg3ajpSaj;nSPngf^@HRM;C_*Gp zNRXjVna^1L={${pN<@3NMIwaV;^9gpYMo)Q{P%iI_aqgNe>w9LUfmTH3YQ3r@#}Eh zs&*;&*D&%7H9{af(cVRFETklzHvj9mCd&pXDOs@qrB3Bn~Cz3JZD zw=d5;s_?R02Pr- z<_wwvTyXc>1xl?Z6nJRf{wDAP7~g(OU!cR6bzHcEjw=-a)viD?pm^6L&TkkVoZ6EX z(v#^6lozwfS&f?+eR`M+-&LjSSL4U-?A?TC8q?ob>+N4<-u<1Ye&jOOh0 zgO2^KW2TB5>m6+YpGSTkss6k7N6wio6wbph!IrlhX3g%3iZzXbb^phN6uSR$Bqn7I z1`t6}Qm6?bRnj0Tg6>OC%YSy5cv+rf)zc9#4+}Q)^QV;@`-ajz)mLh13yK(Y+FcxT zW@K*?^j0pk6&06km3Jqsj>ZkvohGaH^KNI{LBeIMzI!Dq@w{%er4l4@!?GzjNz5pN zyHZDX^fjig%W}7Kex+lPyS5xxu7#sOjpZPD-Q)rX?Z>vBZ4%=A1mwNL8{3QHW|=EIV;d zoPM7R1Lo@ldi%;{ecmY!{w?rUY=q`FJ(@@3<#12#D83#aBq(UzYt* zBcgjTo7@zUnM$irzOXN?jCv+>)^;CE?c}(6tB zgDFoEuc3|=m0`J$;SRC@HBg=iGZoqjijB;$^ zt3JQ8+FXdYi@cxntp5-GNO}*C^nK?W_H${a0UNgt?&ge$-P>iL|EL>vqHh*=_~%=H zCRN70Dhr#gjZ6OU?Gb7kX?(x`qdn}}H0=zx_qB>B16!;vxB|SZqherhz1mM6CP`uA zZ3Y7$*C!v8R<4*yT{}&VL`1)F=bwqKxcVVxnviqz+9YLL%%@Q-ZvqO+xj^l4kkm?5 z74wbA7n)7Jzh-?g;y-BA_eWLlz7CTBzq9tVi6QWnHU4K`|9O3^EuS@AWjs()V)vv31}2JK zafR1DdLEMC&ce%uV~?QA#!Drb1TzC9xAKvhQ%}*0EhBG49-E}dpgN%9MmcS%^^c`U z1F~$`kd0>R-RRML^6$w?T$d8whHWg4{K*P1XUv|rLBp(rN_Qvfdd7lXV?h^sgT?3`Ne>SzcLTUPKyzRZL);o)VNW5u#? zNbLYn9;yxWeezi!q}+#iRvqV5F|QP=OKoPEMoa3=uoUR4j!YHpJdqd(b+oB4 ze|$cN)8g?hmzC0>Gf&n_5f-I;hR4|~9!V!9cX8|3HmoltV57;KS7_-{sx?Wtv8@jKqgPlPP3TFi(~-(d_D( z*0_-Rc;<|;#>S_Vm)FwnRI}Ckq-lBKXBV1y6LjnA%>HLz52GN=iy0{Dzoqy2eX1vK+!~5$R9}BTbR~ zID;DIVwXo^jq=R1P^fQ?_&NAQqzZg6!bc_-5A1pGko-I{d$KT3_uKXrp_RCJh?H6$ z9#6Q>%Yc_jsIX<4v8|9h?o;<$q~=Evv%)?QUv_M%u)|ieW-|}IdGT;6l?|URStiK5&`2*!LNYb~&AR%GD)Q;M> zeiJx}rnivO^0(Uz*K?eykzCaYigawmjsKr+(jVr}6HsoVb>sYEA`$tz82do`-anD~ zmc`5>S2p*JBb^WyG@M1n-Qi0CoUtl;RdF3X=0ypd@e#MmU?anZlRv9f_dyhwYZ^tG zwMi_|1^2aF(kR=UDe};v$$0&3u*KXIt0x^zH)=xutMXRNKF3h5U9wDMj&(tn(A?`H z(w@YX2pyP17I7~xPywKzFbNanDHuYZFT8DfE|0L(*PGI!nAdtwP~wwATJOuGtmr#m z%h>T;ENM9q?VdMQ5R&{kZrCYVCE*d7%S!dOWUaAj&|^9=cHog=m3nHcFA>RLEljIx zV}Dot%C4RJ(xhom_q`k{7i{K;OZwP)#%za0TKZwVTUGRnawSeDa-^frLv3b+>-`pwX=jn-`Fpd6JnL&Tj&?D$R9|7d?K z3#h^qgE#?9y+~AG=VRR`llubdM(4jeM1@c`G@Z^Un>IOuTaf{acb$OLER6hG;!(kP}eK$pIipbYuB^j5v( z!f>*VRZ+S9nx<;q?E-l=c(Ug7ZBYjd&eB94BL{lKR>6@)#cRk*Zx7R!4|{vd?ZvYj z=_)wuQCA$MF+FD^f$p9h!fXm0X0Gg$75EYIJ?-m@d^nMi!#5yuC~>HKB3!A)Eb!Mq zqw$X`rQ7<0))*Oov3|pAxzEZYJ-Wgw#$-YieV;;_1170l$OYi=r!wUEYC$gVYzXTR zPAYHN-FV}4O8k^b4WAMo*Rhq%UW&vPBrh;Ltu0`1aiMa(rkf27E-+i49qUG=|M_x% z7mAAM8SmXAzL7g(D;p(7G5*Px99R=2Z*l=-{mdB+;ev;d1D*Gk!`jlW`T+_Nq2)tk zj7WO)l1b9%d1=>@tpcF+pNJ_b2f;mH+2r%L9U4~kUbu3JzI#pOAZMOcqC}O^xo_8N z2${RMd$eNE7go$l0mUgUxdq;-J9K#yr_vx@CZ*{UIz8!PF-DRZKm%4#FO1BzZDmdb zn~yg6ww_%)8X2&j4I5T7rmL6i!0dWy{@K(~0PHZ%HyDgg31U*6%ja&fz+m|0FRSyj zos=ZKWn!bt(M|m}7`;x_;=;(=E&V>fcM!F-q;kw?9Bs$tt9_6i?LD1-3JXtyU%1n3 zS~$78H#z8FB*Mvd>eF||AigYmNo%E-*^98WflAW5H?$k`a{;pl$epS1oIi(6J3*6z z=e-`2f@By_(b^lO2a(BY&#Vxz5%8qmQU$#(kE080i5WKkLaaaQk^de0L{;HKry?kP znbR)Ec^RZ*m-d&Xu-^+BEO_-CsQihJNfCfuB9#PKq zv`ZwlD~i4Gm@~V#@WP>21_F4YLAh5=pgO_=K~)LTzm6SCL%> zy-qwT_tg#2KZ!56wp$2JhN7t@;8By5BG3+gDj%8>gQzC7|ldyc1KE&%62Ru z8Dgy;u_IlxuhNm9+Euk{qw1Ek*%CkrNK~-MmcAX@GTG8C)OIaaE3klFWT?+&E7cK> zqigeZe8`c)yHON;bSPT+QLsW3s4Q&0v!;TG_I|Ty=xusADL2t!k@J2DM1@C)xo~Jj zw|?kM-#a|C(L-q(*OOWdkh~F#Pp&=KbJ!*kD5Xw~C^4C0`Jgc`-gau| z*s9MrM?-PjZ+&|rEHC@@k-L1e7^`DY6$s-Q*lu)LNA$i<>WS2` zQ%{$VH4lyR@c)v&|2diefB5u&S8b8i&{tnPTrB$Vnk8W$2)*0OBf%8wnBW}EH(%Ad z5xbEj4==yln$7h^AZC~EvC&#RzB=P=42pBJWx^sa{jS8jJ_g-Vank%u@%SriWrOLy zP2;bZi~dmg(f3y>kZpRykOBprN6!+yhIv-!yK7v9IE4ZulV893OXGN*PT=iv*qNEv zgDJ^GqZ9U$#Fc)8XL`8PNe)SowpVDE4{)1ka;tKdOLv#2Y)B(-co(+{J#ece60!`I zdYJFk?lb(T^^af)D!diw-UD%kEHBhH12BV}nECiY$aS-sW)a#keS23}X?P!A{rse()Rklm}(> z#gE+L`9Vx8*WH*yqC&7lwLef+^>}wl_SYgQA-K62 zG!hP+^;@FU(Z&ETF(cSMhM3keCGEjsmk9KY3-#3KJPH`)!m+L7s4<{aHWHGNW1)FzbfH0M$WuNrBJ=E`4|Af5$TOz(+ z7}h#pI=8rdGId+wmY3Lcw^>@V`RtC}HJL!>wW2R~xxY*4LVXsCkx7#AhrfN}|D#ba zo5Au(+^|V2x}F?Dud31DE$4?cvwd5$sjT~-MOQizpC}ZDxC&B!9RPwe6=w6o5F30| zCu<7piVb}ObJqHM3$TsP6M2PDWSv)32 z@yPdjQ=ky64Jy3A|8ydBtRvLUy!c8B!Tq`$TCPU9JLAp3APLO!8R<@IGScuVJTt>I z^X}T~#;_`ujBV2|6IF#_q?1xA$jB4el}l8fge4x6B3F{MDU|!C*|EXpk6ylG3Qe7r zRdu_OxyTw5@iiomf(_`A9Xqb^vD!AUB3A6J1Y9{5We&k@U?m9&Xafd9^~cD<*TouZ z0g-Y#YY07W$fCt~jww%U5r?<7!AYlC=|!$C{4f-=YfafMUBLbkiRqIdG$4(=;PcrD z$&Hb7|F!s%i1|C#M_@6A8k>c(>5}MjbZ|1VpxGUabPnfSU?VSr;;oXrdU8jNT_b)I zu)udsck|1aFNj>@(B-@5RZ_Jc%7+s9hBK{B=(P_^0Fzza$T4|Ms#?z-ElC6N*hhKE zNt4OGM(l7#PHuy8E0I_4eobkplf7kRl@<8qlVeVIcfd)PN|vT;KnwYKe9FT6X>m1e zcb5Qblu1-y!~i5yCiFUGI?6_-f7fEV7=M7Rxmq%n&IAv8-c`I89?gO<#x?C)=`)LH z&qXON8Q`Ebi*v=$8bl48pHMmFx!H+ynE8OHl$o<}tPcXTtyd1s-wv*_?a#am8!K>8 z5%|RV*@c{0g$Yn|0QwM#w=G^@~8!)`-ZL z<`ygw5%N&#Q3x~h^ND6%v{sJ|Ra5BpLT3=;YV(~Nrs&(7N7#!|$*Gf@k%dNy=F@iz z`C}Y7p|Ax7H^=2SN2VWdzv2bLeqVex8DN*U8+-Gpg)0`INLCX9Qmp9kTo-g|66{)4 z?c=2_CU)eK!usW{Kyb<9I@pKI5x1GCBJB1<7ggOF7xQl|cS|$;N!eFa>K9i^DBPDz zE}Z#!<>T*~_<90??nHa0m`#^w4U{Jifi^6uLB2x_(bzJU@(t&y>P|dYO1n&KYDh0+ zr88u6Pm!4u<9DN(FUN^8x#X_!r=|B#z9u~mRJuCm@IT6Pt=PKCZT3R=ZwLMBfIt6p zybu4~;WF)wZpIuYb?jxoEG+ZJ$^wUj0X+Q-wpk}ysxmyZatd`HgrY!`rLq+uudM3w&F zy>r}BB=y0WH_af!U;ucm2ZsZ0Z1t3k{U&HOU6sD$$|!}z#5OkBg*nV*xy%FAXPwa< z#7;tGX+68++0G&|TbrRxd+#3AZ!}iLIAlzjx*p}Sah9jJ-z}}sc=sU(tK0iYp$;o( z@!|VH4^3Af9Jbc=oMxpWZ?a1QpXegZnFyaCwEuo#A@Iyc)y1tzDM35wZd7jF28c(b zSZ^@}hXcuIQ)m|mIlBQv*O*0s<^WA#PZNqS&7MJ_Ot^3Ql{aBSp~}2xU|5_(KI0qp zocKp^q;%|2N2(0`0&)`Q8kJ>-L$6*JpH_FP^M(OA0m6Pomzat#@nRT@WC{~+9p$;r zQ4=amcdM$%4x=aqtfN?zAY?jzIHiwuS$=4TD(F;9M!sa@y2(|D}lnkuKu0mzK-7 zNqo^)^9NH9`HO$~Zy@q6iQWs^-Onilf_$Q>Yk6{N>~o?XC&Xm_0e@(-+Ez1wxAJNo z2E$b6tv7 znV0uQrZODATuE-M#th~^{r*0+0^Twb&u>^fw5&uV>^9bFqtFKC9TnuRHl}a_KGmmC zb{SL0wRFSN@8jL|V!hrLSvU5a?2M*yi`c)RNFIL?T|QA};>L={eHQ{Fm2naM@eLCIB_&q4NS`--@M|> zJ2u-A!E2CjzP#iD%wFaiJ~5mr?hPAXhhzCC<E5j3Te-)BVOiXj*%+ zBUimiR9wK|#ZI@RsfO%hrLhx9l3#cdaf+SqJ>uwS;EH9^i*W^L)+ZXCxQ$J1EWc&+ zSGPIEL$@F@jqF1!4rz+-#UGE)M3yXy-2_u$NK1jD?%uk+v*#04bU@J2^FAI(q!ydt zDSe;4*MagBxA}54n**KFufeqJ?ekmY@h+DKsHzBq?z>-M+*pjHX-w^RJ!8h`C}a`J z&X#v~i9#a-V&GN2P9>z5e?cCry39_4{B*m^;t@G7pBnroKx#W4S~OO-_9}`8p*3Gb z#|aLwRfP$CCmaLBIn<{He`!^Jh?Rczs^6<^@yuzXBt!;GHC#6`8s#!LJ}C)>Jf?g6 ze8*6Gw)cJX`lzL=h+XnlIcCSld8=I4WlN~xSm1^(zec9wJ55STY+2v-eL@Mlk=L0s!^dk-vUsgObTO(r6H>7hidakL>UQ&dS@?OpW= zq9XAM5H1l*e}-PuJrGZn-t?+sF}y4iF0*5fE-+Zj(u+dqegU&kM*`L`4f_dytjn~P zLn2f-dNo4GHr*q-=;94FB&-8qtC)N`{cLvfOMih*8FJqyFQ(p_2Yx1wItzkYJd!f~RUP}j`0 z6*9bB#6=BhDNU(n+IlUKcrYwi2qe40q45}72P41?^gx7T)*yK z0C$ruPv^-d`s4(8;-&hya(uml+qK)uJDSO=d(}&+lx4`9olAXE}F-u^4={}EhsiQ|XnS;57mGrV+$eb+aq1!}FkvwiMOF9iueBxfN8ReA? zxZ#rLo&ECqU!N)e1>V!g1j*6wsW7JQw4Jzg1Jkj*xA5i}#b@0S!?3@!q;PCD$lO!$KHQwi3qJ= zX97G9mf^n`Y=4ZDQSs>LE@IsEY;fPJ&#mQUnd8@*@!OK!_86onDM&w#k0|9Cd&qA) zGs8>vn?S{8u~DmHV&SsTEco~b#QNL1%3zpWR!LP2d8x=O`*&Q7iCNQ%U*m+EOhi%c zV)56qSEG8d=JY0*8}!EekDhXrsgJ$V>*Z*f_a)tk;V zs-n0;EZ~mV3H?UEV5(dXUuZ+llEYtG$pSZ09w*tAe%Nf#sR%c?S3_+bNM}_Us>Sa} zTRgz>K@b_IDQLh>`P1vD`?ED3nljhL!Tcbj!J}ntFwX{Ll1RThB_n#XISma@*rX%s zQ_tlVem+?JW~{(acX!(1f?k z!23xAG|DAe@+D{6BlXMw1e`}{;jF(egT+Oap4HK<^P!|uufo3xFXuGyjSp43)bd+d zH%8B<@CI)Nu;p1m-n$^A9D@T->y2nw6Uv(Kd{`UnohpI=QkDA~14Ik&259xX!XQPy z-z7errSYk_O(YL!J_hA7JnS+!l)(sWJ#f8=tI8ZRP|V*34~yHoMfdPC(1?*_p)9wN zf7)I~jfvW?T10&PP0%e?=v4$!PLp^)-?f`^e|y+#>8Plryg-x9YTS80p>FmD3t4h< z8Z8hU)&PeVb~jhNoD+Gj`bN^>z3|z$Ahjkv=dOG)A&IVv^8m6D{E<(JzpfTELarnJ z$|1LMzOBA;Tf-Qx(hCM`Bt0`|2PSXTw!@)!?Oj`*8{edZgH<1;ME>M^`nO#Dca`7& zoBVFOr1|0+lk9G_bC)G(6n)1X;1=ogI7XUBb@TCx!H13I`|xNR)78)i@HK8!A#V9~&dyaweW zz@NC!wEmsABm@<>D>D1JEGd-osR9ft?4&0TRIF>*jKCqK0`#Op%3df=`xst({0+?0tUPI1R}$MV;DF6#J0YoEt}^Dc5-C&sPv;C2>z~ zu8PPdek4JiuTk#|-rTaC%Q9XcMG@l_oWBYDk3*h#9z;u-Jm)ZG43a!*Scw+IJPN!?K`mvmK4fQqIE4QJ_Gx+)N z?r(x~jhJC^pZ?*j^R=ms6?RkiT#>m4a&zfXTBatxvk58GNxXj#*Tb=2r0>7f#&Fi3 z?93RgsqEg+xJ7@egq+26rhBPwu+l3CCvbOIFb!06W8<|7PUQ_Nr9h6l;a&>CUyj)G z5PUkPfRKac{!nY?Dot^D_lIZ{yn#70vpV2J9&qz#{+CTdI7|yWQh`rWT`Ic+Err92 z0cGtiI?G*sv&G%<_G}_e!=)qrE59q;-RBou@pbK(In&JD$nok?sc;!+ z)DtL)*R<~5h>`fv(MaY2mbxRQOUi|5jMj0Zs|D$&eSdYnwm#$Hd-^=X40;MpeVf*I zHbpKT#8}lnn!?-xIEEseCE!1^nx4ha#P7&QvXce!@O=9Aw=Vv(87*h*5how4z3x7= zu@F|}H+NJP9gcQjd!~`WMXT^9lL%1&z)8MQ`Rv{>Tc=g)z~eDJ5dOCPu&sEI>#SxX zAvwgaE&0(f$6$7_x_CVSR{)XByGRhI@4nzP28oLJrzLvK*Fdz(h2yHN`Z!z))9yz4 zczFCwD%cX-nF5It=X4oYyxoXnQI$N>uHru99%?d}N9bJdBI3e~V|}UDSHR%UXfeU~ zRhyTEZXQZWU?8+mdLlXL*+4G3xu~N@N*mXUl~wsvU#~)aL=9Na-VuNMT2ZP~>zOIh z(|ycPpo_)#nr*9f?Rt~W(rrWN?06yO5QJ`>beg-(EB&>Z1#!z-ATN<(f>3N%HgwFF z?nN%R6M?y#QGEP;9lxeS8Mm?H>-i>Sk#?hX zg#PYQx^&_eyoEmAwrR|Ltb8*@qJW3UyfW&OKX1Q^g~`MjGlxT2=vbmznF;4=WMik| zj8nN%6*oyBsGm@SmP=IrZ{pCaA#YYq!&Y<(W+W=8+-G=YN6D~w4l6R|&N+9wUExYR zGn)5mFe!T5(8hzaAwNuaf_O_?Rs{f`Q=wRu(FX~ThQ}ihn8vy0C^iButSqDXy1puX zI3bLJsI0B+wg|T1(E++m@m$nv*qL2W7YkG{J#nh|N93do=aBWn>7{rAW+Swq^PPkg z&=9xGjipt&!+1%v+kFc7NS+{I<#SU&|CCFArm*W(mPcwQr6dcuHuBTtRWccbmEH)y zSzsWWZbw}yf`kiDDk%x5zMLSj8~aT4FpgXX`887aG4~WZ*KdNBC?(j54VrwfULC{_ zH85VaDKW$xTidul;wj%14an{5y3#e|>P^CCo}Fb=6ijLHv-I@NH#%zD8GP|tWjFx! z+HBR+nNWLLlufd~UFV$&C@b(u;Ffx+3)tDwXNwovEof0Ga}V%I2;E@o)ibd_V1K8( z69vR<^8)V&7Ef!tJw?8*o+j?InCxjpYH+XvhAq?nf}B>{0EZ(PWKe;~7+)l%eXcLH zN9_jNZm=u7X$I|Clj;s_xXA@!qQGEd{|~tkI(>C}o6d06-gitqG(3jpQ07k&(_LIIQm?*X=>KlV`#&~hkud{~@iRC+xCAVZUF6XGpb%m!U7W$iI6OHs=tzMP^2dwDE zmZP_XSmgs6)rVoWQV#F#ad>ZVeV>&{$ox&fYhGBpW!$qjq-NX~pBm&8yhZUHp-sJt z$a&{R{m%!?e~~M7JhpUC+J1f(usU8}#O;n+qFjoc9H|VPVs^Cmnz~35oZK(leH>PZ z@ntfwt@P4T9_zHw^=cS+VssGjMvrB=H~XUhH$kokZ>~|UtQN~iZ>?Ij^VqV!J+{P} zd&I$D&NeYJ-e!5V!=kYNu08PdS*@Apsij4>O%TZlLyiU+_i9aw>qq<<}3Ih~D~CZ!%`1Z4SQOS-6)WYj{FB3=}&5`N!U;pXt1p zK^t62*R}*_Ew)(V=VdE%wQp6NL1b>^mt1SQZ4KtZ=43qNP*zcXM z9+drGc2Q>EfE?HS{)SCgE`mT@v18SS48!o&{H6l$7??M@PPyvLX;yAu#|lIEe8}n1 z7}53|PMtZk;g4pZ?v7-&oJ(cb-Z84zXVrXQ5+revK{UpgpE{FZfDNycHXk-flZr6% zNKcMHmNZX2?9x&*;H_tw)Y0S4QU6{j8um`Pyzb4Hkj<4`N^4QU_F?Pive+i2YSklA z(S|M%TsXI=WZ4;CXK^nig_Sd=Z-u>Jr;77TqDNgGH!6sX>VC)SDir>4ZZe( zRPFmH5+&6FbBS`dJur49GXlSXW0|2J<1MYb-_Rjbz#nRxn7^b+5UwoOJVC?gg<@#yI zlz9v7FEFRmx?H5Mx7krKmT!jMB|A?YufSYs#>B~=s#`0>mLm_^l9;RHRb*J$N_D0- z6aUu^bL-dVvyIQBSn24hJroM9Xmoy>U`^ig0$0zrsP-v=n&TrgV=2G0z$ZF!Y^V;E zI3FvBaIcqMQFginfh+9nYdGo~LJ)7A_%B-cH&2XA#0-)e3%CEod(m!|wU+`qx5Z4u zBlM@Hg0S51N$X5z7H~C{TY+~pStI}~Qly}mJ?te_s`qu(q!;zR5&PPCcoBA5 z*asBOu%HrT*#!i#G|X$IHTwb~vpyE$%<17XH3hW3`ZJg7;W0Ompqb2{7b!9u;JL?7 zyBMzyjlYfF@c$Kca(uEpv1FJM{vr17L%!!+mjd8vAX&YivKf}QY{U&N(@=sw)&OSd zss|4U`m~2XdQoo0_mp!7=+RKhy=EMqwL2#HB{|37Enrd(@ut7lz{n?TKRJx`v1y35 zC!VG9v3HO@v%qNOjMm2OlRenHb5Hzy>_a?AyZ=YKVs;TiyK!^DUG#;G4WfyNXQG7p zT7rlWz>AsL(ZP7+sR^f{XJ2H(FxYr5&v2X>2XzJu^-caQF-}Z=~}*5O4n3 zsTP^khoE1TprFS?2&p1h06+z;TZ;1=-`l|XB6A|AcaVmNcp@?-VZky_ShVV>x5+|Y zB;=?I*LaJQcuD^ke(=O}-E-Vz-3)S$va1mPSVu}Oa%SBWBv;evm|q;CMRLsMsD?1df)`W+Xn4<#0ly zFdjfH-POp^t-l5CAMG))B&Xn{9>?BcU(Df%{xMU40C|OO(V!`luZ?;+MnpP{$i*c& zHM(A`3Mho27?>roy(r6?9~)JK`o!@M#G=|Q(}Q{z+AZ@f1h>squR(9;IKO>I!W?j{ zzI1|0c7=e&-lrl9_cZ+kI}DO|ddHvZaR3SP#0ThF&tiGA8c?A#BK)P z>dt<@x!`6H=+#UYTfNq*WO-gZGeWWebzMR#d_n-LHE5cAOS+K{)W15|i;S}7@zGrb zKP9{VI4#?1KO?2=d9#t4?8|yU^jAy)b@h}(Rvq?!FGF>cyAD=C_~)Bai9?Zr#^?Mj zY_My%TlZEe81~a$g@>P~**?^FCWl6J!<~-2!sC8#hzl>w&OB?`5@|tJ1W?_p)h=JA zpErnGiPL9h(K}7`-uhM#9Eag3-n+~JpE%9A41})peLO_w6(Vc6@?RnY1fHqmn7_PF z;w%ea7VpaNSb-H;mdPNMSZG+`iYo|Kiy`{1vK_EU9|A}}Ap)cijZ^?Q>p9?E4+Ir! zqb%Zzq0t7b5(RC^t0jb?e`~>c`K{^gBa*qy%3n7b6bO-aIYy|>JfC0LOb?ALJ0+r! zvEMlnF*f2|fj(~rVD{dq6^IDM03wd82*Sa&#{V!vULFWEmDd8w1&5-8gVE@`V7zn& zy(cd(e*y%aF?mHMNgEfsTrbAPx6Tk^N{ovznE%n%Ju zm0k@bgiw_LkuIV48B`DgiImWb(n%-=2oNBkbV3`XgpQQZdk2B}W}dUoI?sFlfbV+G zS?^ve$^I$p-uu4xb>I8ipWm5FqL)mgdR#EGUwY+>LxC|)|FY_h+SG^jpNd;M8 zjlDZ&oUYALO1WTJzzKhG|YiTMyW}N}69VU{~L?V}b*$boKR2lY7drPLR zC1%ke6{0}H#bl?P;pFX;2bPY7u`7ZS#$pzY&tH$pCYHK@0zOQb``YnTEL1K>O%~s) zq{H6f^&y|V?(P1Juj-4|@kcZ-mTr#7f@w+B`~WoJu7y#Xxrfpk2rC`kkRzVu!u)VD z<3v}pXj5fT{-^p1tD750;HQRD5{RCPHDBqXhDtN9r-<&a0^S$Tr4R8`Yd4^|t@7tn zN4FDN_%<1_FjT~HW@)A95;PcXZR}cl?S$0p?p$XE68V9%TX-Mb&>qGsYLOs)rF<5S zx?|E)OI2bCh89pp(b{>nSuKxujMJLCg=+q=XGm8EAv$|K%a6g*)#hKSV`4lW9nEA3 zSQmrMS> zboritGT=hL$*uay`1T2SfIa60mMRejtev2wFcv+mx)_w(DsF$Ub@62|JEgC3f@WGiB zUV%6bm){0`q?TG-t6+N=6{|BJAtWDT$8RyDp;d;@3fM4|NSE!lYu#0YEoEuBuIbIWEmZ2gu`WRFY^8$r}zJs3GM_hw7nTj%dwsh=41l+xr&!S3@D7? ziY}{~z|Snkia?ndcn50!XZ?V|^i^p+JB={TKs|TWOJlATENO?CUfeY%$6}MC%am32 zP>6Ce#r>XOd}a?)=}F@?u{c0XTzYp)SqGi0&n0Uq`vdg^kRgtN*ISJtT-@d-+cY&@ zv&D-CV=>Oe^({Z=Q@pjH5_&bOeS}5%+uhXR3Nt=?-XE#oKEx2xup&vd3XcsC;t?>2y|T)YYM;YAsCsUkrM;IWBJ<@&|> zjR7yLwMjF*B>3}l)$sAn15ia9fAXq$R6qGv!pVa=Tgt`~cnaSf`}XzMUR2%T?&eup zjWR?id1mxvCqPMl&RC0_a)dV}#fwt3bNy~(56gwuts51isizmL!s`k_Uh43yknp1) zq=!K}mI^@z$dvOe0g>(J3#n?Jp^?^2kX@wlMzLO`1=u!A z)xY0Ww|zew!isW^c@y{bpMhR`Fk@kc?IbII+0SZ0tYKAA7Gbt=(#!^Zxvb{37NUW& zqCdKXrLB`SV-}uKSX#BTRB_S2Er@h_49PU!go$ytq%4w}JWd6`r)Z-E8#O^>rX!Tq zQW{N)shwUudJrr%%gEIs)r>atT8@9pr(ixDqC7fmW19F7m9w}&T7!kG48j9cfeK;l z63m!`lPO%8r+k@}KBI`^mocP={A>R%7+W_acv?s~ZFr}EQz-og=1RR)o?+ngK!H=P z4UI4!9AQSS*v=AejZO#ykQNT518qX;ZBpiu> zYPyk&VldysuD@{m*ChPf$PMx45t(4(^#8rG8FG$|Z?$+6r3^v@q7VsuvqqBu8OQD` z)R9}ySUMnQT;0PMEVsYoTBG(87}a@TcZ#oP0w!z0q%2$>P`;Tok{wr-&D;m!{nM5dU=DpL>pt&&Hn4 zpM9mko-t$eDzNQsJ^z5!qHd%Mi2X_#ENnKr=+>C{{@<5`W$*%fyBvE9VRSd}JsGyn zfe`;V^2rU341TL_N<*F2L%g+@KPZ!xJh0%vA@<1S?(e!}zn7W`GJ?F238&o1q-(fL zsjr4&bAn!P9I(LvFB!|w8zxU2CrRU3SL-JB{64D}vQNA|&n+B&8Od|92sNjyN`@t1 zQj6$(-ldlU=3n;sfv#Zc-7-kL6HCjPrZ+vTz2NS{=(jcZDh>HJ6ch&tCcU}A-Qp0B zoZt#)wX=|!n|t}2jO?5*=2V##L1-Q1gY@_<=46Wm3?^q?kFo2{s#)wONarcmnl4r% zvd3mxqgwqH%>t6T_8SN(k@V`7;>MY~PtC5v%J-F8WvBZyLysijY0FrZGn?{J;$8p? zQn~InYjA7p{DM|4*0J8Xp(LAYSW%5vDQpi~RS?8~J@lS=Jf|Mr3wpB0Pax$K7oDNY z?PE7pF%4nvE@de3HcOnjXbK)SQs7~IFDGKh^UQ6?e=95)n~m`nFeLU%<%uraj!&fS$Z9CVV6rAgrdiCk7Xz0;s^Ve>^8v= z2c1kIro33~4uM0Nb%^~?%Dkh0%IdG0S3|Ssg*B5p;y#WhJwY!2a7k5r!gaw2;#T?4 z^R5TtGQkD5${ZL)0>vH6xu`lfM28n?@RtSq)7Sa2yOARQm?#L0KAlR!iG-A|3M z+=oIX5TEF2-A<>}+A2V^lemv5!KTPZ8@zHKcix1oln=H*chn(D-aNl*j$J*;)2i=w ztyJP5kSvO-#h(q&a^X_K6;fT2Nsp;<2PfLBsmij>aE>xqQR4VvO-0^YH`@bNHck6{ zmgE7r`p7wG94S~}cV@fCAbT2B!4h3rnX#5-hmvBGP?VG=eh zjXcrRw5GhHOH*p~z*pEJ2=?&qXc7j*f^Be%S{zs(dLQ9mai?#8Ymtn4T2QoeW!OZu z3OJP)f&7v8Id;o#Tm^RgM>GSMFJtOiM&Mz-NsGRICWp>-=fR&7Rdu~==h4hNl;vBP_1z9r~i;K;5QYq}dC6AU&IJp!O z_0f-rp9GcrZ|avnI9&WXrOdeM;m*m_y8BJs{_$sa8PQrX|Iyb~BOr&k$UmYyc&{@| zX;L8#U@tiqYj~c+oq$t?^mi+ppUYR2)+Ng$snUPVuL?vDr}@|^=|6D;#=-?^KGp~v zmFu)i$6F9&$J^yQqpT{zbXv*6DSe=~wM$NC*S1^_>SB|HXW@!x0!eCW zTnOHKE%TUf+**G3^zE7*<R_uHJ$NBIz4l_C?GI&%qrc=$|o2{>S@H) zQ#4P2lKM1_9?9A7yy313GYs>VJi%&Q02M(DFXKW-$#{P6bN`;%astecJ+AAO#~G{a z-L_sg{Mm??re|cdl@M=xWCpzZ>N=6xW){QwC?#a(x=;nNN>i}SBo&&evY|iE* z2e%l>VgBUWc5?N@Y+f-kPxLV)WCQsI7uDYs$)~D#bS7(baI0#RtDQHXLmF}*6kTAZ z@Fq&`E-kK3(>U7PT0)pSgM}22XAp1hQfnxU1380-nnH#mb?-Ncx7|wh`Deq`-e+Sx zggF{@=QDB$=|JP#HR|D|8Lza~Sa1cw@S-4Y&Ww)2d-Q^taZyo&)JjOD3z&FymAE+^ zsB1GMZ60nMHK5lT#NENgmuoc*3bAM?Bm<1>)gvF%2Y&fiB*H*;rp{!m)QoboOHVuS z;MFNj%GIsn!STmGeHK$9Wp0S>@O5++C5Mxuf=_;3`UZbFf%>EhAr6F=I4iG*dM8R# z$(WbLx9ZbRrwvj1ves~Ie#bPWin6o&~BoW!z1(PDTY`*YSF}>Q`_T( z?)S}0?O1cRj|(HT^f?oD2S}_K(>~g`FM%pCzXgpiUA>RUN0#)grx9_LYPSJ2=hJE( zNBDeDh`$#^jemq|F#5kz8!`jU!=PAi&Yd*dDECXj5KU{B(y!_=fIy7QwufUnpu)^v#0HcxJDkL{I>| zK8iyHvpL-{9&Rf9{?6MBbUa3cYtdJ$szV=c3L7r)IVJ+I$DN3sP;$#NKOt$hg(p84 zrTmClGBSNZ9{=g_&i1!h^CTBuS#~f1v~|j5X%m+SB{CWHjY5!$HM%yT)5kj}xLsmH z|5Jc?c*CesjdvU9JTADVfM7Io_GGsD)@!Piho973X{$Y9Z+s0bi11?^1KUp7@SAvJ zR!$up-cX)$zp^|er}j88A|4X`B#O;?!7Xq}Ft?HgvbmnkoS2DisTDOa{Z+A}65rlz z+mqj0-$wl);AX2jtuH zT@1dxKERVI+DoHMsv4`!&uVo@x~O`Zx2;3@ZH{17%WKUmjQypU2!XJ_aOG~yzDa!~ zcehxt@%n2JU3})@w}|m!9B-15(!JJrT&}Vb; z4cnC3)l)6CP^#}fgzvvCP_{(;fTP)iYN{W>HNj{h8HH2%oBjJCq}$~_(}$yhT4Rj2 zxnEB|9&iSExEs=RC8YGk(+`LPNwz|o_p5IlZ57OK|49dTSN#g=^AufKXEJzD*mYxN zv4yZ4xVaNW^6it-s&^tyGQ2J;p#%_1FDq!k6@zFUqv2#u9=M~9(*n1nAfDlgwWFp# zd|cYU6eCh@9o_&{5Zx|Q7C4xL8e??reZ@$WQWptLfh4{S^WnV_SE;>hLB}@bH|Mek z_Qo$#%e;hg`56xozUZnFj{%#*g=9*6n2e(3yL>3?LO<7D z9gzFF?&H4>)H*<*0i3RBFNTePY)MDjndcm3cBt9PA5Iv;K`Lp1Hq#HZ8|Yagl_lP-&i{xt{$@S=^+>0{xGRo<(T zvKjO2$A)t9vq^1H@bDY_!Gngf6AX`AZbNqU#pwj}I6|y9+8eD!C@Mqdg21PmES36P zziA5$8uIf+u%)aBCc(I3(2DbRVl({HMI+L5HS#_!A^`Fm?Qn|u)vUJ419@5$;+jL} z6r)W&em0Su(RUawg;8aC`|b;PQskxtlu#k;Sy5MPROuHV$6AWYerzLBeI^W1`g4f; z$f{u6AEoTNH*e7z$L+$&`LM0P$V>-!jOZPoEpoHF+=y7s8`Leg2@K|?e=== z=Xu|WCq2>63hb?SiQ#Gs?wtfa1x!6jv?~cJhv=Fnu02X~uO}o%!-awq)UO3ypH5$g z60UZ_g9igF+o; zR!~}4Ggmkk#xuzkRVqrMj4`K-ee36GykSBUKXN~-D$O2U*J}7C@7T?pFu6$AN)DOc zq)N}2Qn4cN{A1E~n0&4N`Yy6IHoE-@zjas3kF0Q|j1r_L#nbM#I4y+I5%$cy%13DI zKcaVA{#`ghY#EBWVEv@^gZ+mspQ{%uzCvmufAMWJn0dV;bdEr6*}UmnZ*gkh+1g$H-t(=_l`rV#m@^Y!4I+&^| z)n&-Su1Z(E&R@Su8gE@n^g$RM>WzpsiFdmB;eh_y+KxP}vn<)tL+P*oHU3gR)655k z4vn(Gk#>#;Azz1klZ798Ml4&imuR@(LCvD)iuO18U7a(Z`6AA{4m1TX&~4q*;rqeKch*5fUSrtbk&PR|Dw_f{|CoqP)U_)wsS-f7(wWqx7d;!6PTo2rUXr)p0^}!L4ljIQ5h@Mrzz&52 z6{?{b1|pgJwNRt+)jli`n^ivbp*M+Q|Dezjn<@e-S;ike zM^>T9q0#&!0@*d!SMC{d55-0}*9g>@UXCrPmZ3V87<{2uJh?@E^0LH!t7wY?ecuyc zA`ltYGk_b$AQxlY z&H~_BH+eY+0IbCB@uJ4Oyu#UR-4089Xi|`ODH8iZVwk|AeIx#<9UbMuo@<**o89Sb zCpYBK^*$dp-QPL5L)(Ym^6zjRYpm`aX-+gq+%RVN*{L*`+~sXVr`x{AU? zoVq3&pF1NfNZimvN0&yi6O?irS_aRbZQ7DC6oaVex36U4*4RbHi@K~@JzR2%IdpxS z#Vk2f?A=o?X_I_sfD0)9ijR|N`5is%Cl|YL;=c&w(F!>Vk3K~!XmfH5*}FQ^ zPdjh5q&b!JN}y!aoR*Sw3(~a3@{(XycTi!X-Xdn8^6=i{Dog~`WhIneti7oXdOha&Z1aDvFCnHYL;~? zI?=`?!kf=eR9Xw92V@- zWc=T|^F8y??f9z?48uoD=VN^8p5XhU$Ej;|EVctVbkA9RP6(sgJwGoinvvDW4n
Us}#XvsV6`VXWT}9$*YrGu$#=h}@(j8EpRY5o1wq1UT1tv6SKi zj2LSQlFsh>Gr@b1D! zYeds3XneJrt~q0_qEnQ+95s;3tV&0~aN-|T<9p=z3P?(C>gS2fFaX7OPP>krRKZFb zFy{L5?0A?}5&dcE|A>EWS~9v$+5Ld~uS6b$Dao`oeWXU*>4`PwMF_+2f!IsjSg%C} ztvRXa#GD1!H9k4eizbDD>bN&+kz;^PDhd*2PQ^arz7u;$_h)=&Rl6CcV2$z!+EWWL7sz zR=AnVch!L-(yl(gmkNxA$i>#LbDFH&%K~kq0?6fq8$ZKShI{Tr-!f7?L)CS!L7dhT zyF{r90!f*zULv|qqM5zy*QG%GLn zLNUm~M+8f~X#^EnT{_`f^Mm3mWZVcT7H><|f7~}f?GjGt2L?PX?UnSn7B&2HPh_=pp~7FY0qJh) z-i%ik6Im!3yxuMRvwOb;?f#qjiShxRA0PFDfITMfS#Q{=Y^@7~F zSU#TcR^QEOPmKIZ;lp4B+A^A5-bk5aLF=hFX4W*D=J)i~hpldXP#?q=31cV_eg81p zmGfFVgDIO$p~-ts~^!QA&hI)w&}2OXH(hfQuX*@ zNRaQ}mwHN;QiUCS&uY_n6R8fH+8Q(PKF#Nie!c-L1@%3IHi3q=Ce|r=n>=sm%R{~C z&>;HTX5X2NjM~Y}ZkY&F!bFmbN|Jb$S3h<;=xpr`cq4XKMqaPxp2qt-fBeUs{`38d z{N1=toUjtY@EI1@=K8P|<&Y692T*&+$c; z-9D>H#`8YDKgKP_l|Tc$^rY*1wIYL}x%zsx!h@Gsrr+^k=erI|QC!QrA@dJEiW858 z9)n^L`)?4GA%7SuZdt+^IG$Y!= z1|j|axA)OHZ%!urghaC94e!ee`@TbV#%|~eIKbvyreignft^eIA&maOqbAnmu({m0 z86#!cjYrE(4;w$8N7s2=@VoGSLpbaOG=v0fgw5Z#J>Tw7zU;NhU1gqET|gbP6j9`F zFkw{vGqB1EbvHm9Jn-A7S;rl#}YI)Pz5&Ku()JBv87B;b{o>eZK-M9FirDw5X%)4|^ z!n$mM^g+zAYDQSkRSJ{IrOrB;ejPGV0SOCTDtv2LsTekPdD zp*&w$Oz3922wX>Mw@$2?LA_AdWpOdbB}~qb9cgMu&Aas=f}!8-MRH%-MTDxN=p^SH zMDNJ$55ptT6TmN=6*Z+7KC)`HHNB;Bu8&VAn94smDR{~!^;wjwe5D*wtcTN*<3Zow z$MSRQeE5(dd?TBQkB?8d^+Pu3j;9^8mw);QxapNaubDuBTSy#fGZ2rZ!(bs+xH6jn zTN|CQwTI^Wn8Pc{4=i2$iK%azB?p|J;jQMp4-Bh2iK{FI8#?S_7Iy^BXIy1G#2PKd zddYYR|+~0 zxYm95aC!Mrw}I&_`TQk0C~vP@;14*TdHJV8i_Ym7m8>!GuLJ3I4vm&!G|7HpLKnt7 z!1Xq)%q9p#SrVAU1wB)xEO@0)>|cqxUA=9;nJlHR9O$%YhBV610LnX!-GwAH)6(i~6ne9j_S zb5U=~);1DPeXn(ex$FAiC6|5(&pK5{`mcL8*hwXZ9$q7HAL;5n)nJ7T#q7Dw7QHG4 zwS&pGfQMzn_6fap((Vu@*Ut!rK23)>mdHw$ndq(?pNwsJ$e#-&_6>_5*;foj?N)>&V<`e zuZNgPt%*U0)#QBrayJhTf-=jY{irYdhvTms&b59*z(`^VkrSkxPLc5?@+YAAlh|{p z%6HSNi?9;u

Ly(~}R6esVkdpp92|8BJaTd{^1!Z)r{_8rOEJ*wf^!3I6dt(|o8r zfKEzqT%&LukkR5$IZ{4U@Zi7}7u{G?yjz}d%?EF@gBMQ~sc*pUF zX)npoTMKN#UDBLA`>@@3}o8)AO6hd1e} z%C5;-8`SMCRCK4d47=9Rnu)AZ3s|M-M~J~5yZLoIyQyDsRE}5%{1%-3Y~kUqL{F;` zN11j_wjcb0_2ywZg$O*&!Y_Nt1>+X!fT0?awVl#MhXVv+RXJ#j@S4Wq$h#E^M&$0b z#hg9LuE+Kq`y2Y;ufGS!zlr})l6qg$j$6GpMa6kY{k+IMLsH*H}ERZH=6k{(RJCU}?(sd^R zvKXz4o0j>kaw8|IrO9#X8!CK$B+iPY%g-#5Fqj;9kt>Tk=l;ttnKFiCw*oky3_Amh z((ga)Z$s3=8=2XK%&^6uTry~f0k4p1S|pw=C9>yV)`ODx&2bmLV6Z1Cb*Y6P%Z2~5 zD;H^QV>6^hUT>c)W$1I3S2?CR6VRIQH|CQCh5w!={#W#q-0@vnTWC}7Kjy>z4cl0K zcAu5)Hg_}>S9o21MRuaZ1lAf9h^SN#PiWTgTs0PM)<2QZgJ+9yQu0_N<|{~buq$ER zw^-L-kQS9m8#QJ<+vD0K%97aGG1jUK0zrz_5A9zbjv)q(#%dlPczm(VSFos%W+apb z;7u$<+iN0nnb;T1a)j@=#BnyWR&b|&j*jtpy#^Rge%6D$^|qrdJBZiV+1l12qa-2q zFxE3*Y@115=gdC#&;c~=BV>_N$}XAuJ%E=V5f&I5>q;=EJQxYUL$iA6Qz;~-(r zDSQ{n?f6rh_W_E~vf126yUKqYY1d!dB5{kUBP(iQOOaLG{Co}X0$0d=+`wclr}eZ- zlk%=Lscg}l4=k}Vsgq83X2jeV^+z4c*SF^<7oyM`-tl#21e2DmY13*mewAu@2**sf zRG4bA>5rED)9TNIDK)MN0SYSBCpHbK`o!;n`_d)thR*kYd@7WYF?Q;(il6i=9gD3n z&%TiCTorIn_m1E)_}4z+KVym?YU?HDw3D5JRm%%@91a3pl#bNM`IvQ&>QUEqoVgoD zd-yqE#4}>vNAvf8rV+j`*i`~Jr60_>E3TMGYX0&1yzb7>Oj@JNp)f1Aex^sKTAj|%Zh zJ*(3-kSrcC_)uW>KCoZzr*e|Wqg;DLsqf_{7jDM#!Ct^yd@V}C&P^nYEqE2zq9Xb7kV$--XvD=WHa~Agg!8i?oxz$9F$LdXKf>7Tqdtqy{J^ z-8^JF2k)2s-rjkfOz7R*<7^q923c=o8xBwDEkx7QVXj8PPa5egw=13B=@`%JSV0|1 zLTJ(KN_~xD_6DF?oE(j2ImqMD3_g$F=2Ol8N#(f@c_~EiUXvw z-58{dh_w>%U@DrT+$xGMPG=Vx1fnv2ka+tb^qm@=P{eu)Fh-u9myf6!!|ma@L7<)> zD=M+8+ltDUn?BJ`-`Ev$1s1k91b&rzCVZDj$=IIrYJ;lzpL9X9iX-&{q8)(mOA=Yl zwL4ncWbj2MNJ9JtLQH4YHL<{NvfLwi_M+RN>GZX#+IXSM;M7hCfcYR{>Ra)tSy@57 z*)M&N6HuBT0=e6y3BxI4{6zYIT$`%EFtyC->Koj;HNXF}RBlMF9+aqBz@hF!hBDxV zaW(45bpc~V{d@c|RR{21HQ8~*-85i@kS)`!!RPzWjvl3HiuxYy$|!{=%$-JlU-M<8 z%N-f}Hvhgvv>|#Zh%1Cq>GF&RHG zxW_CX9iuNdBWZbaQ3o}?QUXnvY2O_R!#*vZTqG2AzPw*&_VS+#{NL2B&2?{TRU6rP zvyWD6nuy9x9a#?gM&5Gp`l)7=TO+p*;%b0WB=0PNC46AREFzeUM=ReEl5Zy4P5Z-8 zcQbkiLz}h^;;*6r)i#*GZ(ZZD_Ctp-@v+9y@nJAr#FcT;a~<)h5u!ueaB*xi?Ic5B9U1R#c-OLu;`)4hfUuF z=L3h7MHe16Tl^&8yAOG-_RuuLd8KYD(_*z$tgdg*w&JFLuZbwR4av@7L(q_cN5r(xj1g!*9~1qUGO$>@vfa>Q_Tmv*^&~#=|wQ z>aiTBL?vmpnFlxYADH^-0(FhY6xuVrJ+}rQlsj`8uG*@6q{FYoqL5hcng* z3Jou`;`>Ew$eqJT`B=2PnV)KRe-5d{nGaW=9lpUx-6X-40JyGGo$CwSBC?tEB*)cMWm#+JXD?Jx=DTj#*s zJ(+Pry<)uTk@MLrAFAN?jcxp=_^X<;4U1anIyV3F>VzmRE&hH{tINSsd&J%k!Owa2 z3~pZhaGry>UO2}J*N5mM`J(6pjeSjI4#{*fy7B$Zg{AVqgNej7&1W|^#t1g=?s?7S zUl~+0$7vjGA8FHdGT}jST#E!i2)Oo$A<)fJ_K*8_=9Sy(RN9-gKQd#Zy7N6OL5(RlbgO5Xq{rGPFG9mAC?yH>n#z^xee66O9|HW20{S`R) z(plonhzI9*;Q4_)QB%}J>-o_Bu>7EXOkq+qOIY$DQRoJ(5aQ6SMS=R&jq*ZxuCX=P({{6hu13fBOi0 z|J@@h_^XW`Rl?jBvUxqVyTYyXrP-GR<2+OhJFD-qN`BfwHxMGH>U4$@khty|?#4DY zuN%WgR&|X{o0R8X)X2)R$|{OFzYS3rTicQEoUwg3ysuE*_Q~ZZQ)4TZ${Xj`Z1A3E zG(R}wRH@ZUK*8TeIqNWQ)8mf)`ZEJW+~LfBpTU2lqQ)0>ET9QMIt10LGylIRpcpkaxON<9cEL6O5EBqSIg$jD8%Lw5anedS2wZnwOzFXfn zv2+=+pw)3>>3g`_h(F?W@Eu0beDj`G_21jRCBR}5?KWY`Iy7km$ZxP`Yz1^Xl=-hd zeJ*J@Dj(5w8ly>5J=;Y!7uKIGev9yT)f&V1vJ9vK?Y~gE;DN&J)Jk%hv2mbidDCA% zKZW#L`~2k`-j^w!;Mf}v^1I9W;=`x#8wsMKb*shk1@TTo^xEiMyN~ZA4P1Yu^!F??` zPu<8(m^ozz?bCY6Up!#W7gcUFw(;+L!R&D(Qr*)tH8fooe1G{s!pvIR`|C#T|H?*} z4M;!BJqe1%Rh$B7a2!s%x~ZM>N>@eH>Ro9;@q*j48B4;YcAkyONUP-jogIan@f;?{ zl2ggrJDh_POnPwxV;;u&3!MGVdc9fKU$hhYXpD>`TB{Mc7i=qBGXUWk9hh4)GVJ(d zImFmrVMSeiUSk3_I*2-5@2&qBD9nYczmaMl0syEC`{Cp*R?F^bIb8p@H2J@y`%+Cu ztw!rFyjgVml7yg-Z_C@!?aklX!8RP45w~W>*Ka2vZipugeVQVJ-}M2WapTY`CibZb ze@v?f+VmC{m|uK?7uC5g{u$CZp~A3Y)%1DMCdCy#&%CImzntBDhNd=XU7+I_$0Oza)#AI z+Gg3(6ZV5Jejo5UIL~dI#Fd`|cw03R_Pp^^FUg%n?6x`(3Q7Qw-YU8*sBCv1Pj>Wv zfh=g0cpZVi8d2pfaCDXJ&1~p?Vu@d#^3Wc3XCle65OH0=O9ja=Uy(JTDro`$$)^MHhH5Q;l@GmE3T>-93-smv`bva@plu&I@sF(Rza znbjb#ZXGt_t9a&=q_U)S}l^dNUf?N%jCx2f8?*GZf&qrHpg*qaa zH~JqYR3^q}9%?gy^TH}LIjv%XO@PYcVv}g^vLuBXERCJxNSckxe^P(%`sqDG;$|BB z@SJC=q}tRyS63kh{mkFiJ)VU+PEUVU%rn0Cx*bOvS%+5#}xk0X?bFuASH^;80MF4=%5qK-hn*i~NV(K}U zJU#HNOg@zMW^wI1Z^E7W`1PP>zSX+-F4MfsPj-LLUvA*62B!$;{i=f=d|uU2Z8 zskkZg*+05lz#-}AnZ7Dwm!+W35R)Xrfwqq$@pKSFC{%g+iPLIMA{5(dznyx!wxRTP zN>A*~h0-A2&<3L9Ab}%C_iEZ8F+r0bI!z_8qFK=Zfa_PaNb^f9oj>*(EKc)%>gqWK z!7(Smt52P0WmvnnipKrq19hv73|?lr7*KOf&6{pzIaOjCSa!MyXRCi-YD@q7k^%nj zODj2HB_A_?i~O-JD;D-VDi+t|L3=x$wRPThTHJr7BPMv}k6(%#-u<95lMLb`rcR$F zyVF$-o{EJtjFe7~7mimm8j2BL`J;dnPe49g{9LPst+pkIUQjft>xj|ulcaj3S@{;jEqdp@~^6fAU2E=UkOH~nh-ENi;zo(;8!)d zsLvwn8ezTZ?;1v?&wQ~UQzbdsqb>T>$V*g^UW@h=N$v$!49(ItKEEW+5t*6k>+qfE|#w&*7 z(+3*D`m|qBvaeb+;zBuJd+6M@ToQL_sGL6>dawVbSJnaj-U2H4Fz#XW&g5YN2D=9q zF`Rx5vyb1s!O&2KX`#ig_CbgEtC8L!Y} zf2QcgwL!G`tcm`J@wHDU>QuXc*BqyB0nL6HVW!;s`%_s#7%7@J2nmGJ` ztEio``;{9~LucyX)%#yjmhdq#(+<_CO0y1Wl=#4@Sjyrzn-ULr!aHNN)}k4xxa5(p z+}Z1Sqx?CWygvq&950Vz%}q;A)(Z6)hYku_cLbQQ#BqmP@xX*Hdb7E9ie5CnsY-PttZ%zPSI6U9h1sQg{V-B#JAeG|ze-GX$GYy7E9?$5|}_ zgYvTw@=Ur*VTGx3nWfsw5r@Rm*jRg4IA?Z8&*ty{q=9=0z~B15-Ils6kaZuOj{5i^ zG|4k&*385ZV!xvDW3_5 zY{(2x2H>KjyK>-hpw6PGZ3xR6GG%ov*ioO^CrUy*pVNQMQeHE(X?npM(Tvd0&$Hovhnbtx*}Q9kUyIAJsy6BU?^G?=2r7 z!n@7-XFY-AR;4Nazem-JN(tEU5*4E$?Ac$=^Yue@((a6Y<}g`rl*!AF4O>V*mgE literal 0 HcmV?d00001 diff --git a/examples/BalanceExample.php b/examples/BalanceExample.php deleted file mode 100644 index 3b550c8..0000000 --- a/examples/BalanceExample.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = array( - 'for-user-id' => '' //The sub-account user-id that you want to make this transaction for (Optional). -); -$getBalance = \Xendit\Balance::getBalance('CASH', $params); -var_dump($getBalance); diff --git a/examples/CardlessCreditExample.php b/examples/CardlessCreditExample.php deleted file mode 100644 index 60e93ff..0000000 --- a/examples/CardlessCreditExample.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'cardless_credit_type' => 'KREDIVO', - 'external_id' => 'test-cardless-credit-02', - 'amount' => 800000, - 'payment_type' => '3_months', - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 200000, - 'type' => 'Smartphone', - 'url' => 'http=>//example.com/phone/phone_case', - 'quantity' => 2 - ], - [ - 'id' => '234567', - 'name' => 'Bluetooth Headset', - 'price' => 400000, - 'type' => 'Audio', - 'url' => 'http=>//example.com/phone/bluetooth_headset', - 'quantity' => 1 - ] - ], - 'customer_details' => [ - 'first_name' => 'customer first name', - 'last_name' => 'customer last name', - 'email' => 'customer@yourwebsite.com', - 'phone' => '081513114262' - ], - 'shipping_address' => [ - 'first_name' => 'first name', - 'last_name' => 'last name', - 'address' => 'Jalan Teknologi No. 12', - 'city' => 'Jakarta', - 'postal_code' => '12345', - 'phone' => '081513114262', - 'country_code' => 'IDN' - ], - 'redirect_url' => 'https://example.com', - 'callback_url' => 'http://example.com/callback-cardless-credit' -]; - -$createPayment = \Xendit\CardlessCredit::create($params); -var_dump($createPayment); - -$params = [ - 'cardless_credit_type' => 'KREDIVO', - 'amount' => 2000000, - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 1000000, - 'type' => 'Smartphone', - 'url' => 'http://example.com/phone/phone_case', - 'quantity' => 2 - ] - ] -]; - -$calculatePaymentTypes = \Xendit\CardlessCredit::calculatePaymentTypes($params); -var_dump($calculatePaymentTypes); diff --git a/examples/CardsExample.php b/examples/CardsExample.php deleted file mode 100644 index e1c8bff..0000000 --- a/examples/CardsExample.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'token_id' => '5e2e8231d97c174c58bcf644', - 'external_id' => 'card_' . time(), - 'authentication_id' => '5e2e8658bae82e4d54d764c0', - 'amount' => 100000, - 'card_cvn' =>'123', - 'capture' => false -]; - -$captureParams = ['amount' => 100000]; - -$refundParams = [ - 'external_id' => $params['external_id'], - 'amount' => 20000 -]; - -$createCharge = \Xendit\Cards::create($params); -var_dump($createCharge); - -$id = $createCharge['id']; - -$getCharge = \Xendit\Cards::retrieve($id); -var_dump($getCharge); - -$captureCharge = \Xendit\Cards::capture($id, $captureParams); -var_dump($captureParams); - -$getCharge = \Xendit\Cards::retrieve($id); -var_dump($getCharge); - -$refund = \Xendit\Cards::createRefund($id, $refundParams); -var_dump($refund); - - diff --git a/examples/CardsReverseExample.php b/examples/CardsReverseExample.php deleted file mode 100644 index 6f5faec..0000000 --- a/examples/CardsReverseExample.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'token_id' => '5e3149b915faf8739dd96178', - 'external_id' => 'card_' . time(), - 'authentication_id' => '5e3149b915faf8739dd96179', - 'amount' => 100000, - 'card_cvn' =>'123', - 'capture' => false -]; - -$createCharge = \Xendit\Cards::create($params); -var_dump($createCharge); - -$reverseParams = ['external_id' => $createCharge['external_id']]; - -$reverseAuth = \Xendit\Cards::reverseAuthorization( - $createCharge['id'], - $reverseParams -); -var_dump($reverseAuth); diff --git a/examples/CustomHttpClient.php b/examples/CustomHttpClient.php deleted file mode 100644 index d84dc72..0000000 --- a/examples/CustomHttpClient.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Dotenv\Dotenv; -use Xendit\Xendit; -use Xendit\HttpClientInterface; -use GuzzleHttp\Client as Guzzle; - -require 'vendor/autoload.php'; - -class HttpCliImp implements HttpClientInterface { - private $_guzz; - - public function __construct(Guzzle $guzz) - { - $this->_guzz = $guzz; - } - public function request($method, $uri, array $options = []) - { - return $this->_guzz->request($method, $uri, $options); - } -} - -$dotenv = Dotenv::createImmutable(__DIR__ . '/..'); -$dotenv->load(); -Xendit::setApiKey(getenv('SECRET_API_KEY')); -Xendit::setHttpClient(new HttpCliImp(new Guzzle( - [ - 'base_uri' => Xendit::$apiBase, - 'verify' => false, - 'timeout' => 60 - ] - ))); - -$getBalance = \Xendit\Balance::getBalance('CASH'); -var_dump($getBalance); diff --git a/examples/CustomersExample.php b/examples/CustomersExample.php deleted file mode 100644 index 034e303..0000000 --- a/examples/CustomersExample.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$customerParamsOld = [ - 'reference_id' => '' . time(), - 'given_names' => 'customer 1', - 'email' => 'customer@website.com', - 'description' => 'dummy customer', - 'middle_name' => 'middle', - 'surname' => 'surname', - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'Jl. 123', - 'street_line2' => 'Jl. 456', - 'city' => 'Jakarta Selatan', - 'province' => 'DKI Jakarta', - 'state' => '-', - 'postal_code' => '12345' - ] - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -echo "Creating customer (2020-05-19)...\n"; -$createCustomerOld = \Xendit\Customers::createCustomer($customerParamsOld); -var_dump($createCustomerOld); - -echo "Retrieving customer by reference ID (2020-05-19)...\n"; -$getCustomerOld = \Xendit\Customers::getCustomerByReferenceID( - $customerParamsOld['reference_id'] -); -var_dump($getCustomerOld); - -$customerParamsNew = [ - 'reference_id' => '' . time(), - 'type' => 'INDIVIDUAL', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'phone_number' => '+6289987654321', - 'description' => 'test description', - 'kyc_documents' => [ - [ - 'country' => 'ID', - 'type' => 'IDENTITY_CARD', - 'sub_type' => 'NATIONAL_ID', - 'document_name' => 'KTP', - 'document_number' => '1234567890', - 'expires_at' => '2025-06-02', - 'holder_name' => 'Holder name', - 'document_images' => [ - 'https://file1.jpg', - 'https://file2.jpg' - ] - ] - ], - 'metadata' => [ - 'meta' => 'data' - ], - 'individual_detail' => [ - 'given_names' => 'John', - 'surname' => 'Doe', - 'nationality' => 'ID', - 'date_of_birth' => '1993-12-26', - 'place_of_birth' => 'Cirebon', - 'gender' => 'MALE', - 'employment' => [ - 'employer_name' => 'Employer name', - 'nature_of_business' => 'Business', - 'role_description' => 'Employer' - ] - ], - 'business_detail' => [ - 'business_name' => 'Business name', - 'business_type' => 'NON_PROFIT', - 'nature_of_business' => 'Charity', - 'business_domicile' => 'ID', - 'date_of_registration' => '2005-06-21' - ], - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'street line 1', - 'street_line2' => 'street line 2', - 'city' => 'Cirebon', - 'province_state' => 'Jawa Barat', - 'postal_code' => '21345', - 'category' => 'HOME', - 'is_primary' => true - ] - ], - 'identity_accounts' => [ - [ - 'type' => 'EWALLET', - 'company' => 'GOPAY', - 'description' => 'gopay', - 'country' => 'ID', - 'properties' => [ - 'account_number' => '12345', - 'account_holder_name' => 'John Doe', - 'currency' => 'IDR' - ] - ] - ], - 'api-version' => '2020-10-31' -]; - -echo "Creating customer (2020-10-31)...\n"; -$createCustomerNew = \Xendit\Customers::createCustomer($customerParamsNew); -var_dump($createCustomerNew); - -echo "Retrieving customer by reference ID (2020-10-31)...\n"; -$getCustomerNew = \Xendit\Customers::getCustomerByReferenceID( - $customerParamsNew['reference_id'], - ['api-version' => '2020-10-31'] -); -var_dump($getCustomerNew); diff --git a/examples/DirectDebitExample.php b/examples/DirectDebitExample.php deleted file mode 100644 index 85366b8..0000000 --- a/examples/DirectDebitExample.php +++ /dev/null @@ -1,175 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$customerParams = [ - 'reference_id' => '' . time(), - 'given_names' => 'customer 1', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'description' => 'dummy customer', - 'middle_name' => 'middle', - 'surname' => 'surname', - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'Jl. 123', - 'street_line2' => 'Jl. 456', - 'city' => 'Jakarta Selatan', - 'province' => 'DKI Jakarta', - 'state' => '-', - 'postal_code' => '12345' - ] - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -$customer = \Xendit\Customers::createCustomer($customerParams); - -$linkedAccountTokenizationParams = [ - 'customer_id' => $customer['id'], - 'channel_code' => 'DC_BRI', - 'properties' => [ - 'account_mobile_number' => '+62818555988', - 'card_last_four' => '8888', - 'card_expiry' => '06/24', - 'account_email' => 'test.email@xendit.co' - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -echo "Initializing linked account tokenization...\n"; -$initializeTokenization = \Xendit\DirectDebit::initializeLinkedAccountTokenization( - $linkedAccountTokenizationParams -); -var_dump($initializeTokenization); - -$validateOTPForLinkedAccountParams = [ - 'otp_code' => '333000' -]; - -echo "Validating OTP for linked account token...\n"; -$validateOTPForLinkedAccount = \Xendit\DirectDebit::validateOTPForLinkedAccount( - $initializeTokenization['id'], - $validateOTPForLinkedAccountParams -); -var_dump($validateOTPForLinkedAccount); - -echo "Retrieving accessible linked accounts...\n"; -$retrieveLinkedAccounts = \Xendit\DirectDebit::retrieveAccessibleLinkedAccounts( - $initializeTokenization['id'] -); -var_dump($retrieveLinkedAccounts); - -echo "Unbinding linked account token...\n"; -$unbindLinkedAccountToken = \Xendit\DirectDebit::unbindLinkedAccountToken( - $initializeTokenization['id'] -); -var_dump($unbindLinkedAccountToken); - -$createPaymentMethodParams = [ - 'customer_id' => $customer['id'], - 'type' => 'DEBIT_CARD', - 'properties' => [ - 'id' => $retrieveLinkedAccounts[0]['id'] - ], - 'metadata' => [ - 'meta' => 'data' - ] - ]; - -echo "Creating payment method...\n"; -$createPaymentMethod = \Xendit\DirectDebit::createPaymentMethod( - $createPaymentMethodParams -); -var_dump($createPaymentMethod); - -echo "Retrieving payment methods by customer ID...\n"; -$getPaymentMethods = \Xendit\DirectDebit::getPaymentMethodsByCustomerID( - $customer['id'] -); -var_dump($getPaymentMethods); - -$createDirectDebitPaymentParams = [ - 'reference_id' => 'test-direct-debit-ref-0101', - 'payment_method_id' => $createPaymentMethod['id'], - 'currency' => 'IDR', - 'amount' => 15000, - 'callback_url' => 'http://webhook.site/', - 'enable_otp' => true, - 'description' => 'test description', - 'basket' => [ - [ - 'reference_id' => 'basket-product-ref-id', - 'name' => 'product name', - 'category' => 'mechanics', - 'market' => 'ID', - 'price' => 50000, - 'quantity' => 5, - 'type' => 'product type', - 'sub_category' => 'product sub category', - 'description' => 'product description', - 'url' => 'https://product.url' - ] - ], - 'device' => [ - 'id' => 'device_id', - 'ip_address' => '0.0.0.0', - 'ad_id' => 'ad-id', - 'imei' => '123a456b789c' - ], - 'success_redirect_url' => 'https://success-redirect.url', - 'failure_redirect_url' => 'https://failure-redirect.url', - 'metadata' => [ - 'meta' => 'data' - ], - 'Idempotency-key' => '' . time() -]; - -echo "Creating direct debit payment...\n"; -$createDDP = \Xendit\DirectDebit::createDirectDebitPayment( - $createDirectDebitPaymentParams -); -var_dump($createDDP); - -$validateOTPForDirectDebitPaymentParams = [ - 'otp_code' => '222000' -]; - -echo "Validating OTP for direct debit payment...\n"; -$validateOTPForDDP = \Xendit\DirectDebit::validateOTPForDirectDebitPayment( - $createDDP['id'], - $validateOTPForDirectDebitPaymentParams -); -var_dump($validateOTPForDDP); - -echo "Retrieving direct debit payment by ID...\n"; -$getDDPByID = \Xendit\DirectDebit::getDirectDebitPaymentByID( - $createDDP['id'] -); -var_dump($getDDPByID); - -echo "Retrieving direct debit payment by reference ID...\n"; -$getDDPByReferenceID = \Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( - $createDDP['reference_id'] -); -var_dump($getDDPByReferenceID); diff --git a/examples/DisbursementChannelsExample.php b/examples/DisbursementChannelsExample.php deleted file mode 100644 index 2b1e63e..0000000 --- a/examples/DisbursementChannelsExample.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$disbursementChannels = \Xendit\DisbursementChannels::getDisbursementChannels(); -var_dump($disbursementChannels); - -$channelCategory = 'BANK'; -$getdisbursementChannelsByCategory = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory($channelCategory); -var_dump($getdisbursementChannelsByCategory); - -$channelCode = 'PH_BDO'; -$getdisbursementChannelsByCode = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode($channelCode); -var_dump($getdisbursementChannelsByCode); diff --git a/examples/DisbursementsExample.php b/examples/DisbursementsExample.php deleted file mode 100644 index 904d9d1..0000000 --- a/examples/DisbursementsExample.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'external_id' => 'disb-12345678', - 'amount' => 15000, - 'bank_code' => 'BCA', - 'account_holder_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example', - 'X-IDEMPOTENCY-KEY' -]; - -$batch_params = [ - 'reference'=> 'disb_batch-12345678', - 'disbursements'=> [ - [ - 'amount'=> 20000, - 'bank_code'=> 'BCA', - 'bank_account_name'=> 'Fadlan', - 'bank_account_number'=> '1234567890', - 'description'=> 'Batch Disbursement', - 'external_id'=> 'disbursement-1' - ], - [ - 'amount'=> 30000, - 'bank_code'=> 'MANDIRI', - 'bank_account_name'=> 'Lutfi', - 'bank_account_number'=> '1234567891', - 'description'=> 'Batch Disbursement with email notifications', - 'external_id'=> 'disbursement-2', - 'email_to'=> ['test+to@xendit.co'], - 'email_cc'=> ['test+cc@xendit.co'], - 'email_bcc'=> ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] - ] - ] -]; - -$createDisbursements = \Xendit\Disbursements::create($params); -var_dump($createDisbursements); - -$id = $createDisbursements['id']; -$external_id = $params['external_id']; - -$getDisbursementsBanks = \Xendit\Disbursements::getAvailableBanks(); -var_dump($getDisbursementsBanks); - -$retrieveParams = [ - 'for-user-id' => '' -]; -$getDisbursements = \Xendit\Disbursements::retrieve($id, $retrieveParams); -var_dump($getDisbursements); - -$getDisbursementsByExt = \Xendit\Disbursements::retrieveExternal($external_id, $retrieveParams); -var_dump($getDisbursementsByExt); - -$createBatchDisbursements = \Xendit\Disbursements::createBatch($batch_params); -var_dump($createBatchDisbursements); diff --git a/examples/DisbursementsPHPExample.php b/examples/DisbursementsPHPExample.php deleted file mode 100644 index d031a53..0000000 --- a/examples/DisbursementsPHPExample.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'reference_id' => 'reference_id', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'PH_BDO', // if you do not know the channel code. You can find it from DisbursementChannels - 'account_name' => 'Test', - 'account_number' => '1234567890', - 'description' => 'PHP Disbursement from Example', - 'xendit-idempotency-key' => time() -]; - -$createDisbursements = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursements); - -// create php disbursement with beneficiary optional field -$beneficiary = [ - 'type' => 'INDIVIDUAL', - 'given_names' => 'Test Name', - 'middle_name' => 'middle_name', - 'surname' => 'surname', - 'business_name' => 'business_name', - 'street_line1' => 'street_line1', - 'street_line2' => 'street_line2', - 'city' => 'city', - 'province' => 'province', - 'state' => 'state', - 'country' => 'country', - 'zip_code' => '12345', - 'mobile_number' => '9876543210', - 'phone_number' => '987654321', - 'email' => 'email@test.com' -]; -$params['beneficiary'] = $beneficiary; -$params['xendit-idempotency-key'] = time(); -$createDisbursementsWithbeneficiary = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursementsWithbeneficiary); - -// create php disbursement with receipt_notification optional field. We can pass either of them or both. -$receiptNotification = [ - 'email_to' => ['test@test.com'], - 'email_cc' => [], - 'email_bcc' => [] -]; -$params['xendit-idempotency-key'] = time(); -$params['receipt_notification'] = $receiptNotification; -$createDisbursementsWithReceipt = \Xendit\DisbursementsPHP::createPHPDisbursement($params); -var_dump($createDisbursementsWithReceipt); - -$id = $createDisbursements['id']; -$getDisbursements = \Xendit\DisbursementsPHP::getPHPDisbursementByID($id); -var_dump($getDisbursements); - -$reference_id = 'reference_id'; -$getDisbursementsByRef = \Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID($reference_id); -var_dump($getDisbursementsByRef); diff --git a/examples/EWalletsExample.php b/examples/EWalletsExample.php deleted file mode 100644 index 1be80e3..0000000 --- a/examples/EWalletsExample.php +++ /dev/null @@ -1,145 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$ovoParams = [ - 'external_id' => 'demo-' . time(), - 'amount' => 32000, - 'phone' => '081298498259', - 'ewallet_type' => 'OVO' -]; - -$danaParams = [ - 'external_id' => 'demo_' . time(), - 'amount' => 32000, - 'phone' => '081298498259', - 'expiration_date' => '2100-02-20T00:00:00.000Z', - 'callback_url' => 'https://my-shop.com/callbacks', - 'redirect_url' => 'https://my-shop.com/home', - 'ewallet_type' => 'DANA' -]; - -$linkajaParams = [ - 'external_id' => 'demo_' . time(), - 'amount' => 32000, - 'phone' => '081298498259', - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 100000, - 'quantity' => 1 - ], - [ - 'id' => '345678', - 'name' => 'Powerbank', - 'price' => 200000, - 'quantity' => 1 - ] - ], - 'callback_url' => 'https =>//yourwebsite.com/callback', - 'redirect_url' => 'https =>//yourwebsite.com/order/123', - 'ewallet_type' => 'LINKAJA' -]; - -$ewalletChargeParams = [ - 'reference_id' => 'test-reference-id', - 'currency' => 'IDR', - 'amount' => 50000, - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'channel_code' => 'ID_SHOPEEPAY', - 'channel_properties' => [ - 'success_redirect_url' => 'https://yourwebsite.com/order/123', - ], - 'metadata' => [ - 'meta' => 'data' - ] -]; - -try { - $createOvo = \Xendit\EWallets::create($ovoParams); - var_dump($createOvo); -} catch (\Xendit\Exceptions\ApiException $exception) { - var_dump($exception); -} - -$createDana = \Xendit\EWallets::create($danaParams); -var_dump($createDana); - -$createLinkaja = \Xendit\EWallets::create($linkajaParams); -var_dump($createLinkaja); - -$getOvo = \Xendit\EWallets::getPaymentStatus($ovoParams['external_id'], 'OVO'); -var_dump($getOvo); - -$getDana = \Xendit\EWallets::getPaymentStatus($danaParams['external_id'], 'DANA'); -var_dump($getDana); - -$getLinkaja = \Xendit\EWallets::getPaymentStatus( - $linkajaParams['external_id'], - 'LINKAJA' -); -var_dump($getLinkaja); - -echo "Creating E-Wallet Charge...\n"; -$createEWalletCharge = \Xendit\EWallets::createEWalletCharge($ewalletChargeParams); -var_dump($createEWalletCharge); - -echo "Retrieving E-Wallet Charge Status with ID: {$createEWalletCharge['id']}...\n"; -$walletChargeStatusParams = [ - 'for-user-id' => 'test-user-id' -]; -$getEWalletChargeStatus = \Xendit\EWallets::getEWalletChargeStatus( - $createEWalletCharge['id'], - $walletChargeStatusParams -); -var_dump($getEWalletChargeStatus); - -$eWalletChargeId = ''; -$voidEwalletChargeParam = []; -$voidEwalletCharge = \Xendit\EWallets::voidEwalletCharge( - $eWalletChargeId, - $voidEwalletChargeParam - ); -var_dump($voidEwalletCharge); - -$eWalletChargeId = ''; -$refundEwalletChargeParam = []; -$refundEwalletCharge = \Xendit\EWallets::refundEwalletCharge( - $eWalletChargeId, - $refundEwalletChargeParam - ); -var_dump($refundEwalletCharge); - -$eWalletChargeId = ''; -$refundEwalletChargeId = ''; -$getRefundEWalletParam = []; -$getRefundEWallet = \Xendit\EWallets::getRefund( - $eWalletChargeId, - $refundEwalletChargeId, - $getRefundEWalletParam - ); -var_dump($getRefundEWallet); - -$eWalletChargeId = ''; -$listRefundParam = []; -$listRefund = \Xendit\EWallets::listRefund( - $eWalletChargeId, - $listRefundParam - ); -var_dump($listRefund); \ No newline at end of file diff --git a/examples/InvoiceExample.php b/examples/InvoiceExample.php deleted file mode 100644 index 253a89b..0000000 --- a/examples/InvoiceExample.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = ['external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000 -]; - -$createInvoice = \Xendit\Invoice::create($params); -var_dump($createInvoice); - -$id = $createInvoice['id']; - -$getInvoice = \Xendit\Invoice::retrieve($id); -var_dump($getInvoice); - -$params = [ - 'for-user-id' => '' -]; -$expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); -var_dump($expireInvoice); - -$retrieveAll = [ - 'for-user-id' => '' -]; -$getAllInvoice = \Xendit\Invoice::retrieveAll($retrieveAll); -var_dump(($getAllInvoice)); diff --git a/examples/PayLaterExample.php b/examples/PayLaterExample.php deleted file mode 100644 index 7b5b1d7..0000000 --- a/examples/PayLaterExample.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', - 'channel_code' => 'ID_KREDIVO', - 'currency' => 'IDR', - 'amount' => 6000000, - 'order_items' => [ - [ - 'type' => 'PHYSICAL_PRODUCT', - 'reference_id' => '1533', - 'name' => 'Mobile Phone', - 'net_unit_amount' => 6000000, - 'quantity' => 1, - 'url' => '', - 'category' => 'Smartphone' - ] - ] -]; - -$payLaterPlan = \Xendit\PayLater::initiatePayLaterPlans($params); -var_dump($payLaterPlan); - -$params = [ - 'plan_id' => $payLaterPlan['id'], - 'reference_id' => 'order_id_' . time(), - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'success_redirect_url' => 'https://your-site.com/redirect-success', - 'failure_redirect_url' => 'https://your-site.com/redirect-failure', -]; -$payLaterCharge = \Xendit\PayLater::createPayLaterCharge($params); -var_dump($payLaterCharge); - - -$params = []; // Optional -$id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; -$payLaterCharge = \Xendit\PayLater::getPayLaterChargeStatus($id, $params); -var_dump($payLaterCharge); - - -$params = []; // Optional -$id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; -$payLaterChargeRefundCreate = \Xendit\PayLater::createPayLaterRefund($id, $params); -var_dump($payLaterChargeRefundCreate); - -$params = []; // Optional -$charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; -$refund_id = 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e'; -$payLaterChargeRefund = \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, $params); -var_dump($payLaterChargeRefund); - -$params = []; // Optional -$charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; -$payLaterChargeRefundList = \Xendit\PayLater::listPayLaterRefund($charge_id, $params); -var_dump($payLaterChargeRefundList); diff --git a/examples/PaymentChannelsExample.php b/examples/PaymentChannelsExample.php deleted file mode 100644 index f93ec5b..0000000 --- a/examples/PaymentChannelsExample.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$list = \Xendit\PaymentChannels::list(); -var_dump($list); diff --git a/examples/PayoutsExample.php b/examples/PayoutsExample.php deleted file mode 100644 index bb95870..0000000 --- a/examples/PayoutsExample.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'external_id' => 'payouts-123456789', - 'amount' => 50000, - "email" => 'demo@xendit.co' -]; - -$createPayout = \Xendit\Payouts::create($params); -var_dump($createPayout); - -$id = $createPayout['id']; - -$getPayout = \Xendit\Payouts::retrieve($id); -var_dump($getPayout); - -$voidPayout = \Xendit\Payouts::void($id); -var_dump($voidPayout); diff --git a/examples/PayoutsNewExample.php b/examples/PayoutsNewExample.php deleted file mode 100644 index 5799017..0000000 --- a/examples/PayoutsNewExample.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'reference_id' => 'ref-823723232', - 'channel_code' => 'ID_BRI', - 'channel_properties' => [ - 'account_number' => '0000000000', - 'account_holder_name' => 'Yanuar' - ], - 'amount' => 1000, - 'description' => 'Sample Successful Create IDR Payout', - 'currency' => 'IDR', - 'receipt_notification' => [ - 'email_to' => ['someone@example.com'], - 'email_cc' => ['someone1@example.com'], - 'email_bcc' => ['someone2@example.com'], - ], - 'metadata' => [ - 'lotto_outlet' => 24 - ] -]; - -$id = "disb-b57fff2d-9699-470b-9978-ac509c5b266c"; - -$create_payouts = \Xendit\PayoutsNew::create($params); -var_dump($create_payouts); - -$retrieve = \Xendit\PayoutsNew::retrieve($id); -var_dump($retrieve); - -$retrieveByReference = \Xendit\PayoutsNew::retrieveReference($params['reference_id']); -var_dump($retrieveByReference); - -$voidPayouts = \Xendit\PayoutsNew::cancel($id); -var_dump($voidPayouts); diff --git a/examples/PlatformExample.php b/examples/PlatformExample.php deleted file mode 100644 index 7b1d0b1..0000000 --- a/examples/PlatformExample.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'email' => 'customer@website.com', - 'type' => 'OWNED', - 'public_profile' => ['business_name' => 'customer company'] -]; - -$createAccount = \Xendit\Platform::createAccount($params); -var_dump($createAccount); - -$accountId = $createAccount['id']; - -$getAccount = \Xendit\Platform::getAccount($accountId); -var_dump($getAccount); - -$updateParams = [ - 'email' => 'customer@website.com', - 'public_profile' => ['business_name' => 'customer company updated'] -]; -$updateAccount = \Xendit\Platform::updateAccount($accountId, $updateParams); -var_dump($updateAccount); - -$transferParams = [ - 'reference' => ''.time(), - 'amount' => 50000, - 'source_user_id' => '54afeb170a2b18519b1b8768', - 'destination_user_id' => '5cafeb170a2b1851246b8768', -]; -$createTransfer = \Xendit\Platform::createTransfer($transferParams); -var_dump($createTransfer); - -$feeRuleParams = [ - 'name' => 'standard_platform_fee', - 'description' => 'Fee charged to insurance agents based in Java', - 'unit' => 'flat', - 'amount' => 6500, - 'currency' => 'IDR' -]; -$createFeeRule = \Xendit\Platform::createFeeRule($feeRuleParams); -var_dump($createFeeRule); - -$callbackUrlParams = [ - 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' -]; -$callbackType = 'invoice'; -$setCallbackUrl = \Xendit\Platform::setCallbackUrl($callbackType, $callbackUrlParams); -var_dump($setCallbackUrl); diff --git a/examples/PromotionExample.php b/examples/PromotionExample.php deleted file mode 100644 index 00f22dc..0000000 --- a/examples/PromotionExample.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'reference_id' => 'reference_123', - 'description' => 'test promotion', - 'currency' => 'IDR', - 'start_time' => (new DateTime('NOW'))->format('Y-d-m\TH:i:s.v\Z'), - 'end_time' => (new DateTime('NOW +1 day'))->format('Y-d-m\TH:i:s.v\Z'), - 'promo_code' => 'testpromo', - 'discount_amount' => 5000 -]; - -$promotion = \Xendit\Promotion::create($params); -var_dump($promotion); diff --git a/examples/QRCodeExample.php b/examples/QRCodeExample.php deleted file mode 100644 index 86b88b7..0000000 --- a/examples/QRCodeExample.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'external_id' => 'external_123', - 'type' => 'STATIC', - 'callback_url' => 'https://webhook.site', - 'amount' => 10000, -]; - -$created_qr_code = \Xendit\QRCode::create($params); -var_dump($created_qr_code); - -$qr_code = \Xendit\QRCode::get('external_123'); -var_dump($qr_code); diff --git a/examples/RecurringExample.php b/examples/RecurringExample.php deleted file mode 100644 index d670307..0000000 --- a/examples/RecurringExample.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000, - 'interval' => 'MONTH', - 'interval_count' => 1 -]; - -$createRecurring = \Xendit\Recurring::create($params); -var_dump($createRecurring); - -$id = $createRecurring['id']; - -$retrieveParams = [ - 'for-user-id' => '' -]; -$getRecurring = \Xendit\Recurring::retrieve($id, $retrieveParams); -var_dump($getRecurring); - -$editRecurring = \Xendit\Recurring::update($id, ['amount' => 10000]); -var_dump($editRecurring); - -$pauseRecurring = \Xendit\Recurring::pause($id); -var_dump($pauseRecurring); - -$resumeRecurring = \Xendit\Recurring::resume($id); -var_dump($resumeRecurring); - -$stopRecurring = \Xendit\Recurring::stop($id); -var_dump($stopRecurring); diff --git a/examples/ReportExample.php b/examples/ReportExample.php deleted file mode 100644 index 2b11d5a..0000000 --- a/examples/ReportExample.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'type' => 'TRANSACTIONS' -]; -$generate = \Xendit\Report::generate($params); -var_dump($generate); - -$detail = \Xendit\Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); -var_dump($detail); diff --git a/examples/RetailExample.php b/examples/RetailExample.php deleted file mode 100644 index 5920e37..0000000 --- a/examples/RetailExample.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = [ - 'external_id' => 'TEST-123456789', - 'retail_outlet_name' => 'ALFAMART', - 'name' => 'JOHN DOE', - 'expected_amount' => 25000 -]; - -$createFPC = \Xendit\Retail::create($params); -var_dump($createFPC); - -$id = $createFPC['id']; - -$getFPC = \Xendit\Retail::retrieve($id); -var_dump($getFPC); - -$updateParams = ['expected_amount' => 20000]; - -$updateFPC = \Xendit\Retail::update($id, $updateParams); -var_dump($updateFPC); diff --git a/examples/TransactionExample.php b/examples/TransactionExample.php deleted file mode 100644 index 41c3378..0000000 --- a/examples/TransactionExample.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); -$params = [ - 'types' => 'DISBURSEMENT', - 'for-user-id' => '', - 'query-param'=> 'true' -]; -$list = \Xendit\Transaction::list($params); -var_dump($list); - -$detail = \Xendit\Transaction::detail('txn_13dd178d-41fa-40b7-8fd3-f83675d6f413'); -var_dump($detail); diff --git a/examples/VirtualAccountExample.php b/examples/VirtualAccountExample.php deleted file mode 100644 index fe76833..0000000 --- a/examples/VirtualAccountExample.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Xendit; - -require 'vendor/autoload.php'; - -Xendit::setApiKey('SECRET_API_KEY'); - -$params = ["external_id" => "VA_fixed-12341234", - "bank_code" => "MANDIRI", - "name" => "Steve Wozniak" -]; - -$createVA = \Xendit\VirtualAccounts::create($params); -var_dump($createVA); - -$id = $createVA['id']; - -$getVABanks = \Xendit\VirtualAccounts::getVABanks(); -var_dump($getVABanks); - -$getVA = \Xendit\VirtualAccounts::retrieve($id); -var_dump($getVA); - -$updateParams = ["suggested_amount" => 1000]; - -$updateVA = \Xendit\VirtualAccounts::update($id, $updateParams); -var_dump($updateVA); - -$paymentID = "VA_fixed-1579666681_1579666702976"; - -$getFVAPayment = \Xendit\VirtualAccounts::getFVAPayment($paymentID); -var_dump($getFVAPayment); diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..f0e4299 --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,110 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/BalanceAndTransaction/Balance.php b/lib/BalanceAndTransaction/Balance.php new file mode 100644 index 0000000..dabebd8 --- /dev/null +++ b/lib/BalanceAndTransaction/Balance.php @@ -0,0 +1,406 @@ + + */ +class Balance implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Balance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'balance' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'balance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'balance' => 'balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'balance' => 'setBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'balance' => 'getBalance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('balance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['balance'] === null) { + $invalidProperties[] = "'balance' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets balance + * + * @return float + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param float $balance balance + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + throw new \InvalidArgumentException('non-nullable balance cannot be null'); + } + $this->container['balance'] = $balance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/BalanceApi.php b/lib/BalanceAndTransaction/BalanceApi.php new file mode 100644 index 0000000..e5f4278 --- /dev/null +++ b/lib/BalanceAndTransaction/BalanceApi.php @@ -0,0 +1,496 @@ + [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getBalance + * + * Retrieves balances for a business, default to CASH type + * + * @param string $account_type The selected balance type (optional, default to 'CASH') + * @param string $currency Currency for filter for customers with multi currency accounts (optional) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalance'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\BalanceAndTransaction\Balance|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError + */ + public function getBalance($account_type = 'CASH', $currency = null, $for_user_id = null, string $contentType = self::contentTypes['getBalance'][0]) + { + list($response) = $this->getBalanceWithHttpInfo($account_type, $currency, $for_user_id, $contentType); + return $response; + } + + /** + * Operation getBalanceWithHttpInfo + * + * Retrieves balances for a business, default to CASH type + * + * @param string $account_type The selected balance type (optional, default to 'CASH') + * @param string $currency Currency for filter for customers with multi currency accounts (optional) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalance'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\BalanceAndTransaction\Balance|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function getBalanceWithHttpInfo($account_type = 'CASH', $currency = null, $for_user_id = null, string $contentType = self::contentTypes['getBalance'][0]) + { + $request = $this->getBalanceRequest($account_type, $currency, $for_user_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\BalanceAndTransaction\Balance' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\Balance' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\Balance', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\BalanceAndTransaction\ValidationError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ValidationError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\BalanceAndTransaction\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\BalanceAndTransaction\Balance'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\Balance', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBalanceAsync + * + * Retrieves balances for a business, default to CASH type + * + * @param Xenditstring $account_type The selected balance type (optional, default to 'CASH') + * @param Xenditstring $currency Currency for filter for customers with multi currency accounts (optional) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBalanceAsync($account_type = 'CASH', $currency = null, $for_user_id = null, string $contentType = self::contentTypes['getBalance'][0]) + { + return $this->getBalanceAsyncWithHttpInfo($account_type, $currency, $for_user_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBalanceAsyncWithHttpInfo + * + * Retrieves balances for a business, default to CASH type + * + * @param Xenditstring $account_type The selected balance type (optional, default to 'CASH') + * @param Xenditstring $currency Currency for filter for customers with multi currency accounts (optional) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBalanceAsyncWithHttpInfo($account_type = 'CASH', $currency = null, $for_user_id = null, string $contentType = self::contentTypes['getBalance'][0]) + { + $returnType = '\BalanceAndTransaction\Balance'; + $request = $this->getBalanceRequest($account_type, $currency, $for_user_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getBalance' + * + * @param string $account_type The selected balance type (optional, default to 'CASH') + * @param string $currency Currency for filter for customers with multi currency accounts (optional) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBalanceRequest($account_type = 'CASH', $currency = null, $for_user_id = null, string $contentType = self::contentTypes['getBalance'][0]) + { + + + + + + $resourcePath = '/balance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_type, + 'account_type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $currency, + 'currency', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header param: for-user-id + if ($for_user_id !== null) { + $headerParams['for-user-id'] = ObjectSerializer::toHeaderValue($for_user_id); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/BalanceAndTransaction/ChannelsCategories.php b/lib/BalanceAndTransaction/ChannelsCategories.php new file mode 100644 index 0000000..240c4b8 --- /dev/null +++ b/lib/BalanceAndTransaction/ChannelsCategories.php @@ -0,0 +1,114 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum ChannelsCategories: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BANK, + self::CARDLESS_CREDIT, + self::PAYLATER, + self::CARDS, + self::CASH, + self::DIRECT_DEBIT, + self::EWALLET, + self::INVOICE, + self::QR_CODE, + self::RETAIL_OUTLET, + self::VIRTUAL_ACCOUNT, + self::XENPLATFORM, + self::DIRECT_BANK_TRANSFER, + self::OTHER + ]; + } +} + + diff --git a/lib/BalanceAndTransaction/Currency.php b/lib/BalanceAndTransaction/Currency.php new file mode 100644 index 0000000..0e51d4b --- /dev/null +++ b/lib/BalanceAndTransaction/Currency.php @@ -0,0 +1,558 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum Currency: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::IDR, + self::PHP, + self::USD, + self::JPY, + self::VND, + self::SGD, + self::AED, + self::AFN, + self::ALL, + self::AMD, + self::ANG, + self::AOA, + self::ARS, + self::AUD, + self::AWG, + self::AZN, + self::BAM, + self::BBD, + self::BDT, + self::BGN, + self::BHD, + self::BIF, + self::BMD, + self::BND, + self::BOB, + self::BRL, + self::BSD, + self::BTN, + self::BWP, + self::BYN, + self::BZD, + self::CAD, + self::CDF, + self::CHF, + self::CLP, + self::CNY, + self::COP, + self::CRC, + self::CUC, + self::CUP, + self::CVE, + self::CZK, + self::DJF, + self::DKK, + self::DOP, + self::DZD, + self::EGP, + self::ERN, + self::ETB, + self::EUR, + self::FJD, + self::FKP, + self::GBP, + self::GEL, + self::GGP, + self::GHS, + self::GIP, + self::GMD, + self::GNF, + self::GTQ, + self::GYD, + self::HKD, + self::HNL, + self::HRK, + self::HTG, + self::HUF, + self::ILS, + self::IMP, + self::INR, + self::IQD, + self::IRR, + self::ISK, + self::JEP, + self::JMD, + self::JOD, + self::KES, + self::KGS, + self::KHR, + self::KMF, + self::KPW, + self::KRW, + self::KWD, + self::KYD, + self::KZT, + self::LAK, + self::LBP, + self::LKR, + self::LRD, + self::LSL, + self::LYD, + self::MAD, + self::MDL, + self::MGA, + self::MKD, + self::MMK, + self::MNT, + self::MOP, + self::MRU, + self::MUR, + self::MVR, + self::MWK, + self::MXN, + self::MYR, + self::MZN, + self::NAD, + self::NGN, + self::NIO, + self::NOK, + self::NPR, + self::NZD, + self::OMR, + self::PAB, + self::PEN, + self::PGK, + self::PKR, + self::PLN, + self::PYG, + self::QAR, + self::RON, + self::RSD, + self::RUB, + self::RWF, + self::SAR, + self::SBD, + self::SCR, + self::SDG, + self::SEK, + self::SHP, + self::SLL, + self::SOS, + self::SPL, + self::SRD, + self::STN, + self::SVC, + self::SYP, + self::SZL, + self::THB, + self::TJS, + self::TMT, + self::TND, + self::TOP, + self::_TRY, + self::TTD, + self::TVD, + self::TWD, + self::TZS, + self::UAH, + self::UGX, + self::UYU, + self::UZS, + self::VEF, + self::VUV, + self::WST, + self::XAF, + self::XCD, + self::XDR, + self::XOF, + self::XPF, + self::YER, + self::ZAR, + self::ZMW, + self::ZWD + ]; + } +} + + diff --git a/lib/BalanceAndTransaction/DateRangeFilter.php b/lib/BalanceAndTransaction/DateRangeFilter.php new file mode 100644 index 0000000..eb35425 --- /dev/null +++ b/lib/BalanceAndTransaction/DateRangeFilter.php @@ -0,0 +1,436 @@ + + */ +class DateRangeFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DateRangeFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'gte' => '\DateTime', + 'lte' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'gte' => 'date-time', + 'lte' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'gte' => false, + 'lte' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'gte' => 'gte', + 'lte' => 'lte' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'gte' => 'setGte', + 'lte' => 'setLte' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'gte' => 'getGte', + 'lte' => 'getLte' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('gte', $data ?? [], null); + $this->setIfExists('lte', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets gte + * + * @return \DateTime|null + */ + public function getGte() + { + return $this->container['gte']; + } + + /** + * Sets gte + * + * @param \DateTime|null $gte Start time of transaction. If not specified will list all dates. + * + * @return self + */ + public function setGte($gte) + { + if (is_null($gte)) { + throw new \InvalidArgumentException('non-nullable gte cannot be null'); + } + $this->container['gte'] = $gte; + + return $this; + } + + /** + * Gets lte + * + * @return \DateTime|null + */ + public function getLte() + { + return $this->container['lte']; + } + + /** + * Sets lte + * + * @param \DateTime|null $lte End time of transaction. If not specified will list all dates. + * + * @return self + */ + public function setLte($lte) + { + if (is_null($lte)) { + throw new \InvalidArgumentException('non-nullable lte cannot be null'); + } + $this->container['lte'] = $lte; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/FeeResponse.php b/lib/BalanceAndTransaction/FeeResponse.php new file mode 100644 index 0000000..5ac1c3e --- /dev/null +++ b/lib/BalanceAndTransaction/FeeResponse.php @@ -0,0 +1,582 @@ + + */ +class FeeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FeeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'xendit_fee' => 'float', + 'value_added_tax' => 'float', + 'xendit_withholding_tax' => 'float', + 'third_party_withholding_tax' => 'float', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'xendit_fee' => null, + 'value_added_tax' => null, + 'xendit_withholding_tax' => null, + 'third_party_withholding_tax' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'xendit_fee' => false, + 'value_added_tax' => false, + 'xendit_withholding_tax' => false, + 'third_party_withholding_tax' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'xendit_fee' => 'xendit_fee', + 'value_added_tax' => 'value_added_tax', + 'xendit_withholding_tax' => 'xendit_withholding_tax', + 'third_party_withholding_tax' => 'third_party_withholding_tax', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'xendit_fee' => 'setXenditFee', + 'value_added_tax' => 'setValueAddedTax', + 'xendit_withholding_tax' => 'setXenditWithholdingTax', + 'third_party_withholding_tax' => 'setThirdPartyWithholdingTax', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'xendit_fee' => 'getXenditFee', + 'value_added_tax' => 'getValueAddedTax', + 'xendit_withholding_tax' => 'getXenditWithholdingTax', + 'third_party_withholding_tax' => 'getThirdPartyWithholdingTax', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_COMPLETED = 'COMPLETED'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_REVERSED = 'REVERSED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_COMPLETED, + self::STATUS_CANCELED, + self::STATUS_REVERSED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('xendit_fee', $data ?? [], null); + $this->setIfExists('value_added_tax', $data ?? [], null); + $this->setIfExists('xendit_withholding_tax', $data ?? [], null); + $this->setIfExists('third_party_withholding_tax', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['xendit_fee'] === null) { + $invalidProperties[] = "'xendit_fee' can't be null"; + } + if ($this->container['value_added_tax'] === null) { + $invalidProperties[] = "'value_added_tax' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets xendit_fee + * + * @return float + */ + public function getXenditFee() + { + return $this->container['xendit_fee']; + } + + /** + * Sets xendit_fee + * + * @param float $xendit_fee Amount of the Xendit fee for this transaction. + * + * @return self + */ + public function setXenditFee($xendit_fee) + { + if (is_null($xendit_fee)) { + throw new \InvalidArgumentException('non-nullable xendit_fee cannot be null'); + } + $this->container['xendit_fee'] = $xendit_fee; + + return $this; + } + + /** + * Gets value_added_tax + * + * @return float + */ + public function getValueAddedTax() + { + return $this->container['value_added_tax']; + } + + /** + * Sets value_added_tax + * + * @param float $value_added_tax Amount of the VAT for this transaction. + * + * @return self + */ + public function setValueAddedTax($value_added_tax) + { + if (is_null($value_added_tax)) { + throw new \InvalidArgumentException('non-nullable value_added_tax cannot be null'); + } + $this->container['value_added_tax'] = $value_added_tax; + + return $this; + } + + /** + * Gets xendit_withholding_tax + * + * @return float|null + */ + public function getXenditWithholdingTax() + { + return $this->container['xendit_withholding_tax']; + } + + /** + * Sets xendit_withholding_tax + * + * @param float|null $xendit_withholding_tax Amount of the Xendit Withholding Tax for this transaction if applicable. See [Tax Documentation](https://docs.xendit.co/fees-and-vat#vat) for more information. + * + * @return self + */ + public function setXenditWithholdingTax($xendit_withholding_tax) + { + if (is_null($xendit_withholding_tax)) { + throw new \InvalidArgumentException('non-nullable xendit_withholding_tax cannot be null'); + } + $this->container['xendit_withholding_tax'] = $xendit_withholding_tax; + + return $this; + } + + /** + * Gets third_party_withholding_tax + * + * @return float|null + */ + public function getThirdPartyWithholdingTax() + { + return $this->container['third_party_withholding_tax']; + } + + /** + * Sets third_party_withholding_tax + * + * @param float|null $third_party_withholding_tax Amount of the 3rd Party Withholding Tax for this transaction if applicable. 3rd party example: Bank + * + * @return self + */ + public function setThirdPartyWithholdingTax($third_party_withholding_tax) + { + if (is_null($third_party_withholding_tax)) { + throw new \InvalidArgumentException('non-nullable third_party_withholding_tax cannot be null'); + } + $this->container['third_party_withholding_tax'] = $third_party_withholding_tax; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/LinkItem.php b/lib/BalanceAndTransaction/LinkItem.php new file mode 100644 index 0000000..50f790e --- /dev/null +++ b/lib/BalanceAndTransaction/LinkItem.php @@ -0,0 +1,479 @@ + + */ +class LinkItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LinkItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['href'] === null) { + $invalidProperties[] = "'href' can't be null"; + } + if ($this->container['rel'] === null) { + $invalidProperties[] = "'rel' can't be null"; + } + if ($this->container['method'] === null) { + $invalidProperties[] = "'method' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string + */ + public function getHref() + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string $href URI of target, this will be to the next link. + * + * @return self + */ + public function setHref($href) + { + if (is_null($href)) { + throw new \InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string + */ + public function getRel() + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string $rel The relationship between source and target. The value will be `next`. + * + * @return self + */ + public function setRel($rel) + { + if (is_null($rel)) { + throw new \InvalidArgumentException('non-nullable rel cannot be null'); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string $method The HTTP method, the value will be `GET`. + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/ServerError.php b/lib/BalanceAndTransaction/ServerError.php new file mode 100644 index 0000000..92e75f0 --- /dev/null +++ b/lib/BalanceAndTransaction/ServerError.php @@ -0,0 +1,479 @@ + + */ +class ServerError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status_code' => 'float', + 'error' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status_code' => null, + 'error' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status_code' => false, + 'error' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status_code' => 'status_code', + 'error' => 'error', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status_code' => 'setStatusCode', + 'error' => 'setError', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status_code' => 'getStatusCode', + 'error' => 'getError', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status_code', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['status_code'] === null) { + $invalidProperties[] = "'status_code' can't be null"; + } + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status_code + * + * @return float + */ + public function getStatusCode() + { + return $this->container['status_code']; + } + + /** + * Sets status_code + * + * @param float $status_code status_code + * + * @return self + */ + public function setStatusCode($status_code) + { + if (is_null($status_code)) { + throw new \InvalidArgumentException('non-nullable status_code cannot be null'); + } + $this->container['status_code'] = $status_code; + + return $this; + } + + /** + * Gets error + * + * @return string + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/TransactionApi.php b/lib/BalanceAndTransaction/TransactionApi.php new file mode 100644 index 0000000..2c162e0 --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionApi.php @@ -0,0 +1,1021 @@ + [ + 'application/json', + ], + 'getTransactionByID' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getAllTransactions + * + * Get a list of transactions + * + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param \BalanceAndTransaction\TransactionTypes[] $types Transaction types that will be included in the result. Default is to include all transaction types (optional) + * @param \BalanceAndTransaction\TransactionStatuses[] $statuses Status of the transaction. Default is to include all status. (optional) + * @param \BalanceAndTransaction\ChannelsCategories[] $channel_categories Payment channels in which the transaction is carried out. Default is to include all channels. (optional) + * @param string $reference_id To filter the result for transactions with matching reference given (case sensitive) (optional) + * @param string $product_id To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) (optional) + * @param string $account_identifier Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. (optional) + * @param float $amount Specific transaction amount to search for (optional) + * @param Currency $currency currency (optional) + * @param DateRangeFilter $created Filter time of transaction by created date. If not specified will list all dates. (optional) + * @param DateRangeFilter $updated Filter time of transaction by updated date. If not specified will list all dates. (optional) + * @param float $limit number of items in the result per page. Another name for \"results_per_page\" (optional, default to 10) + * @param string $after_id after_id (optional) + * @param string $before_id before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTransactions'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\BalanceAndTransaction\TransactionsResponse|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError + */ + public function getAllTransactions($for_user_id = null, $types = null, $statuses = null, $channel_categories = null, $reference_id = null, $product_id = null, $account_identifier = null, $amount = null, $currency = null, $created = null, $updated = null, $limit = 10, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getAllTransactions'][0]) + { + list($response) = $this->getAllTransactionsWithHttpInfo($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id, $contentType); + return $response; + } + + /** + * Operation getAllTransactionsWithHttpInfo + * + * Get a list of transactions + * + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param \BalanceAndTransaction\TransactionTypes[] $types Transaction types that will be included in the result. Default is to include all transaction types (optional) + * @param \BalanceAndTransaction\TransactionStatuses[] $statuses Status of the transaction. Default is to include all status. (optional) + * @param \BalanceAndTransaction\ChannelsCategories[] $channel_categories Payment channels in which the transaction is carried out. Default is to include all channels. (optional) + * @param string $reference_id To filter the result for transactions with matching reference given (case sensitive) (optional) + * @param string $product_id To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) (optional) + * @param string $account_identifier Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. (optional) + * @param float $amount Specific transaction amount to search for (optional) + * @param Currency $currency (optional) + * @param DateRangeFilter $created Filter time of transaction by created date. If not specified will list all dates. (optional) + * @param DateRangeFilter $updated Filter time of transaction by updated date. If not specified will list all dates. (optional) + * @param float $limit number of items in the result per page. Another name for \"results_per_page\" (optional, default to 10) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTransactions'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\BalanceAndTransaction\TransactionsResponse|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllTransactionsWithHttpInfo($for_user_id = null, $types = null, $statuses = null, $channel_categories = null, $reference_id = null, $product_id = null, $account_identifier = null, $amount = null, $currency = null, $created = null, $updated = null, $limit = 10, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getAllTransactions'][0]) + { + $request = $this->getAllTransactionsRequest($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\BalanceAndTransaction\TransactionsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\TransactionsResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\TransactionsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\BalanceAndTransaction\ValidationError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ValidationError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\BalanceAndTransaction\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\BalanceAndTransaction\TransactionsResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\TransactionsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllTransactionsAsync + * + * Get a list of transactions + * + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param Xendit\BalanceAndTransaction\TransactionTypes[] $types Transaction types that will be included in the result. Default is to include all transaction types (optional) + * @param Xendit\BalanceAndTransaction\TransactionStatuses[] $statuses Status of the transaction. Default is to include all status. (optional) + * @param Xendit\BalanceAndTransaction\ChannelsCategories[] $channel_categories Payment channels in which the transaction is carried out. Default is to include all channels. (optional) + * @param Xenditstring $reference_id To filter the result for transactions with matching reference given (case sensitive) (optional) + * @param Xenditstring $product_id To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) (optional) + * @param Xenditstring $account_identifier Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. (optional) + * @param Xenditfloat $amount Specific transaction amount to search for (optional) + * @param XenditCurrency $currency (optional) + * @param XenditDateRangeFilter $created Filter time of transaction by created date. If not specified will list all dates. (optional) + * @param XenditDateRangeFilter $updated Filter time of transaction by updated date. If not specified will list all dates. (optional) + * @param Xenditfloat $limit number of items in the result per page. Another name for \"results_per_page\" (optional, default to 10) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTransactionsAsync($for_user_id = null, $types = null, $statuses = null, $channel_categories = null, $reference_id = null, $product_id = null, $account_identifier = null, $amount = null, $currency = null, $created = null, $updated = null, $limit = 10, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getAllTransactions'][0]) + { + return $this->getAllTransactionsAsyncWithHttpInfo($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllTransactionsAsyncWithHttpInfo + * + * Get a list of transactions + * + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param Xendit\BalanceAndTransaction\TransactionTypes[] $types Transaction types that will be included in the result. Default is to include all transaction types (optional) + * @param Xendit\BalanceAndTransaction\TransactionStatuses[] $statuses Status of the transaction. Default is to include all status. (optional) + * @param Xendit\BalanceAndTransaction\ChannelsCategories[] $channel_categories Payment channels in which the transaction is carried out. Default is to include all channels. (optional) + * @param Xenditstring $reference_id To filter the result for transactions with matching reference given (case sensitive) (optional) + * @param Xenditstring $product_id To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) (optional) + * @param Xenditstring $account_identifier Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. (optional) + * @param Xenditfloat $amount Specific transaction amount to search for (optional) + * @param XenditCurrency $currency (optional) + * @param XenditDateRangeFilter $created Filter time of transaction by created date. If not specified will list all dates. (optional) + * @param XenditDateRangeFilter $updated Filter time of transaction by updated date. If not specified will list all dates. (optional) + * @param Xenditfloat $limit number of items in the result per page. Another name for \"results_per_page\" (optional, default to 10) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllTransactionsAsyncWithHttpInfo($for_user_id = null, $types = null, $statuses = null, $channel_categories = null, $reference_id = null, $product_id = null, $account_identifier = null, $amount = null, $currency = null, $created = null, $updated = null, $limit = 10, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getAllTransactions'][0]) + { + $returnType = '\BalanceAndTransaction\TransactionsResponse'; + $request = $this->getAllTransactionsRequest($for_user_id, $types, $statuses, $channel_categories, $reference_id, $product_id, $account_identifier, $amount, $currency, $created, $updated, $limit, $after_id, $before_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllTransactions' + * + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param \BalanceAndTransaction\TransactionTypes[] $types Transaction types that will be included in the result. Default is to include all transaction types (optional) + * @param \BalanceAndTransaction\TransactionStatuses[] $statuses Status of the transaction. Default is to include all status. (optional) + * @param \BalanceAndTransaction\ChannelsCategories[] $channel_categories Payment channels in which the transaction is carried out. Default is to include all channels. (optional) + * @param string $reference_id To filter the result for transactions with matching reference given (case sensitive) (optional) + * @param string $product_id To filter the result for transactions with matching product_id (a.k.a payment_id) given (case sensitive) (optional) + * @param string $account_identifier Account identifier of transaction. The format will be different from each channel. For example, on `BANK` channel it will be account number and on `CARD` it will be masked card number. (optional) + * @param float $amount Specific transaction amount to search for (optional) + * @param Currency $currency (optional) + * @param DateRangeFilter $created Filter time of transaction by created date. If not specified will list all dates. (optional) + * @param DateRangeFilter $updated Filter time of transaction by updated date. If not specified will list all dates. (optional) + * @param float $limit number of items in the result per page. Another name for \"results_per_page\" (optional, default to 10) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllTransactionsRequest($for_user_id = null, $types = null, $statuses = null, $channel_categories = null, $reference_id = null, $product_id = null, $account_identifier = null, $amount = null, $currency = null, $created = null, $updated = null, $limit = 10, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getAllTransactions'][0]) + { + + + + + + + + + + + + + if ($limit !== null && $limit > 50) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionApi.getAllTransactions, must be smaller than or equal to 50.'); + } + + if ($after_id !== null && !preg_match("/^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/", $after_id)) { + throw new \InvalidArgumentException("invalid value for \"after_id\" when calling TransactionApi.getAllTransactions, must conform to the pattern /^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/."); + } + + if ($before_id !== null && !preg_match("/^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/", $before_id)) { + throw new \InvalidArgumentException("invalid value for \"before_id\" when calling TransactionApi.getAllTransactions, must conform to the pattern /^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/."); + } + + + $resourcePath = '/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $types, + 'types', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $statuses, + 'statuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $channel_categories, + 'channel_categories', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reference_id, + 'reference_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $product_id, + 'product_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_identifier, + 'account_identifier', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $amount, + 'amount', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $currency, + 'currency', // param base name + 'Currency', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created, + 'created', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated, + 'updated', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header param: for-user-id + if ($for_user_id !== null) { + $headerParams['for-user-id'] = ObjectSerializer::toHeaderValue($for_user_id); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTransactionByID + * + * Get a transaction based on its id + * + * @param string $id id (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransactionByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\BalanceAndTransaction\TransactionResponse|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError + */ + public function getTransactionByID($id, $for_user_id = null, string $contentType = self::contentTypes['getTransactionByID'][0]) + { + list($response) = $this->getTransactionByIDWithHttpInfo($id, $for_user_id, $contentType); + return $response; + } + + /** + * Operation getTransactionByIDWithHttpInfo + * + * Get a transaction based on its id + * + * @param string $id (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransactionByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\BalanceAndTransaction\TransactionResponse|Xendit\BalanceAndTransaction\ValidationError|Xendit\BalanceAndTransaction\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function getTransactionByIDWithHttpInfo($id, $for_user_id = null, string $contentType = self::contentTypes['getTransactionByID'][0]) + { + $request = $this->getTransactionByIDRequest($id, $for_user_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\BalanceAndTransaction\TransactionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\TransactionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\TransactionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\BalanceAndTransaction\ValidationError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ValidationError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ValidationError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\BalanceAndTransaction\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\BalanceAndTransaction\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\BalanceAndTransaction\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\BalanceAndTransaction\TransactionResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\TransactionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ValidationError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\BalanceAndTransaction\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTransactionByIDAsync + * + * Get a transaction based on its id + * + * @param Xenditstring $id (required) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransactionByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTransactionByIDAsync($id, $for_user_id = null, string $contentType = self::contentTypes['getTransactionByID'][0]) + { + return $this->getTransactionByIDAsyncWithHttpInfo($id, $for_user_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTransactionByIDAsyncWithHttpInfo + * + * Get a transaction based on its id + * + * @param Xenditstring $id (required) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransactionByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTransactionByIDAsyncWithHttpInfo($id, $for_user_id = null, string $contentType = self::contentTypes['getTransactionByID'][0]) + { + $returnType = '\BalanceAndTransaction\TransactionResponse'; + $request = $this->getTransactionByIDRequest($id, $for_user_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTransactionByID' + * + * @param string $id (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTransactionByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTransactionByIDRequest($id, $for_user_id = null, string $contentType = self::contentTypes['getTransactionByID'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getTransactionByID' + ); + } + if (!preg_match("/^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/", $id)) { + throw new \InvalidArgumentException("invalid value for \"id\" when calling TransactionApi.getTransactionByID, must conform to the pattern /^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/."); + } + + + + $resourcePath = '/transactions/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: for-user-id + if ($for_user_id !== null) { + $headerParams['for-user-id'] = ObjectSerializer::toHeaderValue($for_user_id); + } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/BalanceAndTransaction/TransactionResponse.php b/lib/BalanceAndTransaction/TransactionResponse.php new file mode 100644 index 0000000..ab19140 --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionResponse.php @@ -0,0 +1,1096 @@ + + */ +class TransactionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransactionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'product_id' => 'string', + 'type' => '\Xendit\BalanceAndTransaction\TransactionResponseType', + 'status' => '\Xendit\BalanceAndTransaction\TransactionStatuses', + 'channel_category' => '\Xendit\BalanceAndTransaction\ChannelsCategories', + 'channel_code' => 'string', + 'account_identifier' => 'string', + 'reference_id' => 'string', + 'currency' => '\Xendit\BalanceAndTransaction\Currency', + 'amount' => 'float', + 'cashflow' => 'string', + 'settlement_status' => 'string', + 'estimated_settlement_time' => '\DateTime', + 'business_id' => 'string', + 'fee' => '\Xendit\BalanceAndTransaction\FeeResponse', + 'created' => '\DateTime', + 'updated' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'product_id' => null, + 'type' => null, + 'status' => null, + 'channel_category' => null, + 'channel_code' => null, + 'account_identifier' => null, + 'reference_id' => null, + 'currency' => null, + 'amount' => null, + 'cashflow' => null, + 'settlement_status' => null, + 'estimated_settlement_time' => 'date-time', + 'business_id' => null, + 'fee' => null, + 'created' => 'date-time', + 'updated' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'product_id' => false, + 'type' => false, + 'status' => false, + 'channel_category' => false, + 'channel_code' => true, + 'account_identifier' => true, + 'reference_id' => false, + 'currency' => false, + 'amount' => false, + 'cashflow' => false, + 'settlement_status' => true, + 'estimated_settlement_time' => true, + 'business_id' => false, + 'fee' => false, + 'created' => false, + 'updated' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'product_id' => 'product_id', + 'type' => 'type', + 'status' => 'status', + 'channel_category' => 'channel_category', + 'channel_code' => 'channel_code', + 'account_identifier' => 'account_identifier', + 'reference_id' => 'reference_id', + 'currency' => 'currency', + 'amount' => 'amount', + 'cashflow' => 'cashflow', + 'settlement_status' => 'settlement_status', + 'estimated_settlement_time' => 'estimated_settlement_time', + 'business_id' => 'business_id', + 'fee' => 'fee', + 'created' => 'created', + 'updated' => 'updated' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'product_id' => 'setProductId', + 'type' => 'setType', + 'status' => 'setStatus', + 'channel_category' => 'setChannelCategory', + 'channel_code' => 'setChannelCode', + 'account_identifier' => 'setAccountIdentifier', + 'reference_id' => 'setReferenceId', + 'currency' => 'setCurrency', + 'amount' => 'setAmount', + 'cashflow' => 'setCashflow', + 'settlement_status' => 'setSettlementStatus', + 'estimated_settlement_time' => 'setEstimatedSettlementTime', + 'business_id' => 'setBusinessId', + 'fee' => 'setFee', + 'created' => 'setCreated', + 'updated' => 'setUpdated' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'product_id' => 'getProductId', + 'type' => 'getType', + 'status' => 'getStatus', + 'channel_category' => 'getChannelCategory', + 'channel_code' => 'getChannelCode', + 'account_identifier' => 'getAccountIdentifier', + 'reference_id' => 'getReferenceId', + 'currency' => 'getCurrency', + 'amount' => 'getAmount', + 'cashflow' => 'getCashflow', + 'settlement_status' => 'getSettlementStatus', + 'estimated_settlement_time' => 'getEstimatedSettlementTime', + 'business_id' => 'getBusinessId', + 'fee' => 'getFee', + 'created' => 'getCreated', + 'updated' => 'getUpdated' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CASHFLOW_IN = 'MONEY_IN'; + public const CASHFLOW_OUT = 'MONEY_OUT'; + public const SETTLEMENT_STATUS_PENDING = 'PENDING'; + public const SETTLEMENT_STATUS_SETTLED = 'SETTLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCashflowAllowableValues() + { + return [ + self::CASHFLOW_IN, + self::CASHFLOW_OUT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSettlementStatusAllowableValues() + { + return [ + self::SETTLEMENT_STATUS_PENDING, + self::SETTLEMENT_STATUS_SETTLED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('product_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel_category', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('account_identifier', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('cashflow', $data ?? [], null); + $this->setIfExists('settlement_status', $data ?? [], null); + $this->setIfExists('estimated_settlement_time', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('fee', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if (!preg_match("/^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/", $this->container['id'])) { + $invalidProperties[] = "invalid value for 'id', must be conform to the pattern /^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/."; + } + + if ($this->container['product_id'] === null) { + $invalidProperties[] = "'product_id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['channel_category'] === null) { + $invalidProperties[] = "'channel_category' can't be null"; + } + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['account_identifier'] === null) { + $invalidProperties[] = "'account_identifier' can't be null"; + } + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['cashflow'] === null) { + $invalidProperties[] = "'cashflow' can't be null"; + } + $allowedValues = $this->getCashflowAllowableValues(); + if (!is_null($this->container['cashflow']) && !in_array($this->container['cashflow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'cashflow', must be one of '%s'", + $this->container['cashflow'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getSettlementStatusAllowableValues(); + if (!is_null($this->container['settlement_status']) && !in_array($this->container['settlement_status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'settlement_status', must be one of '%s'", + $this->container['settlement_status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['business_id'] === null) { + $invalidProperties[] = "'business_id' can't be null"; + } + if ($this->container['fee'] === null) { + $invalidProperties[] = "'fee' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique id of a transaction. It will have `txn_` as prefix + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + + if ((!preg_match("/^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/", $id))) { + throw new \InvalidArgumentException("invalid value for \$id when calling TransactionResponse., must conform to the pattern /^txn_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/."); + } + + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets product_id + * + * @return string + */ + public function getProductId() + { + return $this->container['product_id']; + } + + /** + * Sets product_id + * + * @param string $product_id The product_id of the transaction. Product id will have a different prefix for each product. You can use this id to match the transaction from this API to each product API. + * + * @return self + */ + public function setProductId($product_id) + { + if (is_null($product_id)) { + throw new \InvalidArgumentException('non-nullable product_id cannot be null'); + } + $this->container['product_id'] = $product_id; + + return $this; + } + + /** + * Gets type + * + * @return \BalanceAndTransaction\TransactionResponseType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \BalanceAndTransaction\TransactionResponseType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return \BalanceAndTransaction\TransactionStatuses + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \BalanceAndTransaction\TransactionStatuses $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel_category + * + * @return \BalanceAndTransaction\ChannelsCategories + */ + public function getChannelCategory() + { + return $this->container['channel_category']; + } + + /** + * Sets channel_category + * + * @param \BalanceAndTransaction\ChannelsCategories $channel_category channel_category + * + * @return self + */ + public function setChannelCategory($channel_category) + { + if (is_null($channel_category)) { + throw new \InvalidArgumentException('non-nullable channel_category cannot be null'); + } + $this->container['channel_category'] = $channel_category; + + return $this; + } + + /** + * Gets channel_code + * + * @return string + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string $channel_code The channel of the transaction that is used. See [channel codes](https://docs.xendit.co/xendisburse/channel-codes) for the list of available per channel categories. + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + array_push($this->openAPINullablesSetToNull, 'channel_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets account_identifier + * + * @return string + */ + public function getAccountIdentifier() + { + return $this->container['account_identifier']; + } + + /** + * Sets account_identifier + * + * @param string $account_identifier Account identifier of transaction. The format will be different from each channel. + * + * @return self + */ + public function setAccountIdentifier($account_identifier) + { + if (is_null($account_identifier)) { + array_push($this->openAPINullablesSetToNull, 'account_identifier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('account_identifier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['account_identifier'] = $account_identifier; + + return $this; + } + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id customer supplied reference/external_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets currency + * + * @return \BalanceAndTransaction\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \BalanceAndTransaction\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount The transaction amount. The number of decimal places will be different for each currency according to ISO 4217. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets cashflow + * + * @return string + */ + public function getCashflow() + { + return $this->container['cashflow']; + } + + /** + * Sets cashflow + * + * @param string $cashflow Representing whether the transaction is money in or money out For transfer, the transfer out side it will shows up as money out and on transfer in side in will shows up as money-in. Available values are `MONEY_IN` for money in and `MONEY_OUT` for money out. + * + * @return self + */ + public function setCashflow($cashflow) + { + if (is_null($cashflow)) { + throw new \InvalidArgumentException('non-nullable cashflow cannot be null'); + } + $allowedValues = $this->getCashflowAllowableValues(); + if (!in_array($cashflow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'cashflow', must be one of '%s'", + $cashflow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['cashflow'] = $cashflow; + + return $this; + } + + /** + * Gets settlement_status + * + * @return string|null + */ + public function getSettlementStatus() + { + return $this->container['settlement_status']; + } + + /** + * Sets settlement_status + * + * @param string|null $settlement_status The settlement status of the transaction. `PENDING` - Transaction amount has not been settled to merchant's balance. `SETTLED` - Transaction has been settled to merchant's balance + * + * @return self + */ + public function setSettlementStatus($settlement_status) + { + if (is_null($settlement_status)) { + array_push($this->openAPINullablesSetToNull, 'settlement_status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('settlement_status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getSettlementStatusAllowableValues(); + if (!is_null($settlement_status) && !in_array($settlement_status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'settlement_status', must be one of '%s'", + $settlement_status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['settlement_status'] = $settlement_status; + + return $this; + } + + /** + * Gets estimated_settlement_time + * + * @return \DateTime|null + */ + public function getEstimatedSettlementTime() + { + return $this->container['estimated_settlement_time']; + } + + /** + * Sets estimated_settlement_time + * + * @param \DateTime|null $estimated_settlement_time Estimated settlement time will only apply to money-in transactions. For money-out transaction, the value will be `NULL`. Estimated settlement time in which transaction amount will be settled to merchant's balance. + * + * @return self + */ + public function setEstimatedSettlementTime($estimated_settlement_time) + { + if (is_null($estimated_settlement_time)) { + array_push($this->openAPINullablesSetToNull, 'estimated_settlement_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('estimated_settlement_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['estimated_settlement_time'] = $estimated_settlement_time; + + return $this; + } + + /** + * Gets business_id + * + * @return string + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string $business_id The id of business where this transaction belong to + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets fee + * + * @return \BalanceAndTransaction\FeeResponse + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param \BalanceAndTransaction\FeeResponse $fee fee + * + * @return self + */ + public function setFee($fee) + { + if (is_null($fee)) { + throw new \InvalidArgumentException('non-nullable fee cannot be null'); + } + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime $created Transaction created timestamp (UTC+0) + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime $updated Transaction updated timestamp (UTC+0) + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/TransactionResponseType.php b/lib/BalanceAndTransaction/TransactionResponseType.php new file mode 100644 index 0000000..a265bc8 --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionResponseType.php @@ -0,0 +1,375 @@ + + */ +class TransactionResponseType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransactionResponse_type'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/TransactionStatuses.php b/lib/BalanceAndTransaction/TransactionStatuses.php new file mode 100644 index 0000000..5dc6b93 --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionStatuses.php @@ -0,0 +1,87 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum TransactionStatuses: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::SUCCESS, + self::PENDING, + self::FAILED, + self::REVERSED, + self::VOIDED + ]; + } +} + + diff --git a/lib/BalanceAndTransaction/TransactionTypes.php b/lib/BalanceAndTransaction/TransactionTypes.php new file mode 100644 index 0000000..eea83b8 --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionTypes.php @@ -0,0 +1,111 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum TransactionTypes: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BATCH_DISBURSEMENT, + self::DISBURSEMENT, + self::PAYMENT, + self::REMITTANCE, + self::REMITTANCE_PAYOUT, + self::REMITTANCE_COLLECTION, + self::TRANSFER, + self::PLATFORM_FEE, + self::REFUND, + self::CASHBACK, + self::TOPUP, + self::WITHDRAWAL, + self::OTHER + ]; + } +} + + diff --git a/lib/BalanceAndTransaction/TransactionsResponse.php b/lib/BalanceAndTransaction/TransactionsResponse.php new file mode 100644 index 0000000..5e0238c --- /dev/null +++ b/lib/BalanceAndTransaction/TransactionsResponse.php @@ -0,0 +1,477 @@ + + */ +class TransactionsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransactionsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'has_more' => 'bool', + 'links' => '\Xendit\BalanceAndTransaction\LinkItem[]', + 'data' => '\Xendit\BalanceAndTransaction\TransactionResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'has_more' => null, + 'links' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'has_more' => false, + 'links' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'has_more' => 'has_more', + 'links' => 'links', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'has_more' => 'setHasMore', + 'links' => 'setLinks', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'has_more' => 'getHasMore', + 'links' => 'getLinks', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('has_more', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['has_more'] === null) { + $invalidProperties[] = "'has_more' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets has_more + * + * @return bool + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool $has_more Indicates whether there are more items to be queried with `after_id` of the last item from the current result. Use the `links` to follow to the next result. + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + + /** + * Gets links + * + * @return \BalanceAndTransaction\LinkItem[]|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \BalanceAndTransaction\LinkItem[]|null $links The links to the next page based on LinkItem if there is next result. + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \BalanceAndTransaction\TransactionResponse[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \BalanceAndTransaction\TransactionResponse[] $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/BalanceAndTransaction/ValidationError.php b/lib/BalanceAndTransaction/ValidationError.php new file mode 100644 index 0000000..5ddadc7 --- /dev/null +++ b/lib/BalanceAndTransaction/ValidationError.php @@ -0,0 +1,520 @@ + + */ +class ValidationError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status_code' => 'float', + 'error' => 'string', + 'message' => 'string', + 'validation' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status_code' => null, + 'error' => null, + 'message' => null, + 'validation' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status_code' => false, + 'error' => false, + 'message' => false, + 'validation' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status_code' => 'status_code', + 'error' => 'error', + 'message' => 'message', + 'validation' => 'validation' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status_code' => 'setStatusCode', + 'error' => 'setError', + 'message' => 'setMessage', + 'validation' => 'setValidation' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status_code' => 'getStatusCode', + 'error' => 'getError', + 'message' => 'getMessage', + 'validation' => 'getValidation' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status_code', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('validation', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['status_code'] === null) { + $invalidProperties[] = "'status_code' can't be null"; + } + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status_code + * + * @return float + */ + public function getStatusCode() + { + return $this->container['status_code']; + } + + /** + * Sets status_code + * + * @param float $status_code status_code + * + * @return self + */ + public function setStatusCode($status_code) + { + if (is_null($status_code)) { + throw new \InvalidArgumentException('non-nullable status_code cannot be null'); + } + $this->container['status_code'] = $status_code; + + return $this; + } + + /** + * Gets error + * + * @return string + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets validation + * + * @return object|null + */ + public function getValidation() + { + return $this->container['validation']; + } + + /** + * Sets validation + * + * @param object|null $validation validation + * + * @return self + */ + public function setValidation($validation) + { + if (is_null($validation)) { + array_push($this->openAPINullablesSetToNull, 'validation'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validation', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validation'] = $validation; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..b262332 --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,379 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($key) + { + $this->apiKey = $key; + return $this; + } + + + public static function setXenditKey($key) + { + Configuration::getDefaultConfiguration()->setApiKey($key); + } + + /** + * Gets API key + * + * @return null|string API key + */ + public function getApiKey() + { + return $this->apiKey; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormatForQueryString Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Xendit) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0-beta.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.xendit.co", + "description" => "Xendit API Server", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); + } + + $host = $hostsSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..56e2a11 --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,239 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/lib/Invoice/AddressObject.php b/lib/Invoice/AddressObject.php new file mode 100644 index 0000000..8b17f4a --- /dev/null +++ b/lib/Invoice/AddressObject.php @@ -0,0 +1,656 @@ + + */ +class AddressObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AddressObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'country' => 'string', + 'street_line1' => 'string', + 'street_line2' => 'string', + 'city' => 'string', + 'province' => 'string', + 'state' => 'string', + 'postal_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'country' => null, + 'street_line1' => null, + 'street_line2' => null, + 'city' => null, + 'province' => null, + 'state' => null, + 'postal_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'country' => true, + 'street_line1' => true, + 'street_line2' => true, + 'city' => true, + 'province' => true, + 'state' => true, + 'postal_code' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'street_line1' => 'street_line1', + 'street_line2' => 'street_line2', + 'city' => 'city', + 'province' => 'province', + 'state' => 'state', + 'postal_code' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'street_line1' => 'setStreetLine1', + 'street_line2' => 'setStreetLine2', + 'city' => 'setCity', + 'province' => 'setProvince', + 'state' => 'setState', + 'postal_code' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'street_line1' => 'getStreetLine1', + 'street_line2' => 'getStreetLine2', + 'city' => 'getCity', + 'province' => 'getProvince', + 'state' => 'getState', + 'postal_code' => 'getPostalCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('street_line1', $data ?? [], null); + $this->setIfExists('street_line2', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('province', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country The country where the address is located. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets street_line1 + * + * @return string|null + */ + public function getStreetLine1() + { + return $this->container['street_line1']; + } + + /** + * Sets street_line1 + * + * @param string|null $street_line1 The first line of the street address. + * + * @return self + */ + public function setStreetLine1($street_line1) + { + if (is_null($street_line1)) { + array_push($this->openAPINullablesSetToNull, 'street_line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street_line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['street_line1'] = $street_line1; + + return $this; + } + + /** + * Gets street_line2 + * + * @return string|null + */ + public function getStreetLine2() + { + return $this->container['street_line2']; + } + + /** + * Sets street_line2 + * + * @param string|null $street_line2 The second line of the street address. + * + * @return self + */ + public function setStreetLine2($street_line2) + { + if (is_null($street_line2)) { + array_push($this->openAPINullablesSetToNull, 'street_line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street_line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['street_line2'] = $street_line2; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city The city or locality within the address. + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets province + * + * @return string|null + */ + public function getProvince() + { + return $this->container['province']; + } + + /** + * Sets province + * + * @param string|null $province The province or region within the country. + * + * @return self + */ + public function setProvince($province) + { + if (is_null($province)) { + array_push($this->openAPINullablesSetToNull, 'province'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('province', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['province'] = $province; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state The state or administrative division within the country. + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets postal_code + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string|null $postal_code The postal code or ZIP code for the address. + * + * @return self + */ + public function setPostalCode($postal_code) + { + if (is_null($postal_code)) { + array_push($this->openAPINullablesSetToNull, 'postal_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postal_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postal_code'] = $postal_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/BadRequestError.php b/lib/Invoice/BadRequestError.php new file mode 100644 index 0000000..6bd769a --- /dev/null +++ b/lib/Invoice/BadRequestError.php @@ -0,0 +1,487 @@ + + */ +class BadRequestError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BadRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_MAXIMUM_TRANSFER_AMOUNT_ERROR = 'MAXIMUM_TRANSFER_AMOUNT_ERROR'; + public const ERROR_CODE_NO_COLLECTION_METHODS_ERROR = 'NO_COLLECTION_METHODS_ERROR'; + public const ERROR_CODE_EMAIL_FORMAT_ERROR = 'EMAIL_FORMAT_ERROR'; + public const ERROR_CODE_UNAVAILABLE_PAYMENT_METHOD_ERROR = 'UNAVAILABLE_PAYMENT_METHOD_ERROR'; + public const ERROR_CODE_UNSUPPORTED_CURRENCY = 'UNSUPPORTED_CURRENCY'; + public const ERROR_CODE_MISMATCH_CURRENCY_ERROR = 'MISMATCH_CURRENCY_ERROR'; + public const ERROR_CODE_INVALID_REMINDER_TIME = 'INVALID_REMINDER_TIME'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_MAXIMUM_TRANSFER_AMOUNT_ERROR, + self::ERROR_CODE_NO_COLLECTION_METHODS_ERROR, + self::ERROR_CODE_EMAIL_FORMAT_ERROR, + self::ERROR_CODE_UNAVAILABLE_PAYMENT_METHOD_ERROR, + self::ERROR_CODE_UNSUPPORTED_CURRENCY, + self::ERROR_CODE_MISMATCH_CURRENCY_ERROR, + self::ERROR_CODE_INVALID_REMINDER_TIME, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code The error code indicating the type of error that occurred. + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human-readable error message that provides additional information about the error. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/Bank.php b/lib/Invoice/Bank.php new file mode 100644 index 0000000..f7895e0 --- /dev/null +++ b/lib/Invoice/Bank.php @@ -0,0 +1,582 @@ + + */ +class Bank implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Bank'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bank_code' => '\Xendit\Invoice\BankCode', + 'collection_type' => 'string', + 'bank_branch' => 'string', + 'bank_account_number' => 'string', + 'account_holder_name' => 'string', + 'transfer_amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bank_code' => null, + 'collection_type' => null, + 'bank_branch' => null, + 'bank_account_number' => null, + 'account_holder_name' => null, + 'transfer_amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bank_code' => false, + 'collection_type' => false, + 'bank_branch' => false, + 'bank_account_number' => false, + 'account_holder_name' => false, + 'transfer_amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bank_code' => 'bank_code', + 'collection_type' => 'collection_type', + 'bank_branch' => 'bank_branch', + 'bank_account_number' => 'bank_account_number', + 'account_holder_name' => 'account_holder_name', + 'transfer_amount' => 'transfer_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bank_code' => 'setBankCode', + 'collection_type' => 'setCollectionType', + 'bank_branch' => 'setBankBranch', + 'bank_account_number' => 'setBankAccountNumber', + 'account_holder_name' => 'setAccountHolderName', + 'transfer_amount' => 'setTransferAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bank_code' => 'getBankCode', + 'collection_type' => 'getCollectionType', + 'bank_branch' => 'getBankBranch', + 'bank_account_number' => 'getBankAccountNumber', + 'account_holder_name' => 'getAccountHolderName', + 'transfer_amount' => 'getTransferAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('bank_code', $data ?? [], null); + $this->setIfExists('collection_type', $data ?? [], null); + $this->setIfExists('bank_branch', $data ?? [], null); + $this->setIfExists('bank_account_number', $data ?? [], null); + $this->setIfExists('account_holder_name', $data ?? [], null); + $this->setIfExists('transfer_amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['bank_code'] === null) { + $invalidProperties[] = "'bank_code' can't be null"; + } + if ($this->container['collection_type'] === null) { + $invalidProperties[] = "'collection_type' can't be null"; + } + if ($this->container['account_holder_name'] === null) { + $invalidProperties[] = "'account_holder_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bank_code + * + * @return \Invoice\BankCode + */ + public function getBankCode() + { + return $this->container['bank_code']; + } + + /** + * Sets bank_code + * + * @param \Invoice\BankCode $bank_code bank_code + * + * @return self + */ + public function setBankCode($bank_code) + { + if (is_null($bank_code)) { + throw new \InvalidArgumentException('non-nullable bank_code cannot be null'); + } + $this->container['bank_code'] = $bank_code; + + return $this; + } + + /** + * Gets collection_type + * + * @return string + */ + public function getCollectionType() + { + return $this->container['collection_type']; + } + + /** + * Sets collection_type + * + * @param string $collection_type The collection type for the bank details. + * + * @return self + */ + public function setCollectionType($collection_type) + { + if (is_null($collection_type)) { + throw new \InvalidArgumentException('non-nullable collection_type cannot be null'); + } + $this->container['collection_type'] = $collection_type; + + return $this; + } + + /** + * Gets bank_branch + * + * @return string|null + */ + public function getBankBranch() + { + return $this->container['bank_branch']; + } + + /** + * Sets bank_branch + * + * @param string|null $bank_branch The branch of the bank. + * + * @return self + */ + public function setBankBranch($bank_branch) + { + if (is_null($bank_branch)) { + throw new \InvalidArgumentException('non-nullable bank_branch cannot be null'); + } + $this->container['bank_branch'] = $bank_branch; + + return $this; + } + + /** + * Gets bank_account_number + * + * @return string|null + */ + public function getBankAccountNumber() + { + return $this->container['bank_account_number']; + } + + /** + * Sets bank_account_number + * + * @param string|null $bank_account_number The bank account number. + * + * @return self + */ + public function setBankAccountNumber($bank_account_number) + { + if (is_null($bank_account_number)) { + throw new \InvalidArgumentException('non-nullable bank_account_number cannot be null'); + } + $this->container['bank_account_number'] = $bank_account_number; + + return $this; + } + + /** + * Gets account_holder_name + * + * @return string + */ + public function getAccountHolderName() + { + return $this->container['account_holder_name']; + } + + /** + * Sets account_holder_name + * + * @param string $account_holder_name The name of the account holder. + * + * @return self + */ + public function setAccountHolderName($account_holder_name) + { + if (is_null($account_holder_name)) { + throw new \InvalidArgumentException('non-nullable account_holder_name cannot be null'); + } + $this->container['account_holder_name'] = $account_holder_name; + + return $this; + } + + /** + * Gets transfer_amount + * + * @return float|null + */ + public function getTransferAmount() + { + return $this->container['transfer_amount']; + } + + /** + * Sets transfer_amount + * + * @param float|null $transfer_amount The transfer amount. + * + * @return self + */ + public function setTransferAmount($transfer_amount) + { + if (is_null($transfer_amount)) { + throw new \InvalidArgumentException('non-nullable transfer_amount cannot be null'); + } + $this->container['transfer_amount'] = $transfer_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/BankCode.php b/lib/Invoice/BankCode.php new file mode 100644 index 0000000..609a921 --- /dev/null +++ b/lib/Invoice/BankCode.php @@ -0,0 +1,94 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum BankCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BCA, + self::BNI, + self::BRI, + self::MANDIRI, + self::PERMATA, + self::BSI, + self::BJB + ]; + } +} + + diff --git a/lib/Invoice/CreateInvoiceRequest.php b/lib/Invoice/CreateInvoiceRequest.php new file mode 100644 index 0000000..58c79bd --- /dev/null +++ b/lib/Invoice/CreateInvoiceRequest.php @@ -0,0 +1,1089 @@ + + */ +class CreateInvoiceRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateInvoiceRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_id' => 'string', + 'amount' => 'float', + 'payer_email' => 'string', + 'description' => 'string', + 'client_type' => 'string', + 'invoice_duration' => 'string', + 'callback_virtual_account_id' => 'string', + 'should_send_email' => 'bool', + 'customer' => '\Xendit\Invoice\CustomerObject', + 'customer_notification_preference' => '\Xendit\Invoice\NotificationPreference', + 'success_redirect_url' => 'string', + 'failure_redirect_url' => 'string', + 'payment_methods' => 'string[]', + 'mid_label' => 'string', + 'should_authenticate_credit_card' => 'bool', + 'currency' => 'string', + 'reminder_time' => 'float', + 'local' => 'string', + 'reminder_time_unit' => 'string', + 'items' => '\Xendit\Invoice\InvoiceItem[]', + 'fees' => '\Xendit\Invoice\InvoiceFee[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_id' => null, + 'amount' => null, + 'payer_email' => null, + 'description' => null, + 'client_type' => null, + 'invoice_duration' => null, + 'callback_virtual_account_id' => null, + 'should_send_email' => null, + 'customer' => null, + 'customer_notification_preference' => null, + 'success_redirect_url' => null, + 'failure_redirect_url' => null, + 'payment_methods' => null, + 'mid_label' => null, + 'should_authenticate_credit_card' => null, + 'currency' => null, + 'reminder_time' => null, + 'local' => null, + 'reminder_time_unit' => null, + 'items' => null, + 'fees' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_id' => false, + 'amount' => false, + 'payer_email' => false, + 'description' => false, + 'client_type' => false, + 'invoice_duration' => false, + 'callback_virtual_account_id' => false, + 'should_send_email' => false, + 'customer' => false, + 'customer_notification_preference' => false, + 'success_redirect_url' => false, + 'failure_redirect_url' => false, + 'payment_methods' => false, + 'mid_label' => false, + 'should_authenticate_credit_card' => false, + 'currency' => false, + 'reminder_time' => false, + 'local' => false, + 'reminder_time_unit' => false, + 'items' => false, + 'fees' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_id' => 'external_id', + 'amount' => 'amount', + 'payer_email' => 'payer_email', + 'description' => 'description', + 'client_type' => 'client_type', + 'invoice_duration' => 'invoice_duration', + 'callback_virtual_account_id' => 'callback_virtual_account_id', + 'should_send_email' => 'should_send_email', + 'customer' => 'customer', + 'customer_notification_preference' => 'customer_notification_preference', + 'success_redirect_url' => 'success_redirect_url', + 'failure_redirect_url' => 'failure_redirect_url', + 'payment_methods' => 'payment_methods', + 'mid_label' => 'mid_label', + 'should_authenticate_credit_card' => 'should_authenticate_credit_card', + 'currency' => 'currency', + 'reminder_time' => 'reminder_time', + 'local' => 'local', + 'reminder_time_unit' => 'reminder_time_unit', + 'items' => 'items', + 'fees' => 'fees' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_id' => 'setExternalId', + 'amount' => 'setAmount', + 'payer_email' => 'setPayerEmail', + 'description' => 'setDescription', + 'client_type' => 'setClientType', + 'invoice_duration' => 'setInvoiceDuration', + 'callback_virtual_account_id' => 'setCallbackVirtualAccountId', + 'should_send_email' => 'setShouldSendEmail', + 'customer' => 'setCustomer', + 'customer_notification_preference' => 'setCustomerNotificationPreference', + 'success_redirect_url' => 'setSuccessRedirectUrl', + 'failure_redirect_url' => 'setFailureRedirectUrl', + 'payment_methods' => 'setPaymentMethods', + 'mid_label' => 'setMidLabel', + 'should_authenticate_credit_card' => 'setShouldAuthenticateCreditCard', + 'currency' => 'setCurrency', + 'reminder_time' => 'setReminderTime', + 'local' => 'setLocal', + 'reminder_time_unit' => 'setReminderTimeUnit', + 'items' => 'setItems', + 'fees' => 'setFees' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_id' => 'getExternalId', + 'amount' => 'getAmount', + 'payer_email' => 'getPayerEmail', + 'description' => 'getDescription', + 'client_type' => 'getClientType', + 'invoice_duration' => 'getInvoiceDuration', + 'callback_virtual_account_id' => 'getCallbackVirtualAccountId', + 'should_send_email' => 'getShouldSendEmail', + 'customer' => 'getCustomer', + 'customer_notification_preference' => 'getCustomerNotificationPreference', + 'success_redirect_url' => 'getSuccessRedirectUrl', + 'failure_redirect_url' => 'getFailureRedirectUrl', + 'payment_methods' => 'getPaymentMethods', + 'mid_label' => 'getMidLabel', + 'should_authenticate_credit_card' => 'getShouldAuthenticateCreditCard', + 'currency' => 'getCurrency', + 'reminder_time' => 'getReminderTime', + 'local' => 'getLocal', + 'reminder_time_unit' => 'getReminderTimeUnit', + 'items' => 'getItems', + 'fees' => 'getFees' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('payer_email', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('client_type', $data ?? [], null); + $this->setIfExists('invoice_duration', $data ?? [], null); + $this->setIfExists('callback_virtual_account_id', $data ?? [], null); + $this->setIfExists('should_send_email', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customer_notification_preference', $data ?? [], null); + $this->setIfExists('success_redirect_url', $data ?? [], null); + $this->setIfExists('failure_redirect_url', $data ?? [], null); + $this->setIfExists('payment_methods', $data ?? [], null); + $this->setIfExists('mid_label', $data ?? [], null); + $this->setIfExists('should_authenticate_credit_card', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('reminder_time', $data ?? [], null); + $this->setIfExists('local', $data ?? [], null); + $this->setIfExists('reminder_time_unit', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('fees', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_id'] === null) { + $invalidProperties[] = "'external_id' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_id + * + * @return string + */ + public function getExternalId() + { + return $this->container['external_id']; + } + + /** + * Sets external_id + * + * @param string $external_id The external ID of the invoice. + * + * @return self + */ + public function setExternalId($external_id) + { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } + $this->container['external_id'] = $external_id; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount The invoice amount. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets payer_email + * + * @return string|null + */ + public function getPayerEmail() + { + return $this->container['payer_email']; + } + + /** + * Sets payer_email + * + * @param string|null $payer_email The email address of the payer. + * + * @return self + */ + public function setPayerEmail($payer_email) + { + if (is_null($payer_email)) { + throw new \InvalidArgumentException('non-nullable payer_email cannot be null'); + } + $this->container['payer_email'] = $payer_email; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A description of the payment. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets client_type + * + * @return string|null + */ + public function getClientType() + { + return $this->container['client_type']; + } + + /** + * Sets client_type + * + * @param string|null $client_type The client type (internal use). + * + * @return self + */ + public function setClientType($client_type) + { + if (is_null($client_type)) { + throw new \InvalidArgumentException('non-nullable client_type cannot be null'); + } + $this->container['client_type'] = $client_type; + + return $this; + } + + /** + * Gets invoice_duration + * + * @return string|null + */ + public function getInvoiceDuration() + { + return $this->container['invoice_duration']; + } + + /** + * Sets invoice_duration + * + * @param string|null $invoice_duration The duration of the invoice. + * + * @return self + */ + public function setInvoiceDuration($invoice_duration) + { + if (is_null($invoice_duration)) { + throw new \InvalidArgumentException('non-nullable invoice_duration cannot be null'); + } + $this->container['invoice_duration'] = $invoice_duration; + + return $this; + } + + /** + * Gets callback_virtual_account_id + * + * @return string|null + */ + public function getCallbackVirtualAccountId() + { + return $this->container['callback_virtual_account_id']; + } + + /** + * Sets callback_virtual_account_id + * + * @param string|null $callback_virtual_account_id The ID of the callback virtual account. + * + * @return self + */ + public function setCallbackVirtualAccountId($callback_virtual_account_id) + { + if (is_null($callback_virtual_account_id)) { + throw new \InvalidArgumentException('non-nullable callback_virtual_account_id cannot be null'); + } + $this->container['callback_virtual_account_id'] = $callback_virtual_account_id; + + return $this; + } + + /** + * Gets should_send_email + * + * @return bool|null + */ + public function getShouldSendEmail() + { + return $this->container['should_send_email']; + } + + /** + * Sets should_send_email + * + * @param bool|null $should_send_email Indicates whether email notifications should be sent. + * + * @return self + */ + public function setShouldSendEmail($should_send_email) + { + if (is_null($should_send_email)) { + throw new \InvalidArgumentException('non-nullable should_send_email cannot be null'); + } + $this->container['should_send_email'] = $should_send_email; + + return $this; + } + + /** + * Gets customer + * + * @return \Invoice\CustomerObject|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \Invoice\CustomerObject|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customer_notification_preference + * + * @return \Invoice\NotificationPreference|null + */ + public function getCustomerNotificationPreference() + { + return $this->container['customer_notification_preference']; + } + + /** + * Sets customer_notification_preference + * + * @param \Invoice\NotificationPreference|null $customer_notification_preference customer_notification_preference + * + * @return self + */ + public function setCustomerNotificationPreference($customer_notification_preference) + { + if (is_null($customer_notification_preference)) { + throw new \InvalidArgumentException('non-nullable customer_notification_preference cannot be null'); + } + $this->container['customer_notification_preference'] = $customer_notification_preference; + + return $this; + } + + /** + * Gets success_redirect_url + * + * @return string|null + */ + public function getSuccessRedirectUrl() + { + return $this->container['success_redirect_url']; + } + + /** + * Sets success_redirect_url + * + * @param string|null $success_redirect_url The URL to redirect to on successful payment. + * + * @return self + */ + public function setSuccessRedirectUrl($success_redirect_url) + { + if (is_null($success_redirect_url)) { + throw new \InvalidArgumentException('non-nullable success_redirect_url cannot be null'); + } + $this->container['success_redirect_url'] = $success_redirect_url; + + return $this; + } + + /** + * Gets failure_redirect_url + * + * @return string|null + */ + public function getFailureRedirectUrl() + { + return $this->container['failure_redirect_url']; + } + + /** + * Sets failure_redirect_url + * + * @param string|null $failure_redirect_url The URL to redirect to on payment failure. + * + * @return self + */ + public function setFailureRedirectUrl($failure_redirect_url) + { + if (is_null($failure_redirect_url)) { + throw new \InvalidArgumentException('non-nullable failure_redirect_url cannot be null'); + } + $this->container['failure_redirect_url'] = $failure_redirect_url; + + return $this; + } + + /** + * Gets payment_methods + * + * @return string[]|null + */ + public function getPaymentMethods() + { + return $this->container['payment_methods']; + } + + /** + * Sets payment_methods + * + * @param string[]|null $payment_methods An array of available payment methods. + * + * @return self + */ + public function setPaymentMethods($payment_methods) + { + if (is_null($payment_methods)) { + throw new \InvalidArgumentException('non-nullable payment_methods cannot be null'); + } + $this->container['payment_methods'] = $payment_methods; + + return $this; + } + + /** + * Gets mid_label + * + * @return string|null + */ + public function getMidLabel() + { + return $this->container['mid_label']; + } + + /** + * Sets mid_label + * + * @param string|null $mid_label The middle label. + * + * @return self + */ + public function setMidLabel($mid_label) + { + if (is_null($mid_label)) { + throw new \InvalidArgumentException('non-nullable mid_label cannot be null'); + } + $this->container['mid_label'] = $mid_label; + + return $this; + } + + /** + * Gets should_authenticate_credit_card + * + * @return bool|null + */ + public function getShouldAuthenticateCreditCard() + { + return $this->container['should_authenticate_credit_card']; + } + + /** + * Sets should_authenticate_credit_card + * + * @param bool|null $should_authenticate_credit_card Indicates whether credit card authentication is required. + * + * @return self + */ + public function setShouldAuthenticateCreditCard($should_authenticate_credit_card) + { + if (is_null($should_authenticate_credit_card)) { + throw new \InvalidArgumentException('non-nullable should_authenticate_credit_card cannot be null'); + } + $this->container['should_authenticate_credit_card'] = $should_authenticate_credit_card; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency The currency of the invoice. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets reminder_time + * + * @return float|null + */ + public function getReminderTime() + { + return $this->container['reminder_time']; + } + + /** + * Sets reminder_time + * + * @param float|null $reminder_time The reminder time. + * + * @return self + */ + public function setReminderTime($reminder_time) + { + if (is_null($reminder_time)) { + throw new \InvalidArgumentException('non-nullable reminder_time cannot be null'); + } + $this->container['reminder_time'] = $reminder_time; + + return $this; + } + + /** + * Gets local + * + * @return string|null + */ + public function getLocal() + { + return $this->container['local']; + } + + /** + * Sets local + * + * @param string|null $local The local. + * + * @return self + */ + public function setLocal($local) + { + if (is_null($local)) { + throw new \InvalidArgumentException('non-nullable local cannot be null'); + } + $this->container['local'] = $local; + + return $this; + } + + /** + * Gets reminder_time_unit + * + * @return string|null + */ + public function getReminderTimeUnit() + { + return $this->container['reminder_time_unit']; + } + + /** + * Sets reminder_time_unit + * + * @param string|null $reminder_time_unit The unit of the reminder time. + * + * @return self + */ + public function setReminderTimeUnit($reminder_time_unit) + { + if (is_null($reminder_time_unit)) { + throw new \InvalidArgumentException('non-nullable reminder_time_unit cannot be null'); + } + $this->container['reminder_time_unit'] = $reminder_time_unit; + + return $this; + } + + /** + * Gets items + * + * @return \Invoice\InvoiceItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Invoice\InvoiceItem[]|null $items An array of items included in the invoice. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets fees + * + * @return \Invoice\InvoiceFee[]|null + */ + public function getFees() + { + return $this->container['fees']; + } + + /** + * Sets fees + * + * @param \Invoice\InvoiceFee[]|null $fees An array of fees associated with the invoice. + * + * @return self + */ + public function setFees($fees) + { + if (is_null($fees)) { + throw new \InvalidArgumentException('non-nullable fees cannot be null'); + } + $this->container['fees'] = $fees; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/CustomerObject.php b/lib/Invoice/CustomerObject.php new file mode 100644 index 0000000..3abb50f --- /dev/null +++ b/lib/Invoice/CustomerObject.php @@ -0,0 +1,697 @@ + + */ +class CustomerObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'phone_number' => 'string', + 'given_names' => 'string', + 'surname' => 'string', + 'email' => 'string', + 'mobile_number' => 'string', + 'customer_id' => 'string', + 'addresses' => '\Xendit\Invoice\AddressObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'phone_number' => null, + 'given_names' => null, + 'surname' => null, + 'email' => null, + 'mobile_number' => null, + 'customer_id' => null, + 'addresses' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'phone_number' => true, + 'given_names' => true, + 'surname' => true, + 'email' => true, + 'mobile_number' => true, + 'customer_id' => true, + 'addresses' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'phone_number' => 'phone_number', + 'given_names' => 'given_names', + 'surname' => 'surname', + 'email' => 'email', + 'mobile_number' => 'mobile_number', + 'customer_id' => 'customer_id', + 'addresses' => 'addresses' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'phone_number' => 'setPhoneNumber', + 'given_names' => 'setGivenNames', + 'surname' => 'setSurname', + 'email' => 'setEmail', + 'mobile_number' => 'setMobileNumber', + 'customer_id' => 'setCustomerId', + 'addresses' => 'setAddresses' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'phone_number' => 'getPhoneNumber', + 'given_names' => 'getGivenNames', + 'surname' => 'getSurname', + 'email' => 'getEmail', + 'mobile_number' => 'getMobileNumber', + 'customer_id' => 'getCustomerId', + 'addresses' => 'getAddresses' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('given_names', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('addresses', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier for the customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber() + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number The customer's phone number. + * + * @return self + */ + public function setPhoneNumber($phone_number) + { + if (is_null($phone_number)) { + array_push($this->openAPINullablesSetToNull, 'phone_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets given_names + * + * @return string|null + */ + public function getGivenNames() + { + return $this->container['given_names']; + } + + /** + * Sets given_names + * + * @param string|null $given_names The customer's given names or first names. + * + * @return self + */ + public function setGivenNames($given_names) + { + if (is_null($given_names)) { + array_push($this->openAPINullablesSetToNull, 'given_names'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('given_names', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['given_names'] = $given_names; + + return $this; + } + + /** + * Gets surname + * + * @return string|null + */ + public function getSurname() + { + return $this->container['surname']; + } + + /** + * Sets surname + * + * @param string|null $surname The customer's surname or last name. + * + * @return self + */ + public function setSurname($surname) + { + if (is_null($surname)) { + array_push($this->openAPINullablesSetToNull, 'surname'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('surname', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['surname'] = $surname; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number The customer's mobile phone number. + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + array_push($this->openAPINullablesSetToNull, 'mobile_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets customer_id + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string|null $customer_id An additional identifier for the customer. + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets addresses + * + * @return \Invoice\AddressObject[]|null + */ + public function getAddresses() + { + return $this->container['addresses']; + } + + /** + * Sets addresses + * + * @param \Invoice\AddressObject[]|null $addresses An array of addresses associated with the customer. + * + * @return self + */ + public function setAddresses($addresses) + { + if (is_null($addresses)) { + array_push($this->openAPINullablesSetToNull, 'addresses'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('addresses', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['addresses'] = $addresses; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/DirectDebit.php b/lib/Invoice/DirectDebit.php new file mode 100644 index 0000000..f10c227 --- /dev/null +++ b/lib/Invoice/DirectDebit.php @@ -0,0 +1,406 @@ + + */ +class DirectDebit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'direct_debit_type' => '\Xendit\Invoice\DirectDebitType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'direct_debit_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'direct_debit_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'direct_debit_type' => 'direct_debit_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'direct_debit_type' => 'setDirectDebitType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'direct_debit_type' => 'getDirectDebitType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('direct_debit_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['direct_debit_type'] === null) { + $invalidProperties[] = "'direct_debit_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets direct_debit_type + * + * @return \Invoice\DirectDebitType + */ + public function getDirectDebitType() + { + return $this->container['direct_debit_type']; + } + + /** + * Sets direct_debit_type + * + * @param \Invoice\DirectDebitType $direct_debit_type direct_debit_type + * + * @return self + */ + public function setDirectDebitType($direct_debit_type) + { + if (is_null($direct_debit_type)) { + throw new \InvalidArgumentException('non-nullable direct_debit_type cannot be null'); + } + $this->container['direct_debit_type'] = $direct_debit_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/DirectDebitType.php b/lib/Invoice/DirectDebitType.php new file mode 100644 index 0000000..fd00214 --- /dev/null +++ b/lib/Invoice/DirectDebitType.php @@ -0,0 +1,115 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum DirectDebitType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BA_BRI, + self::DC_BRI, + self::DD_BRI, + self::DD_MANDIRI, + self::BA_BPI, + self::DC_BPI, + self::DD_BPI, + self::BA_UBP, + self::DC_UBP, + self::DD_UBP, + self::BCA_KLIKPAY, + self::BA_BCA_KLIKPAY, + self::DC_BCA_KLIKPAY, + self::DD_BCA_KLIKPAY + ]; + } +} + + diff --git a/lib/Invoice/Ewallet.php b/lib/Invoice/Ewallet.php new file mode 100644 index 0000000..b6ab0b3 --- /dev/null +++ b/lib/Invoice/Ewallet.php @@ -0,0 +1,406 @@ + + */ +class Ewallet implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Ewallet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ewallet_type' => '\Xendit\Invoice\EwalletType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ewallet_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ewallet_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ewallet_type' => 'ewallet_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ewallet_type' => 'setEwalletType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ewallet_type' => 'getEwalletType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ewallet_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ewallet_type'] === null) { + $invalidProperties[] = "'ewallet_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ewallet_type + * + * @return \Invoice\EwalletType + */ + public function getEwalletType() + { + return $this->container['ewallet_type']; + } + + /** + * Sets ewallet_type + * + * @param \Invoice\EwalletType $ewallet_type ewallet_type + * + * @return self + */ + public function setEwalletType($ewallet_type) + { + if (is_null($ewallet_type)) { + throw new \InvalidArgumentException('non-nullable ewallet_type cannot be null'); + } + $this->container['ewallet_type'] = $ewallet_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/EwalletType.php b/lib/Invoice/EwalletType.php new file mode 100644 index 0000000..41f1143 --- /dev/null +++ b/lib/Invoice/EwalletType.php @@ -0,0 +1,94 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum EwalletType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::OVO, + self::DANA, + self::LINKAJA, + self::PAYMAYA, + self::SHOPEEPAY, + self::GCASH, + self::GRABPAY + ]; + } +} + + diff --git a/lib/Invoice/ForbiddenError.php b/lib/Invoice/ForbiddenError.php new file mode 100644 index 0000000..688a7d3 --- /dev/null +++ b/lib/Invoice/ForbiddenError.php @@ -0,0 +1,475 @@ + + */ +class ForbiddenError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForbiddenError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_ACCESS_SUSPENDED = 'ACCESS_SUSPENDED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_ACCESS_SUSPENDED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code The specific error code indicating that access to the invoice operation is suspended. + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human-readable error message providing additional context about the 403 Forbidden response. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/Invoice.php b/lib/Invoice/Invoice.php new file mode 100644 index 0000000..21c266c --- /dev/null +++ b/lib/Invoice/Invoice.php @@ -0,0 +1,1616 @@ + + */ +class Invoice implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Invoice'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'external_id' => 'string', + 'user_id' => 'string', + 'is_high' => 'bool', + 'payer_email' => 'string', + 'description' => 'string', + 'payment_method' => '\Xendit\Invoice\InvoicePaymentMethod', + 'status' => '\Xendit\Invoice\InvoiceStatus', + 'merchant_name' => 'string', + 'merchant_profile_picture_url' => 'string', + 'locale' => 'string', + 'amount' => 'float', + 'expiry_date' => '\DateTime', + 'invoice_url' => 'string', + 'available_banks' => '\Xendit\Invoice\Bank[]', + 'available_retail_outlets' => '\Xendit\Invoice\RetailOutlet[]', + 'available_ewallets' => '\Xendit\Invoice\Ewallet[]', + 'available_qr_codes' => '\Xendit\Invoice\QrCode[]', + 'available_direct_debits' => '\Xendit\Invoice\DirectDebit[]', + 'available_paylaters' => '\Xendit\Invoice\Paylater[]', + 'should_exclude_credit_card' => 'bool', + 'should_send_email' => 'bool', + 'client_type' => '\Xendit\Invoice\InvoiceClientType', + 'created' => '\DateTime', + 'updated' => '\DateTime', + 'success_redirect_url' => 'string', + 'failure_redirect_url' => 'string', + 'should_authenticate_credit_card' => 'bool', + 'currency' => '\Xendit\Invoice\InvoiceCurrency', + 'items' => '\Xendit\Invoice\InvoiceItem[]', + 'fixed_va' => 'bool', + 'reminder_date' => '\DateTime', + 'customer' => '\Xendit\Invoice\CustomerObject', + 'customer_notification_preference' => '\Xendit\Invoice\NotificationPreference', + 'fees' => '\Xendit\Invoice\InvoiceFee[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'external_id' => null, + 'user_id' => null, + 'is_high' => null, + 'payer_email' => null, + 'description' => null, + 'payment_method' => null, + 'status' => null, + 'merchant_name' => null, + 'merchant_profile_picture_url' => null, + 'locale' => null, + 'amount' => null, + 'expiry_date' => 'date-time', + 'invoice_url' => null, + 'available_banks' => null, + 'available_retail_outlets' => null, + 'available_ewallets' => null, + 'available_qr_codes' => null, + 'available_direct_debits' => null, + 'available_paylaters' => null, + 'should_exclude_credit_card' => null, + 'should_send_email' => null, + 'client_type' => null, + 'created' => 'date-time', + 'updated' => 'date-time', + 'success_redirect_url' => null, + 'failure_redirect_url' => null, + 'should_authenticate_credit_card' => null, + 'currency' => null, + 'items' => null, + 'fixed_va' => null, + 'reminder_date' => 'date-time', + 'customer' => null, + 'customer_notification_preference' => null, + 'fees' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'external_id' => false, + 'user_id' => false, + 'is_high' => false, + 'payer_email' => false, + 'description' => false, + 'payment_method' => false, + 'status' => false, + 'merchant_name' => false, + 'merchant_profile_picture_url' => false, + 'locale' => false, + 'amount' => false, + 'expiry_date' => false, + 'invoice_url' => false, + 'available_banks' => false, + 'available_retail_outlets' => false, + 'available_ewallets' => false, + 'available_qr_codes' => false, + 'available_direct_debits' => false, + 'available_paylaters' => false, + 'should_exclude_credit_card' => false, + 'should_send_email' => false, + 'client_type' => false, + 'created' => false, + 'updated' => false, + 'success_redirect_url' => false, + 'failure_redirect_url' => false, + 'should_authenticate_credit_card' => false, + 'currency' => false, + 'items' => false, + 'fixed_va' => false, + 'reminder_date' => false, + 'customer' => false, + 'customer_notification_preference' => false, + 'fees' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'external_id' => 'external_id', + 'user_id' => 'user_id', + 'is_high' => 'is_high', + 'payer_email' => 'payer_email', + 'description' => 'description', + 'payment_method' => 'payment_method', + 'status' => 'status', + 'merchant_name' => 'merchant_name', + 'merchant_profile_picture_url' => 'merchant_profile_picture_url', + 'locale' => 'locale', + 'amount' => 'amount', + 'expiry_date' => 'expiry_date', + 'invoice_url' => 'invoice_url', + 'available_banks' => 'available_banks', + 'available_retail_outlets' => 'available_retail_outlets', + 'available_ewallets' => 'available_ewallets', + 'available_qr_codes' => 'available_qr_codes', + 'available_direct_debits' => 'available_direct_debits', + 'available_paylaters' => 'available_paylaters', + 'should_exclude_credit_card' => 'should_exclude_credit_card', + 'should_send_email' => 'should_send_email', + 'client_type' => 'client_type', + 'created' => 'created', + 'updated' => 'updated', + 'success_redirect_url' => 'success_redirect_url', + 'failure_redirect_url' => 'failure_redirect_url', + 'should_authenticate_credit_card' => 'should_authenticate_credit_card', + 'currency' => 'currency', + 'items' => 'items', + 'fixed_va' => 'fixed_va', + 'reminder_date' => 'reminder_date', + 'customer' => 'customer', + 'customer_notification_preference' => 'customer_notification_preference', + 'fees' => 'fees' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'external_id' => 'setExternalId', + 'user_id' => 'setUserId', + 'is_high' => 'setIsHigh', + 'payer_email' => 'setPayerEmail', + 'description' => 'setDescription', + 'payment_method' => 'setPaymentMethod', + 'status' => 'setStatus', + 'merchant_name' => 'setMerchantName', + 'merchant_profile_picture_url' => 'setMerchantProfilePictureUrl', + 'locale' => 'setLocale', + 'amount' => 'setAmount', + 'expiry_date' => 'setExpiryDate', + 'invoice_url' => 'setInvoiceUrl', + 'available_banks' => 'setAvailableBanks', + 'available_retail_outlets' => 'setAvailableRetailOutlets', + 'available_ewallets' => 'setAvailableEwallets', + 'available_qr_codes' => 'setAvailableQrCodes', + 'available_direct_debits' => 'setAvailableDirectDebits', + 'available_paylaters' => 'setAvailablePaylaters', + 'should_exclude_credit_card' => 'setShouldExcludeCreditCard', + 'should_send_email' => 'setShouldSendEmail', + 'client_type' => 'setClientType', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'success_redirect_url' => 'setSuccessRedirectUrl', + 'failure_redirect_url' => 'setFailureRedirectUrl', + 'should_authenticate_credit_card' => 'setShouldAuthenticateCreditCard', + 'currency' => 'setCurrency', + 'items' => 'setItems', + 'fixed_va' => 'setFixedVa', + 'reminder_date' => 'setReminderDate', + 'customer' => 'setCustomer', + 'customer_notification_preference' => 'setCustomerNotificationPreference', + 'fees' => 'setFees' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'external_id' => 'getExternalId', + 'user_id' => 'getUserId', + 'is_high' => 'getIsHigh', + 'payer_email' => 'getPayerEmail', + 'description' => 'getDescription', + 'payment_method' => 'getPaymentMethod', + 'status' => 'getStatus', + 'merchant_name' => 'getMerchantName', + 'merchant_profile_picture_url' => 'getMerchantProfilePictureUrl', + 'locale' => 'getLocale', + 'amount' => 'getAmount', + 'expiry_date' => 'getExpiryDate', + 'invoice_url' => 'getInvoiceUrl', + 'available_banks' => 'getAvailableBanks', + 'available_retail_outlets' => 'getAvailableRetailOutlets', + 'available_ewallets' => 'getAvailableEwallets', + 'available_qr_codes' => 'getAvailableQrCodes', + 'available_direct_debits' => 'getAvailableDirectDebits', + 'available_paylaters' => 'getAvailablePaylaters', + 'should_exclude_credit_card' => 'getShouldExcludeCreditCard', + 'should_send_email' => 'getShouldSendEmail', + 'client_type' => 'getClientType', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'success_redirect_url' => 'getSuccessRedirectUrl', + 'failure_redirect_url' => 'getFailureRedirectUrl', + 'should_authenticate_credit_card' => 'getShouldAuthenticateCreditCard', + 'currency' => 'getCurrency', + 'items' => 'getItems', + 'fixed_va' => 'getFixedVa', + 'reminder_date' => 'getReminderDate', + 'customer' => 'getCustomer', + 'customer_notification_preference' => 'getCustomerNotificationPreference', + 'fees' => 'getFees' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('is_high', $data ?? [], null); + $this->setIfExists('payer_email', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('merchant_name', $data ?? [], null); + $this->setIfExists('merchant_profile_picture_url', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('invoice_url', $data ?? [], null); + $this->setIfExists('available_banks', $data ?? [], null); + $this->setIfExists('available_retail_outlets', $data ?? [], null); + $this->setIfExists('available_ewallets', $data ?? [], null); + $this->setIfExists('available_qr_codes', $data ?? [], null); + $this->setIfExists('available_direct_debits', $data ?? [], null); + $this->setIfExists('available_paylaters', $data ?? [], null); + $this->setIfExists('should_exclude_credit_card', $data ?? [], null); + $this->setIfExists('should_send_email', $data ?? [], null); + $this->setIfExists('client_type', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('success_redirect_url', $data ?? [], null); + $this->setIfExists('failure_redirect_url', $data ?? [], null); + $this->setIfExists('should_authenticate_credit_card', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('fixed_va', $data ?? [], null); + $this->setIfExists('reminder_date', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customer_notification_preference', $data ?? [], null); + $this->setIfExists('fees', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_id'] === null) { + $invalidProperties[] = "'external_id' can't be null"; + } + if ($this->container['user_id'] === null) { + $invalidProperties[] = "'user_id' can't be null"; + } + if ($this->container['is_high'] === null) { + $invalidProperties[] = "'is_high' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['merchant_name'] === null) { + $invalidProperties[] = "'merchant_name' can't be null"; + } + if ($this->container['merchant_profile_picture_url'] === null) { + $invalidProperties[] = "'merchant_profile_picture_url' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['expiry_date'] === null) { + $invalidProperties[] = "'expiry_date' can't be null"; + } + if ($this->container['invoice_url'] === null) { + $invalidProperties[] = "'invoice_url' can't be null"; + } + if ($this->container['available_banks'] === null) { + $invalidProperties[] = "'available_banks' can't be null"; + } + if ($this->container['available_retail_outlets'] === null) { + $invalidProperties[] = "'available_retail_outlets' can't be null"; + } + if ($this->container['available_ewallets'] === null) { + $invalidProperties[] = "'available_ewallets' can't be null"; + } + if ($this->container['available_qr_codes'] === null) { + $invalidProperties[] = "'available_qr_codes' can't be null"; + } + if ($this->container['available_direct_debits'] === null) { + $invalidProperties[] = "'available_direct_debits' can't be null"; + } + if ($this->container['available_paylaters'] === null) { + $invalidProperties[] = "'available_paylaters' can't be null"; + } + if ($this->container['should_send_email'] === null) { + $invalidProperties[] = "'should_send_email' can't be null"; + } + if ($this->container['client_type'] === null) { + $invalidProperties[] = "'client_type' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier for the invoice. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets external_id + * + * @return string + */ + public function getExternalId() + { + return $this->container['external_id']; + } + + /** + * Sets external_id + * + * @param string $external_id The external identifier for the invoice. + * + * @return self + */ + public function setExternalId($external_id) + { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } + $this->container['external_id'] = $external_id; + + return $this; + } + + /** + * Gets user_id + * + * @return string + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string $user_id The user ID associated with the invoice. + * + * @return self + */ + public function setUserId($user_id) + { + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + } + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets is_high + * + * @return bool + */ + public function getIsHigh() + { + return $this->container['is_high']; + } + + /** + * Sets is_high + * + * @param bool $is_high Indicates if it's a high-value invoice. + * + * @return self + */ + public function setIsHigh($is_high) + { + if (is_null($is_high)) { + throw new \InvalidArgumentException('non-nullable is_high cannot be null'); + } + $this->container['is_high'] = $is_high; + + return $this; + } + + /** + * Gets payer_email + * + * @return string|null + */ + public function getPayerEmail() + { + return $this->container['payer_email']; + } + + /** + * Sets payer_email + * + * @param string|null $payer_email The email address of the payer. + * + * @return self + */ + public function setPayerEmail($payer_email) + { + if (is_null($payer_email)) { + throw new \InvalidArgumentException('non-nullable payer_email cannot be null'); + } + $this->container['payer_email'] = $payer_email; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A description of the invoice. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets payment_method + * + * @return \Invoice\InvoicePaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['payment_method']; + } + + /** + * Sets payment_method + * + * @param \Invoice\InvoicePaymentMethod|null $payment_method payment_method + * + * @return self + */ + public function setPaymentMethod($payment_method) + { + if (is_null($payment_method)) { + throw new \InvalidArgumentException('non-nullable payment_method cannot be null'); + } + $this->container['payment_method'] = $payment_method; + + return $this; + } + + /** + * Gets status + * + * @return \Invoice\InvoiceStatus + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Invoice\InvoiceStatus $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets merchant_name + * + * @return string + */ + public function getMerchantName() + { + return $this->container['merchant_name']; + } + + /** + * Sets merchant_name + * + * @param string $merchant_name The name of the merchant. + * + * @return self + */ + public function setMerchantName($merchant_name) + { + if (is_null($merchant_name)) { + throw new \InvalidArgumentException('non-nullable merchant_name cannot be null'); + } + $this->container['merchant_name'] = $merchant_name; + + return $this; + } + + /** + * Gets merchant_profile_picture_url + * + * @return string + */ + public function getMerchantProfilePictureUrl() + { + return $this->container['merchant_profile_picture_url']; + } + + /** + * Sets merchant_profile_picture_url + * + * @param string $merchant_profile_picture_url The URL of the merchant's profile picture. + * + * @return self + */ + public function setMerchantProfilePictureUrl($merchant_profile_picture_url) + { + if (is_null($merchant_profile_picture_url)) { + throw new \InvalidArgumentException('non-nullable merchant_profile_picture_url cannot be null'); + } + $this->container['merchant_profile_picture_url'] = $merchant_profile_picture_url; + + return $this; + } + + /** + * Gets locale + * + * @return string|null + */ + public function getLocale() + { + return $this->container['locale']; + } + + /** + * Sets locale + * + * @param string|null $locale The locale or language used for the invoice. + * + * @return self + */ + public function setLocale($locale) + { + if (is_null($locale)) { + throw new \InvalidArgumentException('non-nullable locale cannot be null'); + } + $this->container['locale'] = $locale; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount The total amount of the invoice. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets expiry_date + * + * @return \DateTime + */ + public function getExpiryDate() + { + return $this->container['expiry_date']; + } + + /** + * Sets expiry_date + * + * @param \DateTime $expiry_date Representing a date and time in ISO 8601 format. + * + * @return self + */ + public function setExpiryDate($expiry_date) + { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } + $this->container['expiry_date'] = $expiry_date; + + return $this; + } + + /** + * Gets invoice_url + * + * @return string + */ + public function getInvoiceUrl() + { + return $this->container['invoice_url']; + } + + /** + * Sets invoice_url + * + * @param string $invoice_url The URL to view the invoice. + * + * @return self + */ + public function setInvoiceUrl($invoice_url) + { + if (is_null($invoice_url)) { + throw new \InvalidArgumentException('non-nullable invoice_url cannot be null'); + } + $this->container['invoice_url'] = $invoice_url; + + return $this; + } + + /** + * Gets available_banks + * + * @return \Invoice\Bank[] + */ + public function getAvailableBanks() + { + return $this->container['available_banks']; + } + + /** + * Sets available_banks + * + * @param \Invoice\Bank[] $available_banks An array of available banks for payment. + * + * @return self + */ + public function setAvailableBanks($available_banks) + { + if (is_null($available_banks)) { + throw new \InvalidArgumentException('non-nullable available_banks cannot be null'); + } + $this->container['available_banks'] = $available_banks; + + return $this; + } + + /** + * Gets available_retail_outlets + * + * @return \Invoice\RetailOutlet[] + */ + public function getAvailableRetailOutlets() + { + return $this->container['available_retail_outlets']; + } + + /** + * Sets available_retail_outlets + * + * @param \Invoice\RetailOutlet[] $available_retail_outlets An array of available retail outlets for payment. + * + * @return self + */ + public function setAvailableRetailOutlets($available_retail_outlets) + { + if (is_null($available_retail_outlets)) { + throw new \InvalidArgumentException('non-nullable available_retail_outlets cannot be null'); + } + $this->container['available_retail_outlets'] = $available_retail_outlets; + + return $this; + } + + /** + * Gets available_ewallets + * + * @return \Invoice\Ewallet[] + */ + public function getAvailableEwallets() + { + return $this->container['available_ewallets']; + } + + /** + * Sets available_ewallets + * + * @param \Invoice\Ewallet[] $available_ewallets An array of available e-wallets for payment. + * + * @return self + */ + public function setAvailableEwallets($available_ewallets) + { + if (is_null($available_ewallets)) { + throw new \InvalidArgumentException('non-nullable available_ewallets cannot be null'); + } + $this->container['available_ewallets'] = $available_ewallets; + + return $this; + } + + /** + * Gets available_qr_codes + * + * @return \Invoice\QrCode[] + */ + public function getAvailableQrCodes() + { + return $this->container['available_qr_codes']; + } + + /** + * Sets available_qr_codes + * + * @param \Invoice\QrCode[] $available_qr_codes An array of available QR codes for payment. + * + * @return self + */ + public function setAvailableQrCodes($available_qr_codes) + { + if (is_null($available_qr_codes)) { + throw new \InvalidArgumentException('non-nullable available_qr_codes cannot be null'); + } + $this->container['available_qr_codes'] = $available_qr_codes; + + return $this; + } + + /** + * Gets available_direct_debits + * + * @return \Invoice\DirectDebit[] + */ + public function getAvailableDirectDebits() + { + return $this->container['available_direct_debits']; + } + + /** + * Sets available_direct_debits + * + * @param \Invoice\DirectDebit[] $available_direct_debits An array of available direct debit options for payment. + * + * @return self + */ + public function setAvailableDirectDebits($available_direct_debits) + { + if (is_null($available_direct_debits)) { + throw new \InvalidArgumentException('non-nullable available_direct_debits cannot be null'); + } + $this->container['available_direct_debits'] = $available_direct_debits; + + return $this; + } + + /** + * Gets available_paylaters + * + * @return \Invoice\Paylater[] + */ + public function getAvailablePaylaters() + { + return $this->container['available_paylaters']; + } + + /** + * Sets available_paylaters + * + * @param \Invoice\Paylater[] $available_paylaters An array of available pay-later options for payment. + * + * @return self + */ + public function setAvailablePaylaters($available_paylaters) + { + if (is_null($available_paylaters)) { + throw new \InvalidArgumentException('non-nullable available_paylaters cannot be null'); + } + $this->container['available_paylaters'] = $available_paylaters; + + return $this; + } + + /** + * Gets should_exclude_credit_card + * + * @return bool|null + */ + public function getShouldExcludeCreditCard() + { + return $this->container['should_exclude_credit_card']; + } + + /** + * Sets should_exclude_credit_card + * + * @param bool|null $should_exclude_credit_card Indicates whether credit card payments should be excluded. + * + * @return self + */ + public function setShouldExcludeCreditCard($should_exclude_credit_card) + { + if (is_null($should_exclude_credit_card)) { + throw new \InvalidArgumentException('non-nullable should_exclude_credit_card cannot be null'); + } + $this->container['should_exclude_credit_card'] = $should_exclude_credit_card; + + return $this; + } + + /** + * Gets should_send_email + * + * @return bool + */ + public function getShouldSendEmail() + { + return $this->container['should_send_email']; + } + + /** + * Sets should_send_email + * + * @param bool $should_send_email Indicates whether email notifications should be sent. + * + * @return self + */ + public function setShouldSendEmail($should_send_email) + { + if (is_null($should_send_email)) { + throw new \InvalidArgumentException('non-nullable should_send_email cannot be null'); + } + $this->container['should_send_email'] = $should_send_email; + + return $this; + } + + /** + * Gets client_type + * + * @return \Invoice\InvoiceClientType + */ + public function getClientType() + { + return $this->container['client_type']; + } + + /** + * Sets client_type + * + * @param \Invoice\InvoiceClientType $client_type client_type + * + * @return self + */ + public function setClientType($client_type) + { + if (is_null($client_type)) { + throw new \InvalidArgumentException('non-nullable client_type cannot be null'); + } + $this->container['client_type'] = $client_type; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime $created Representing a date and time in ISO 8601 format. + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime $updated Representing a date and time in ISO 8601 format. + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets success_redirect_url + * + * @return string|null + */ + public function getSuccessRedirectUrl() + { + return $this->container['success_redirect_url']; + } + + /** + * Sets success_redirect_url + * + * @param string|null $success_redirect_url The URL to redirect to on successful payment. + * + * @return self + */ + public function setSuccessRedirectUrl($success_redirect_url) + { + if (is_null($success_redirect_url)) { + throw new \InvalidArgumentException('non-nullable success_redirect_url cannot be null'); + } + $this->container['success_redirect_url'] = $success_redirect_url; + + return $this; + } + + /** + * Gets failure_redirect_url + * + * @return string|null + */ + public function getFailureRedirectUrl() + { + return $this->container['failure_redirect_url']; + } + + /** + * Sets failure_redirect_url + * + * @param string|null $failure_redirect_url The URL to redirect to on payment failure. + * + * @return self + */ + public function setFailureRedirectUrl($failure_redirect_url) + { + if (is_null($failure_redirect_url)) { + throw new \InvalidArgumentException('non-nullable failure_redirect_url cannot be null'); + } + $this->container['failure_redirect_url'] = $failure_redirect_url; + + return $this; + } + + /** + * Gets should_authenticate_credit_card + * + * @return bool|null + */ + public function getShouldAuthenticateCreditCard() + { + return $this->container['should_authenticate_credit_card']; + } + + /** + * Sets should_authenticate_credit_card + * + * @param bool|null $should_authenticate_credit_card Indicates whether credit card authentication is required. + * + * @return self + */ + public function setShouldAuthenticateCreditCard($should_authenticate_credit_card) + { + if (is_null($should_authenticate_credit_card)) { + throw new \InvalidArgumentException('non-nullable should_authenticate_credit_card cannot be null'); + } + $this->container['should_authenticate_credit_card'] = $should_authenticate_credit_card; + + return $this; + } + + /** + * Gets currency + * + * @return \Invoice\InvoiceCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Invoice\InvoiceCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets items + * + * @return \Invoice\InvoiceItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Invoice\InvoiceItem[]|null $items An array of items included in the invoice. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets fixed_va + * + * @return bool|null + */ + public function getFixedVa() + { + return $this->container['fixed_va']; + } + + /** + * Sets fixed_va + * + * @param bool|null $fixed_va Indicates whether the virtual account is fixed. + * + * @return self + */ + public function setFixedVa($fixed_va) + { + if (is_null($fixed_va)) { + throw new \InvalidArgumentException('non-nullable fixed_va cannot be null'); + } + $this->container['fixed_va'] = $fixed_va; + + return $this; + } + + /** + * Gets reminder_date + * + * @return \DateTime|null + */ + public function getReminderDate() + { + return $this->container['reminder_date']; + } + + /** + * Sets reminder_date + * + * @param \DateTime|null $reminder_date Representing a date and time in ISO 8601 format. + * + * @return self + */ + public function setReminderDate($reminder_date) + { + if (is_null($reminder_date)) { + throw new \InvalidArgumentException('non-nullable reminder_date cannot be null'); + } + $this->container['reminder_date'] = $reminder_date; + + return $this; + } + + /** + * Gets customer + * + * @return \Invoice\CustomerObject|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \Invoice\CustomerObject|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customer_notification_preference + * + * @return \Invoice\NotificationPreference|null + */ + public function getCustomerNotificationPreference() + { + return $this->container['customer_notification_preference']; + } + + /** + * Sets customer_notification_preference + * + * @param \Invoice\NotificationPreference|null $customer_notification_preference customer_notification_preference + * + * @return self + */ + public function setCustomerNotificationPreference($customer_notification_preference) + { + if (is_null($customer_notification_preference)) { + throw new \InvalidArgumentException('non-nullable customer_notification_preference cannot be null'); + } + $this->container['customer_notification_preference'] = $customer_notification_preference; + + return $this; + } + + /** + * Gets fees + * + * @return \Invoice\InvoiceFee[]|null + */ + public function getFees() + { + return $this->container['fees']; + } + + /** + * Sets fees + * + * @param \Invoice\InvoiceFee[]|null $fees An array of fees associated with the invoice. + * + * @return self + */ + public function setFees($fees) + { + if (is_null($fees)) { + throw new \InvalidArgumentException('non-nullable fees cannot be null'); + } + $this->container['fees'] = $fees; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/InvoiceApi.php b/lib/Invoice/InvoiceApi.php new file mode 100644 index 0000000..bb3d251 --- /dev/null +++ b/lib/Invoice/InvoiceApi.php @@ -0,0 +1,1748 @@ + [ + 'application/json', + ], + 'expireInvoice' => [ + 'application/json', + ], + 'getInvoiceById' => [ + 'application/json', + ], + 'getInvoices' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createInvoice + * + * Create an invoice + * + * @param \Xendit\Invoice\CreateInvoiceRequest $create_invoice_request create_invoice_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Invoice\Invoice|Xendit\Invoice\BadRequestError|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\ForbiddenError|Xendit\Invoice\InvoiceNotFoundError + */ + public function createInvoice($create_invoice_request, string $contentType = self::contentTypes['createInvoice'][0]) + { + list($response) = $this->createInvoiceWithHttpInfo($create_invoice_request, $contentType); + return $response; + } + + /** + * Operation createInvoiceWithHttpInfo + * + * Create an invoice + * + * @param \Xendit\Invoice\CreateInvoiceRequest $create_invoice_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Invoice\Invoice|Xendit\Invoice\BadRequestError|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\ForbiddenError|Xendit\Invoice\InvoiceNotFoundError, HTTP status code, HTTP response headers (array of strings) + */ + public function createInvoiceWithHttpInfo($create_invoice_request, string $contentType = self::contentTypes['createInvoice'][0]) + { + $request = $this->createInvoiceRequest($create_invoice_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Invoice\Invoice' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\Invoice' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\Invoice', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\Invoice\BadRequestError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\BadRequestError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\BadRequestError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('Xendit\Invoice\UnauthorizedError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\UnauthorizedError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\UnauthorizedError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Invoice\ForbiddenError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\ForbiddenError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\ForbiddenError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Invoice\InvoiceNotFoundError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\InvoiceNotFoundError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\InvoiceNotFoundError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Invoice\Invoice'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\Invoice', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\BadRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\ForbiddenError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\InvoiceNotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInvoiceAsync + * + * Create an invoice + * + * @param Xendit\Xendit\Invoice\CreateInvoiceRequest $create_invoice_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInvoiceAsync($create_invoice_request, string $contentType = self::contentTypes['createInvoice'][0]) + { + return $this->createInvoiceAsyncWithHttpInfo($create_invoice_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInvoiceAsyncWithHttpInfo + * + * Create an invoice + * + * @param Xendit\Xendit\Invoice\CreateInvoiceRequest $create_invoice_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInvoiceAsyncWithHttpInfo($create_invoice_request, string $contentType = self::contentTypes['createInvoice'][0]) + { + $returnType = '\Invoice\Invoice'; + $request = $this->createInvoiceRequest($create_invoice_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createInvoice' + * + * @param \Xendit\Invoice\CreateInvoiceRequest $create_invoice_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInvoiceRequest($create_invoice_request, string $contentType = self::contentTypes['createInvoice'][0]) + { + + // verify the required parameter 'create_invoice_request' is set + if ($create_invoice_request === null || (is_array($create_invoice_request) && count($create_invoice_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_invoice_request when calling createInvoice' + ); + } + + + $resourcePath = '/v2/invoices/'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_invoice_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_invoice_request)); + } else { + $httpBody = $create_invoice_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation expireInvoice + * + * Manually expire an invoice + * + * @param string $invoice_id Invoice ID to be expired (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireInvoice'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Invoice\Invoice|Xendit\Invoice\InvoiceNotFoundError|Xendit\Invoice\ServerError + */ + public function expireInvoice($invoice_id, string $contentType = self::contentTypes['expireInvoice'][0]) + { + list($response) = $this->expireInvoiceWithHttpInfo($invoice_id, $contentType); + return $response; + } + + /** + * Operation expireInvoiceWithHttpInfo + * + * Manually expire an invoice + * + * @param string $invoice_id Invoice ID to be expired (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireInvoice'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Invoice\Invoice|Xendit\Invoice\InvoiceNotFoundError|Xendit\Invoice\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function expireInvoiceWithHttpInfo($invoice_id, string $contentType = self::contentTypes['expireInvoice'][0]) + { + $request = $this->expireInvoiceRequest($invoice_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Invoice\Invoice' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\Invoice' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\Invoice', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Invoice\InvoiceNotFoundError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\InvoiceNotFoundError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\InvoiceNotFoundError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\Invoice\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Invoice\Invoice'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\Invoice', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\InvoiceNotFoundError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation expireInvoiceAsync + * + * Manually expire an invoice + * + * @param Xenditstring $invoice_id Invoice ID to be expired (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireInvoiceAsync($invoice_id, string $contentType = self::contentTypes['expireInvoice'][0]) + { + return $this->expireInvoiceAsyncWithHttpInfo($invoice_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation expireInvoiceAsyncWithHttpInfo + * + * Manually expire an invoice + * + * @param Xenditstring $invoice_id Invoice ID to be expired (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireInvoiceAsyncWithHttpInfo($invoice_id, string $contentType = self::contentTypes['expireInvoice'][0]) + { + $returnType = '\Invoice\Invoice'; + $request = $this->expireInvoiceRequest($invoice_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'expireInvoice' + * + * @param string $invoice_id Invoice ID to be expired (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expireInvoice'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function expireInvoiceRequest($invoice_id, string $contentType = self::contentTypes['expireInvoice'][0]) + { + + // verify the required parameter 'invoice_id' is set + if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $invoice_id when calling expireInvoice' + ); + } + + + $resourcePath = '/invoices/{invoice_id}/expire!'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($invoice_id !== null) { + $resourcePath = str_replace( + '{' . 'invoice_id' . '}', + ObjectSerializer::toPathValue($invoice_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInvoiceById + * + * Get invoice by invoice id + * + * @param string $invoice_id Invoice ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoiceById'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Invoice\Invoice|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\InvoiceError404ResponseDefinition|Xendit\Invoice\ServerError + */ + public function getInvoiceById($invoice_id, string $contentType = self::contentTypes['getInvoiceById'][0]) + { + list($response) = $this->getInvoiceByIdWithHttpInfo($invoice_id, $contentType); + return $response; + } + + /** + * Operation getInvoiceByIdWithHttpInfo + * + * Get invoice by invoice id + * + * @param string $invoice_id Invoice ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoiceById'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Invoice\Invoice|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\InvoiceError404ResponseDefinition|Xendit\Invoice\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function getInvoiceByIdWithHttpInfo($invoice_id, string $contentType = self::contentTypes['getInvoiceById'][0]) + { + $request = $this->getInvoiceByIdRequest($invoice_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Invoice\Invoice' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\Invoice' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\Invoice', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('Xendit\Invoice\UnauthorizedError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\UnauthorizedError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\UnauthorizedError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Invoice\InvoiceError404ResponseDefinition' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\InvoiceError404ResponseDefinition' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\InvoiceError404ResponseDefinition', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\Invoice\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Invoice\Invoice'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\Invoice', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\InvoiceError404ResponseDefinition', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInvoiceByIdAsync + * + * Get invoice by invoice id + * + * @param Xenditstring $invoice_id Invoice ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoiceById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInvoiceByIdAsync($invoice_id, string $contentType = self::contentTypes['getInvoiceById'][0]) + { + return $this->getInvoiceByIdAsyncWithHttpInfo($invoice_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInvoiceByIdAsyncWithHttpInfo + * + * Get invoice by invoice id + * + * @param Xenditstring $invoice_id Invoice ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoiceById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInvoiceByIdAsyncWithHttpInfo($invoice_id, string $contentType = self::contentTypes['getInvoiceById'][0]) + { + $returnType = '\Invoice\Invoice'; + $request = $this->getInvoiceByIdRequest($invoice_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInvoiceById' + * + * @param string $invoice_id Invoice ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoiceById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInvoiceByIdRequest($invoice_id, string $contentType = self::contentTypes['getInvoiceById'][0]) + { + + // verify the required parameter 'invoice_id' is set + if ($invoice_id === null || (is_array($invoice_id) && count($invoice_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $invoice_id when calling getInvoiceById' + ); + } + + + $resourcePath = '/v2/invoices/{invoice_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($invoice_id !== null) { + $resourcePath = str_replace( + '{' . 'invoice_id' . '}', + ObjectSerializer::toPathValue($invoice_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getInvoices + * + * Get all Invoices + * + * @param string $external_id external_id (optional) + * @param string[] $statuses statuses (optional) + * @param float $limit limit (optional) + * @param \DateTime $created_after created_after (optional) + * @param \DateTime $created_before created_before (optional) + * @param \DateTime $paid_after paid_after (optional) + * @param \DateTime $paid_before paid_before (optional) + * @param \DateTime $expired_after expired_after (optional) + * @param \DateTime $expired_before expired_before (optional) + * @param string $last_invoice last_invoice (optional) + * @param string[] $client_types client_types (optional) + * @param string[] $payment_channels payment_channels (optional) + * @param string $on_demand_link on_demand_link (optional) + * @param string $recurring_payment_id recurring_payment_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoices'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Invoice\Invoice[]|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\ServerError + */ + public function getInvoices($external_id = null, $statuses = null, $limit = null, $created_after = null, $created_before = null, $paid_after = null, $paid_before = null, $expired_after = null, $expired_before = null, $last_invoice = null, $client_types = null, $payment_channels = null, $on_demand_link = null, $recurring_payment_id = null, string $contentType = self::contentTypes['getInvoices'][0]) + { + list($response) = $this->getInvoicesWithHttpInfo($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id, $contentType); + return $response; + } + + /** + * Operation getInvoicesWithHttpInfo + * + * Get all Invoices + * + * @param string $external_id (optional) + * @param string[] $statuses (optional) + * @param float $limit (optional) + * @param \DateTime $created_after (optional) + * @param \DateTime $created_before (optional) + * @param \DateTime $paid_after (optional) + * @param \DateTime $paid_before (optional) + * @param \DateTime $expired_after (optional) + * @param \DateTime $expired_before (optional) + * @param string $last_invoice (optional) + * @param string[] $client_types (optional) + * @param string[] $payment_channels (optional) + * @param string $on_demand_link (optional) + * @param string $recurring_payment_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoices'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Invoice\Invoice[]|Xendit\Invoice\UnauthorizedError|Xendit\Invoice\ServerError, HTTP status code, HTTP response headers (array of strings) + */ + public function getInvoicesWithHttpInfo($external_id = null, $statuses = null, $limit = null, $created_after = null, $created_before = null, $paid_after = null, $paid_before = null, $expired_after = null, $expired_before = null, $last_invoice = null, $client_types = null, $payment_channels = null, $on_demand_link = null, $recurring_payment_id = null, string $contentType = self::contentTypes['getInvoices'][0]) + { + $request = $this->getInvoicesRequest($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Invoice\Invoice[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\Invoice[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\Invoice[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('Xendit\Invoice\UnauthorizedError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\UnauthorizedError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\UnauthorizedError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\Invoice\ServerError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Invoice\ServerError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Invoice\ServerError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Invoice\Invoice[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\Invoice[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\UnauthorizedError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Invoice\ServerError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInvoicesAsync + * + * Get all Invoices + * + * @param Xenditstring $external_id (optional) + * @param Xenditstring[] $statuses (optional) + * @param Xenditfloat $limit (optional) + * @param Xendit\DateTime $created_after (optional) + * @param Xendit\DateTime $created_before (optional) + * @param Xendit\DateTime $paid_after (optional) + * @param Xendit\DateTime $paid_before (optional) + * @param Xendit\DateTime $expired_after (optional) + * @param Xendit\DateTime $expired_before (optional) + * @param Xenditstring $last_invoice (optional) + * @param Xenditstring[] $client_types (optional) + * @param Xenditstring[] $payment_channels (optional) + * @param Xenditstring $on_demand_link (optional) + * @param Xenditstring $recurring_payment_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoices'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInvoicesAsync($external_id = null, $statuses = null, $limit = null, $created_after = null, $created_before = null, $paid_after = null, $paid_before = null, $expired_after = null, $expired_before = null, $last_invoice = null, $client_types = null, $payment_channels = null, $on_demand_link = null, $recurring_payment_id = null, string $contentType = self::contentTypes['getInvoices'][0]) + { + return $this->getInvoicesAsyncWithHttpInfo($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInvoicesAsyncWithHttpInfo + * + * Get all Invoices + * + * @param Xenditstring $external_id (optional) + * @param Xenditstring[] $statuses (optional) + * @param Xenditfloat $limit (optional) + * @param Xendit\DateTime $created_after (optional) + * @param Xendit\DateTime $created_before (optional) + * @param Xendit\DateTime $paid_after (optional) + * @param Xendit\DateTime $paid_before (optional) + * @param Xendit\DateTime $expired_after (optional) + * @param Xendit\DateTime $expired_before (optional) + * @param Xenditstring $last_invoice (optional) + * @param Xenditstring[] $client_types (optional) + * @param Xenditstring[] $payment_channels (optional) + * @param Xenditstring $on_demand_link (optional) + * @param Xenditstring $recurring_payment_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoices'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getInvoicesAsyncWithHttpInfo($external_id = null, $statuses = null, $limit = null, $created_after = null, $created_before = null, $paid_after = null, $paid_before = null, $expired_after = null, $expired_before = null, $last_invoice = null, $client_types = null, $payment_channels = null, $on_demand_link = null, $recurring_payment_id = null, string $contentType = self::contentTypes['getInvoices'][0]) + { + $returnType = '\Invoice\Invoice[]'; + $request = $this->getInvoicesRequest($external_id, $statuses, $limit, $created_after, $created_before, $paid_after, $paid_before, $expired_after, $expired_before, $last_invoice, $client_types, $payment_channels, $on_demand_link, $recurring_payment_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getInvoices' + * + * @param string $external_id (optional) + * @param string[] $statuses (optional) + * @param float $limit (optional) + * @param \DateTime $created_after (optional) + * @param \DateTime $created_before (optional) + * @param \DateTime $paid_after (optional) + * @param \DateTime $paid_before (optional) + * @param \DateTime $expired_after (optional) + * @param \DateTime $expired_before (optional) + * @param string $last_invoice (optional) + * @param string[] $client_types (optional) + * @param string[] $payment_channels (optional) + * @param string $on_demand_link (optional) + * @param string $recurring_payment_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInvoices'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInvoicesRequest($external_id = null, $statuses = null, $limit = null, $created_after = null, $created_before = null, $paid_after = null, $paid_before = null, $expired_after = null, $expired_before = null, $last_invoice = null, $client_types = null, $payment_channels = null, $on_demand_link = null, $recurring_payment_id = null, string $contentType = self::contentTypes['getInvoices'][0]) + { + + + + + + + + + + + + + + + + + $resourcePath = '/v2/invoices'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_id, + 'external_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $statuses, + 'statuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_after, + 'created_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_before, + 'created_before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paid_after, + 'paid_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paid_before, + 'paid_before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expired_after, + 'expired_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expired_before, + 'expired_before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $last_invoice, + 'last_invoice', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $client_types, + 'client_types', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $payment_channels, + 'payment_channels', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $on_demand_link, + 'on_demand_link', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $recurring_payment_id, + 'recurring_payment_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Invoice/InvoiceClientType.php b/lib/Invoice/InvoiceClientType.php new file mode 100644 index 0000000..f883128 --- /dev/null +++ b/lib/Invoice/InvoiceClientType.php @@ -0,0 +1,94 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum InvoiceClientType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::DASHBOARD, + self::API_GATEWAY, + self::INTEGRATION, + self::ON_DEMAND, + self::RECURRING, + self::MOBILE, + self::STOREFRONT + ]; + } +} + + diff --git a/lib/Invoice/InvoiceCurrency.php b/lib/Invoice/InvoiceCurrency.php new file mode 100644 index 0000000..fbf1c4e --- /dev/null +++ b/lib/Invoice/InvoiceCurrency.php @@ -0,0 +1,82 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum InvoiceCurrency: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::IDR, + self::USD, + self::PHP + ]; + } +} + + diff --git a/lib/Invoice/InvoiceError404ResponseDefinition.php b/lib/Invoice/InvoiceError404ResponseDefinition.php new file mode 100644 index 0000000..801367a --- /dev/null +++ b/lib/Invoice/InvoiceError404ResponseDefinition.php @@ -0,0 +1,475 @@ + + */ +class InvoiceError404ResponseDefinition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InvoiceError404ResponseDefinition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_INVOICE_NOT_FOUND_ERROR = 'INVOICE_NOT_FOUND_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_INVOICE_NOT_FOUND_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code The specific error code indicating that the requested invoice was not found. + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human-readable error message providing additional context about the resource not being found. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/InvoiceFee.php b/lib/Invoice/InvoiceFee.php new file mode 100644 index 0000000..3c6df1b --- /dev/null +++ b/lib/Invoice/InvoiceFee.php @@ -0,0 +1,443 @@ + + */ +class InvoiceFee implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InvoiceFee'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'value' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of fee. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets value + * + * @return float + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float $value The value or amount of the fee. + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/InvoiceItem.php b/lib/Invoice/InvoiceItem.php new file mode 100644 index 0000000..2fc1228 --- /dev/null +++ b/lib/Invoice/InvoiceItem.php @@ -0,0 +1,591 @@ + + */ +class InvoiceItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InvoiceItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'price' => 'float', + 'quantity' => 'float', + 'reference_id' => 'string', + 'url' => 'string', + 'category' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'price' => null, + 'quantity' => null, + 'reference_id' => null, + 'url' => null, + 'category' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'price' => false, + 'quantity' => false, + 'reference_id' => false, + 'url' => false, + 'category' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'price' => 'price', + 'quantity' => 'quantity', + 'reference_id' => 'reference_id', + 'url' => 'url', + 'category' => 'category' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'price' => 'setPrice', + 'quantity' => 'setQuantity', + 'reference_id' => 'setReferenceId', + 'url' => 'setUrl', + 'category' => 'setCategory' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'price' => 'getPrice', + 'quantity' => 'getQuantity', + 'reference_id' => 'getReferenceId', + 'url' => 'getUrl', + 'category' => 'getCategory' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['price'] === null) { + $invalidProperties[] = "'price' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + if (($this->container['quantity'] <= 0)) { + $invalidProperties[] = "invalid value for 'quantity', must be bigger than 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the item. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return float + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float $price The price of the item. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity The quantity of the item. Must be greater than or equal to 0. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + + if (($quantity <= 0)) { + throw new \InvalidArgumentException('invalid value for $quantity when calling InvoiceItem., must be bigger than 0.'); + } + + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id The reference ID of the item. + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL associated with the item. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category of the item. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/InvoiceNotFoundError.php b/lib/Invoice/InvoiceNotFoundError.php new file mode 100644 index 0000000..b2eed61 --- /dev/null +++ b/lib/Invoice/InvoiceNotFoundError.php @@ -0,0 +1,479 @@ + + */ +class InvoiceNotFoundError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InvoiceNotFoundError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_CALLBACK_VIRTUAL_ACCOUNT_NOT_FOUND_ERROR = 'CALLBACK_VIRTUAL_ACCOUNT_NOT_FOUND_ERROR'; + public const ERROR_CODE_UNIQUE_ACCOUNT_NUMBER_UNAVAILABLE_ERROR = 'UNIQUE_ACCOUNT_NUMBER_UNAVAILABLE_ERROR'; + public const ERROR_CODE_PAYMENT_CODE_NOT_AVAILABLE_ERROR = 'PAYMENT_CODE_NOT_AVAILABLE_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_CALLBACK_VIRTUAL_ACCOUNT_NOT_FOUND_ERROR, + self::ERROR_CODE_UNIQUE_ACCOUNT_NUMBER_UNAVAILABLE_ERROR, + self::ERROR_CODE_PAYMENT_CODE_NOT_AVAILABLE_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code The error code indicating the type of error that occurred. + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human-readable error message that provides additional information about the error. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/InvoicePaymentMethod.php b/lib/Invoice/InvoicePaymentMethod.php new file mode 100644 index 0000000..f75b934 --- /dev/null +++ b/lib/Invoice/InvoicePaymentMethod.php @@ -0,0 +1,103 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum InvoicePaymentMethod: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::POOL, + self::CALLBACK_VIRTUAL_ACCOUNT, + self::CREDIT_CARD, + self::RETAIL_OUTLET, + self::QR_CODE, + self::QRIS, + self::EWALLET, + self::DIRECT_DEBIT, + self::BANK_TRANSFER, + self::PAYLATER + ]; + } +} + + diff --git a/lib/Invoice/InvoiceStatus.php b/lib/Invoice/InvoiceStatus.php new file mode 100644 index 0000000..939b495 --- /dev/null +++ b/lib/Invoice/InvoiceStatus.php @@ -0,0 +1,91 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum InvoiceStatus: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::PENDING, + self::COMPLETING, + self::PAID, + self::SETTLED, + self::EXPIRED, + self::REMINDER + ]; + } +} + + diff --git a/lib/Invoice/NotificationChannel.php b/lib/Invoice/NotificationChannel.php new file mode 100644 index 0000000..0d8a40f --- /dev/null +++ b/lib/Invoice/NotificationChannel.php @@ -0,0 +1,85 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum NotificationChannel: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::EMAIL, + self::SMS, + self::WHATSAPP, + self::VIBER + ]; + } +} + + diff --git a/lib/Invoice/NotificationPreference.php b/lib/Invoice/NotificationPreference.php new file mode 100644 index 0000000..1e8b9cf --- /dev/null +++ b/lib/Invoice/NotificationPreference.php @@ -0,0 +1,505 @@ + + */ +class NotificationPreference implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NotificationPreference'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'invoice_created' => '\Xendit\Invoice\NotificationChannel[]', + 'invoice_reminder' => '\Xendit\Invoice\NotificationChannel[]', + 'invoice_expired' => '\Xendit\Invoice\NotificationChannel[]', + 'invoice_paid' => '\Xendit\Invoice\NotificationChannel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'invoice_created' => null, + 'invoice_reminder' => null, + 'invoice_expired' => null, + 'invoice_paid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'invoice_created' => false, + 'invoice_reminder' => false, + 'invoice_expired' => false, + 'invoice_paid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'invoice_created' => 'invoice_created', + 'invoice_reminder' => 'invoice_reminder', + 'invoice_expired' => 'invoice_expired', + 'invoice_paid' => 'invoice_paid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'invoice_created' => 'setInvoiceCreated', + 'invoice_reminder' => 'setInvoiceReminder', + 'invoice_expired' => 'setInvoiceExpired', + 'invoice_paid' => 'setInvoicePaid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'invoice_created' => 'getInvoiceCreated', + 'invoice_reminder' => 'getInvoiceReminder', + 'invoice_expired' => 'getInvoiceExpired', + 'invoice_paid' => 'getInvoicePaid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('invoice_created', $data ?? [], null); + $this->setIfExists('invoice_reminder', $data ?? [], null); + $this->setIfExists('invoice_expired', $data ?? [], null); + $this->setIfExists('invoice_paid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets invoice_created + * + * @return \Invoice\NotificationChannel[]|null + */ + public function getInvoiceCreated() + { + return $this->container['invoice_created']; + } + + /** + * Sets invoice_created + * + * @param \Invoice\NotificationChannel[]|null $invoice_created Notification channels for when an invoice is created. + * + * @return self + */ + public function setInvoiceCreated($invoice_created) + { + if (is_null($invoice_created)) { + throw new \InvalidArgumentException('non-nullable invoice_created cannot be null'); + } + $this->container['invoice_created'] = $invoice_created; + + return $this; + } + + /** + * Gets invoice_reminder + * + * @return \Invoice\NotificationChannel[]|null + */ + public function getInvoiceReminder() + { + return $this->container['invoice_reminder']; + } + + /** + * Sets invoice_reminder + * + * @param \Invoice\NotificationChannel[]|null $invoice_reminder Notification channels for invoice reminders. + * + * @return self + */ + public function setInvoiceReminder($invoice_reminder) + { + if (is_null($invoice_reminder)) { + throw new \InvalidArgumentException('non-nullable invoice_reminder cannot be null'); + } + $this->container['invoice_reminder'] = $invoice_reminder; + + return $this; + } + + /** + * Gets invoice_expired + * + * @return \Invoice\NotificationChannel[]|null + */ + public function getInvoiceExpired() + { + return $this->container['invoice_expired']; + } + + /** + * Sets invoice_expired + * + * @param \Invoice\NotificationChannel[]|null $invoice_expired Notification channels for expired invoices. + * + * @return self + */ + public function setInvoiceExpired($invoice_expired) + { + if (is_null($invoice_expired)) { + throw new \InvalidArgumentException('non-nullable invoice_expired cannot be null'); + } + $this->container['invoice_expired'] = $invoice_expired; + + return $this; + } + + /** + * Gets invoice_paid + * + * @return \Invoice\NotificationChannel[]|null + */ + public function getInvoicePaid() + { + return $this->container['invoice_paid']; + } + + /** + * Sets invoice_paid + * + * @param \Invoice\NotificationChannel[]|null $invoice_paid Notification channels for when an invoice is paid. + * + * @return self + */ + public function setInvoicePaid($invoice_paid) + { + if (is_null($invoice_paid)) { + throw new \InvalidArgumentException('non-nullable invoice_paid cannot be null'); + } + $this->container['invoice_paid'] = $invoice_paid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/Paylater.php b/lib/Invoice/Paylater.php new file mode 100644 index 0000000..8f2bc3d --- /dev/null +++ b/lib/Invoice/Paylater.php @@ -0,0 +1,440 @@ + + */ +class Paylater implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Paylater'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paylater_type' => '\Xendit\Invoice\PaylaterType', + 'should_exclude' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paylater_type' => null, + 'should_exclude' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paylater_type' => false, + 'should_exclude' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paylater_type' => 'paylater_type', + 'should_exclude' => 'should_exclude' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paylater_type' => 'setPaylaterType', + 'should_exclude' => 'setShouldExclude' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paylater_type' => 'getPaylaterType', + 'should_exclude' => 'getShouldExclude' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('paylater_type', $data ?? [], null); + $this->setIfExists('should_exclude', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['paylater_type'] === null) { + $invalidProperties[] = "'paylater_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paylater_type + * + * @return \Invoice\PaylaterType + */ + public function getPaylaterType() + { + return $this->container['paylater_type']; + } + + /** + * Sets paylater_type + * + * @param \Invoice\PaylaterType $paylater_type paylater_type + * + * @return self + */ + public function setPaylaterType($paylater_type) + { + if (is_null($paylater_type)) { + throw new \InvalidArgumentException('non-nullable paylater_type cannot be null'); + } + $this->container['paylater_type'] = $paylater_type; + + return $this; + } + + /** + * Gets should_exclude + * + * @return bool|null + */ + public function getShouldExclude() + { + return $this->container['should_exclude']; + } + + /** + * Sets should_exclude + * + * @param bool|null $should_exclude Indicates whether this paylater option should be excluded. + * + * @return self + */ + public function setShouldExclude($should_exclude) + { + if (is_null($should_exclude)) { + throw new \InvalidArgumentException('non-nullable should_exclude cannot be null'); + } + $this->container['should_exclude'] = $should_exclude; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/PaylaterType.php b/lib/Invoice/PaylaterType.php new file mode 100644 index 0000000..5ee6a6d --- /dev/null +++ b/lib/Invoice/PaylaterType.php @@ -0,0 +1,91 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaylaterType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::KREDIVO, + self::AKULAKU, + self::UANGME, + self::BILLEASE, + self::CASHALO, + self::ATOME + ]; + } +} + + diff --git a/lib/Invoice/QrCode.php b/lib/Invoice/QrCode.php new file mode 100644 index 0000000..626bc49 --- /dev/null +++ b/lib/Invoice/QrCode.php @@ -0,0 +1,406 @@ + + */ +class QrCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QrCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qr_code_type' => '\Xendit\Invoice\QrCodeType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qr_code_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qr_code_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'qr_code_type' => 'qr_code_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qr_code_type' => 'setQrCodeType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qr_code_type' => 'getQrCodeType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('qr_code_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['qr_code_type'] === null) { + $invalidProperties[] = "'qr_code_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets qr_code_type + * + * @return \Invoice\QrCodeType + */ + public function getQrCodeType() + { + return $this->container['qr_code_type']; + } + + /** + * Sets qr_code_type + * + * @param \Invoice\QrCodeType $qr_code_type qr_code_type + * + * @return self + */ + public function setQrCodeType($qr_code_type) + { + if (is_null($qr_code_type)) { + throw new \InvalidArgumentException('non-nullable qr_code_type cannot be null'); + } + $this->container['qr_code_type'] = $qr_code_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/QrCodeType.php b/lib/Invoice/QrCodeType.php new file mode 100644 index 0000000..ce208a5 --- /dev/null +++ b/lib/Invoice/QrCodeType.php @@ -0,0 +1,79 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum QrCodeType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::QRIS, + self::PROMPTPAY + ]; + } +} + + diff --git a/lib/Invoice/RetailOutlet.php b/lib/Invoice/RetailOutlet.php new file mode 100644 index 0000000..393a032 --- /dev/null +++ b/lib/Invoice/RetailOutlet.php @@ -0,0 +1,508 @@ + + */ +class RetailOutlet implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RetailOutlet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'retail_outlet_name' => '\Xendit\Invoice\RetailOutletName', + 'payment_code' => 'string', + 'transfer_amount' => 'float', + 'merchant_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'retail_outlet_name' => null, + 'payment_code' => null, + 'transfer_amount' => null, + 'merchant_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'retail_outlet_name' => false, + 'payment_code' => false, + 'transfer_amount' => false, + 'merchant_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'retail_outlet_name' => 'retail_outlet_name', + 'payment_code' => 'payment_code', + 'transfer_amount' => 'transfer_amount', + 'merchant_name' => 'merchant_name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'retail_outlet_name' => 'setRetailOutletName', + 'payment_code' => 'setPaymentCode', + 'transfer_amount' => 'setTransferAmount', + 'merchant_name' => 'setMerchantName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'retail_outlet_name' => 'getRetailOutletName', + 'payment_code' => 'getPaymentCode', + 'transfer_amount' => 'getTransferAmount', + 'merchant_name' => 'getMerchantName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('retail_outlet_name', $data ?? [], null); + $this->setIfExists('payment_code', $data ?? [], null); + $this->setIfExists('transfer_amount', $data ?? [], null); + $this->setIfExists('merchant_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['retail_outlet_name'] === null) { + $invalidProperties[] = "'retail_outlet_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets retail_outlet_name + * + * @return \Invoice\RetailOutletName + */ + public function getRetailOutletName() + { + return $this->container['retail_outlet_name']; + } + + /** + * Sets retail_outlet_name + * + * @param \Invoice\RetailOutletName $retail_outlet_name retail_outlet_name + * + * @return self + */ + public function setRetailOutletName($retail_outlet_name) + { + if (is_null($retail_outlet_name)) { + throw new \InvalidArgumentException('non-nullable retail_outlet_name cannot be null'); + } + $this->container['retail_outlet_name'] = $retail_outlet_name; + + return $this; + } + + /** + * Gets payment_code + * + * @return string|null + */ + public function getPaymentCode() + { + return $this->container['payment_code']; + } + + /** + * Sets payment_code + * + * @param string|null $payment_code The payment code. + * + * @return self + */ + public function setPaymentCode($payment_code) + { + if (is_null($payment_code)) { + throw new \InvalidArgumentException('non-nullable payment_code cannot be null'); + } + $this->container['payment_code'] = $payment_code; + + return $this; + } + + /** + * Gets transfer_amount + * + * @return float|null + */ + public function getTransferAmount() + { + return $this->container['transfer_amount']; + } + + /** + * Sets transfer_amount + * + * @param float|null $transfer_amount The transfer amount. + * + * @return self + */ + public function setTransferAmount($transfer_amount) + { + if (is_null($transfer_amount)) { + throw new \InvalidArgumentException('non-nullable transfer_amount cannot be null'); + } + $this->container['transfer_amount'] = $transfer_amount; + + return $this; + } + + /** + * Gets merchant_name + * + * @return string|null + */ + public function getMerchantName() + { + return $this->container['merchant_name']; + } + + /** + * Sets merchant_name + * + * @param string|null $merchant_name The name of the merchant. + * + * @return self + */ + public function setMerchantName($merchant_name) + { + if (is_null($merchant_name)) { + throw new \InvalidArgumentException('non-nullable merchant_name cannot be null'); + } + $this->container['merchant_name'] = $merchant_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/RetailOutletName.php b/lib/Invoice/RetailOutletName.php new file mode 100644 index 0000000..302d463 --- /dev/null +++ b/lib/Invoice/RetailOutletName.php @@ -0,0 +1,100 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum RetailOutletName: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::ALFAMART, + self::INDOMARET, + self::_7_ELEVEN, + self::CEBUANA, + self::DP_ECPAY_LOAN, + self::DP_MLHUILLIER, + self::DP_PALAWAN, + self::DP_ECPAY_SCHOOL, + self::LBC + ]; + } +} + + diff --git a/lib/Invoice/ServerError.php b/lib/Invoice/ServerError.php new file mode 100644 index 0000000..5ce8725 --- /dev/null +++ b/lib/Invoice/ServerError.php @@ -0,0 +1,474 @@ + + */ +class ServerError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_SERVER_ERROR = 'SERVER_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_SERVER_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Invoice/UnauthorizedError.php b/lib/Invoice/UnauthorizedError.php new file mode 100644 index 0000000..d9e620e --- /dev/null +++ b/lib/Invoice/UnauthorizedError.php @@ -0,0 +1,475 @@ + + */ +class UnauthorizedError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UnauthorizedError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_INVALID_API_KEY = 'INVALID_API_KEY'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_INVALID_API_KEY, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code The specific error code associated with the unauthorized access. + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message A human-readable error message providing additional context about the unauthorized access. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..c71eecf --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,104 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Xendit\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} diff --git a/lib/PaymentMethod/BillingInformation.php b/lib/PaymentMethod/BillingInformation.php new file mode 100644 index 0000000..3efa2a1 --- /dev/null +++ b/lib/PaymentMethod/BillingInformation.php @@ -0,0 +1,659 @@ + + */ +class BillingInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BillingInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'country' => 'string', + 'street_line1' => 'string', + 'street_line2' => 'string', + 'city' => 'string', + 'province_state' => 'string', + 'postal_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'country' => null, + 'street_line1' => null, + 'street_line2' => null, + 'city' => null, + 'province_state' => null, + 'postal_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'country' => false, + 'street_line1' => true, + 'street_line2' => true, + 'city' => true, + 'province_state' => true, + 'postal_code' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'street_line1' => 'street_line1', + 'street_line2' => 'street_line2', + 'city' => 'city', + 'province_state' => 'province_state', + 'postal_code' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'street_line1' => 'setStreetLine1', + 'street_line2' => 'setStreetLine2', + 'city' => 'setCity', + 'province_state' => 'setProvinceState', + 'postal_code' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'street_line1' => 'getStreetLine1', + 'street_line2' => 'getStreetLine2', + 'city' => 'getCity', + 'province_state' => 'getProvinceState', + 'postal_code' => 'getPostalCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('street_line1', $data ?? [], null); + $this->setIfExists('street_line2', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('province_state', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if ((mb_strlen($this->container['country']) > 2)) { + $invalidProperties[] = "invalid value for 'country', the character length must be smaller than or equal to 2."; + } + + if (!is_null($this->container['street_line1']) && (mb_strlen($this->container['street_line1']) > 255)) { + $invalidProperties[] = "invalid value for 'street_line1', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['street_line2']) && (mb_strlen($this->container['street_line2']) > 255)) { + $invalidProperties[] = "invalid value for 'street_line2', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) > 255)) { + $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['province_state']) && (mb_strlen($this->container['province_state']) > 255)) { + $invalidProperties[] = "invalid value for 'province_state', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['postal_code']) && (mb_strlen($this->container['postal_code']) > 255)) { + $invalidProperties[] = "invalid value for 'postal_code', the character length must be smaller than or equal to 255."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + if ((mb_strlen($country) > 2)) { + throw new \InvalidArgumentException('invalid length for $country when calling BillingInformation., must be smaller than or equal to 2.'); + } + + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets street_line1 + * + * @return string|null + */ + public function getStreetLine1() + { + return $this->container['street_line1']; + } + + /** + * Sets street_line1 + * + * @param string|null $street_line1 street_line1 + * + * @return self + */ + public function setStreetLine1($street_line1) + { + if (is_null($street_line1)) { + array_push($this->openAPINullablesSetToNull, 'street_line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street_line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($street_line1) && (mb_strlen($street_line1) > 255)) { + throw new \InvalidArgumentException('invalid length for $street_line1 when calling BillingInformation., must be smaller than or equal to 255.'); + } + + $this->container['street_line1'] = $street_line1; + + return $this; + } + + /** + * Gets street_line2 + * + * @return string|null + */ + public function getStreetLine2() + { + return $this->container['street_line2']; + } + + /** + * Sets street_line2 + * + * @param string|null $street_line2 street_line2 + * + * @return self + */ + public function setStreetLine2($street_line2) + { + if (is_null($street_line2)) { + array_push($this->openAPINullablesSetToNull, 'street_line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('street_line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($street_line2) && (mb_strlen($street_line2) > 255)) { + throw new \InvalidArgumentException('invalid length for $street_line2 when calling BillingInformation., must be smaller than or equal to 255.'); + } + + $this->container['street_line2'] = $street_line2; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($city) && (mb_strlen($city) > 255)) { + throw new \InvalidArgumentException('invalid length for $city when calling BillingInformation., must be smaller than or equal to 255.'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets province_state + * + * @return string|null + */ + public function getProvinceState() + { + return $this->container['province_state']; + } + + /** + * Sets province_state + * + * @param string|null $province_state province_state + * + * @return self + */ + public function setProvinceState($province_state) + { + if (is_null($province_state)) { + array_push($this->openAPINullablesSetToNull, 'province_state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('province_state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($province_state) && (mb_strlen($province_state) > 255)) { + throw new \InvalidArgumentException('invalid length for $province_state when calling BillingInformation., must be smaller than or equal to 255.'); + } + + $this->container['province_state'] = $province_state; + + return $this; + } + + /** + * Gets postal_code + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string|null $postal_code postal_code + * + * @return self + */ + public function setPostalCode($postal_code) + { + if (is_null($postal_code)) { + array_push($this->openAPINullablesSetToNull, 'postal_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postal_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($postal_code) && (mb_strlen($postal_code) > 255)) { + throw new \InvalidArgumentException('invalid length for $postal_code when calling BillingInformation., must be smaller than or equal to 255.'); + } + + $this->container['postal_code'] = $postal_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/Card.php b/lib/PaymentMethod/Card.php new file mode 100644 index 0000000..d887e8b --- /dev/null +++ b/lib/PaymentMethod/Card.php @@ -0,0 +1,532 @@ + + */ +class Card implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Card'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'channel_properties' => '\Xendit\PaymentMethod\CardChannelProperties', + 'card_information' => '\Xendit\PaymentMethod\TokenizedCardInformation', + 'card_verification_results' => '\Xendit\PaymentMethod\CardVerificationResults' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'channel_properties' => null, + 'card_information' => null, + 'card_verification_results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => true, + 'channel_properties' => true, + 'card_information' => false, + 'card_verification_results' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'channel_properties' => 'channel_properties', + 'card_information' => 'card_information', + 'card_verification_results' => 'card_verification_results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'channel_properties' => 'setChannelProperties', + 'card_information' => 'setCardInformation', + 'card_verification_results' => 'setCardVerificationResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'channel_properties' => 'getChannelProperties', + 'card_information' => 'getCardInformation', + 'card_verification_results' => 'getCardVerificationResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('card_information', $data ?? [], null); + $this->setIfExists('card_verification_results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\CardChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\CardChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets card_information + * + * @return \PaymentMethod\TokenizedCardInformation|null + */ + public function getCardInformation() + { + return $this->container['card_information']; + } + + /** + * Sets card_information + * + * @param \PaymentMethod\TokenizedCardInformation|null $card_information card_information + * + * @return self + */ + public function setCardInformation($card_information) + { + if (is_null($card_information)) { + throw new \InvalidArgumentException('non-nullable card_information cannot be null'); + } + $this->container['card_information'] = $card_information; + + return $this; + } + + /** + * Gets card_verification_results + * + * @return \PaymentMethod\CardVerificationResults|null + */ + public function getCardVerificationResults() + { + return $this->container['card_verification_results']; + } + + /** + * Sets card_verification_results + * + * @param \PaymentMethod\CardVerificationResults|null $card_verification_results card_verification_results + * + * @return self + */ + public function setCardVerificationResults($card_verification_results) + { + if (is_null($card_verification_results)) { + array_push($this->openAPINullablesSetToNull, 'card_verification_results'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_verification_results', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_verification_results'] = $card_verification_results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CardChannelProperties.php b/lib/PaymentMethod/CardChannelProperties.php new file mode 100644 index 0000000..ee985c8 --- /dev/null +++ b/lib/PaymentMethod/CardChannelProperties.php @@ -0,0 +1,587 @@ + + */ +class CardChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'skip_three_d_secure' => 'bool', + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cardonfile_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'skip_three_d_secure' => null, + 'success_return_url' => null, + 'failure_return_url' => null, + 'cardonfile_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'skip_three_d_secure' => true, + 'success_return_url' => true, + 'failure_return_url' => true, + 'cardonfile_type' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'skip_three_d_secure' => 'skip_three_d_secure', + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cardonfile_type' => 'cardonfile_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'skip_three_d_secure' => 'setSkipThreeDSecure', + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cardonfile_type' => 'setCardonfileType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'skip_three_d_secure' => 'getSkipThreeDSecure', + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cardonfile_type' => 'getCardonfileType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CARDONFILE_TYPE_MERCHANT_UNSCHEDULED = 'MERCHANT_UNSCHEDULED'; + public const CARDONFILE_TYPE_CUSTOMER_UNSCHEDULED = 'CUSTOMER_UNSCHEDULED'; + public const CARDONFILE_TYPE_RECURRING = 'RECURRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCardonfileTypeAllowableValues() + { + return [ + self::CARDONFILE_TYPE_MERCHANT_UNSCHEDULED, + self::CARDONFILE_TYPE_CUSTOMER_UNSCHEDULED, + self::CARDONFILE_TYPE_RECURRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('skip_three_d_secure', $data ?? [], null); + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cardonfile_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + $allowedValues = $this->getCardonfileTypeAllowableValues(); + if (!is_null($this->container['cardonfile_type']) && !in_array($this->container['cardonfile_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'cardonfile_type', must be one of '%s'", + $this->container['cardonfile_type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets skip_three_d_secure + * + * @return bool|null + */ + public function getSkipThreeDSecure() + { + return $this->container['skip_three_d_secure']; + } + + /** + * Sets skip_three_d_secure + * + * @param bool|null $skip_three_d_secure This field value is only being used for reusability = MULTIPLE_USE. To indicate whether to perform 3DS during the linking phase. Defaults to false. + * + * @return self + */ + public function setSkipThreeDSecure($skip_three_d_secure) + { + if (is_null($skip_three_d_secure)) { + array_push($this->openAPINullablesSetToNull, 'skip_three_d_secure'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skip_three_d_secure', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skip_three_d_secure'] = $skip_three_d_secure; + + return $this; + } + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + array_push($this->openAPINullablesSetToNull, 'success_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('success_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($success_return_url) && (!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling CardChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + array_push($this->openAPINullablesSetToNull, 'failure_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($failure_return_url) && (!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling CardChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cardonfile_type + * + * @return string|null + */ + public function getCardonfileType() + { + return $this->container['cardonfile_type']; + } + + /** + * Sets cardonfile_type + * + * @param string|null $cardonfile_type Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. + * + * @return self + */ + public function setCardonfileType($cardonfile_type) + { + if (is_null($cardonfile_type)) { + array_push($this->openAPINullablesSetToNull, 'cardonfile_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardonfile_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCardonfileTypeAllowableValues(); + if (!is_null($cardonfile_type) && !in_array($cardonfile_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'cardonfile_type', must be one of '%s'", + $cardonfile_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['cardonfile_type'] = $cardonfile_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CardParameters.php b/lib/PaymentMethod/CardParameters.php new file mode 100644 index 0000000..6adcac4 --- /dev/null +++ b/lib/PaymentMethod/CardParameters.php @@ -0,0 +1,480 @@ + + */ +class CardParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'channel_properties' => '\Xendit\PaymentMethod\CardChannelProperties', + 'card_information' => '\Xendit\PaymentMethod\CardParametersCardInformation' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'channel_properties' => null, + 'card_information' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'channel_properties' => true, + 'card_information' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'channel_properties' => 'channel_properties', + 'card_information' => 'card_information' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'channel_properties' => 'setChannelProperties', + 'card_information' => 'setCardInformation' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'channel_properties' => 'getChannelProperties', + 'card_information' => 'getCardInformation' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('card_information', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\CardChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\CardChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets card_information + * + * @return \PaymentMethod\CardParametersCardInformation|null + */ + public function getCardInformation() + { + return $this->container['card_information']; + } + + /** + * Sets card_information + * + * @param \PaymentMethod\CardParametersCardInformation|null $card_information card_information + * + * @return self + */ + public function setCardInformation($card_information) + { + if (is_null($card_information)) { + throw new \InvalidArgumentException('non-nullable card_information cannot be null'); + } + $this->container['card_information'] = $card_information; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CardParametersCardInformation.php b/lib/PaymentMethod/CardParametersCardInformation.php new file mode 100644 index 0000000..d33cbb5 --- /dev/null +++ b/lib/PaymentMethod/CardParametersCardInformation.php @@ -0,0 +1,562 @@ + + */ +class CardParametersCardInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardParameters_card_information'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'card_number' => 'string', + 'expiry_month' => 'string', + 'expiry_year' => 'string', + 'cardholder_name' => 'string', + 'cvv' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'card_number' => null, + 'expiry_month' => null, + 'expiry_year' => null, + 'cardholder_name' => null, + 'cvv' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'card_number' => false, + 'expiry_month' => false, + 'expiry_year' => false, + 'cardholder_name' => true, + 'cvv' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'card_number' => 'card_number', + 'expiry_month' => 'expiry_month', + 'expiry_year' => 'expiry_year', + 'cardholder_name' => 'cardholder_name', + 'cvv' => 'cvv' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'card_number' => 'setCardNumber', + 'expiry_month' => 'setExpiryMonth', + 'expiry_year' => 'setExpiryYear', + 'cardholder_name' => 'setCardholderName', + 'cvv' => 'setCvv' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'card_number' => 'getCardNumber', + 'expiry_month' => 'getExpiryMonth', + 'expiry_year' => 'getExpiryYear', + 'cardholder_name' => 'getCardholderName', + 'cvv' => 'getCvv' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('card_number', $data ?? [], null); + $this->setIfExists('expiry_month', $data ?? [], null); + $this->setIfExists('expiry_year', $data ?? [], null); + $this->setIfExists('cardholder_name', $data ?? [], null); + $this->setIfExists('cvv', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['card_number'] === null) { + $invalidProperties[] = "'card_number' can't be null"; + } + if ($this->container['expiry_month'] === null) { + $invalidProperties[] = "'expiry_month' can't be null"; + } + if ($this->container['expiry_year'] === null) { + $invalidProperties[] = "'expiry_year' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets card_number + * + * @return string + */ + public function getCardNumber() + { + return $this->container['card_number']; + } + + /** + * Sets card_number + * + * @param string $card_number card_number + * + * @return self + */ + public function setCardNumber($card_number) + { + if (is_null($card_number)) { + throw new \InvalidArgumentException('non-nullable card_number cannot be null'); + } + $this->container['card_number'] = $card_number; + + return $this; + } + + /** + * Gets expiry_month + * + * @return string + */ + public function getExpiryMonth() + { + return $this->container['expiry_month']; + } + + /** + * Sets expiry_month + * + * @param string $expiry_month Card expiry month in MM format + * + * @return self + */ + public function setExpiryMonth($expiry_month) + { + if (is_null($expiry_month)) { + throw new \InvalidArgumentException('non-nullable expiry_month cannot be null'); + } + $this->container['expiry_month'] = $expiry_month; + + return $this; + } + + /** + * Gets expiry_year + * + * @return string + */ + public function getExpiryYear() + { + return $this->container['expiry_year']; + } + + /** + * Sets expiry_year + * + * @param string $expiry_year Card expiry month in YY format + * + * @return self + */ + public function setExpiryYear($expiry_year) + { + if (is_null($expiry_year)) { + throw new \InvalidArgumentException('non-nullable expiry_year cannot be null'); + } + $this->container['expiry_year'] = $expiry_year; + + return $this; + } + + /** + * Gets cardholder_name + * + * @return string|null + */ + public function getCardholderName() + { + return $this->container['cardholder_name']; + } + + /** + * Sets cardholder_name + * + * @param string|null $cardholder_name Cardholder name + * + * @return self + */ + public function setCardholderName($cardholder_name) + { + if (is_null($cardholder_name)) { + array_push($this->openAPINullablesSetToNull, 'cardholder_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardholder_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardholder_name'] = $cardholder_name; + + return $this; + } + + /** + * Gets cvv + * + * @return string|null + */ + public function getCvv() + { + return $this->container['cvv']; + } + + /** + * Sets cvv + * + * @param string|null $cvv cvv + * + * @return self + */ + public function setCvv($cvv) + { + if (is_null($cvv)) { + array_push($this->openAPINullablesSetToNull, 'cvv'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cvv', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cvv'] = $cvv; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CardVerificationResults.php b/lib/PaymentMethod/CardVerificationResults.php new file mode 100644 index 0000000..0aa2d93 --- /dev/null +++ b/lib/PaymentMethod/CardVerificationResults.php @@ -0,0 +1,494 @@ + + */ +class CardVerificationResults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardVerificationResults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure' => '\Xendit\PaymentMethod\CardVerificationResultsThreeDSecure', + 'cvv_result' => 'string', + 'address_verification_result' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure' => null, + 'cvv_result' => null, + 'address_verification_result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure' => true, + 'cvv_result' => true, + 'address_verification_result' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure' => 'three_d_secure', + 'cvv_result' => 'cvv_result', + 'address_verification_result' => 'address_verification_result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure' => 'setThreeDSecure', + 'cvv_result' => 'setCvvResult', + 'address_verification_result' => 'setAddressVerificationResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure' => 'getThreeDSecure', + 'cvv_result' => 'getCvvResult', + 'address_verification_result' => 'getAddressVerificationResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure', $data ?? [], null); + $this->setIfExists('cvv_result', $data ?? [], null); + $this->setIfExists('address_verification_result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['three_d_secure'] === null) { + $invalidProperties[] = "'three_d_secure' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure + * + * @return \PaymentMethod\CardVerificationResultsThreeDSecure + */ + public function getThreeDSecure() + { + return $this->container['three_d_secure']; + } + + /** + * Sets three_d_secure + * + * @param \PaymentMethod\CardVerificationResultsThreeDSecure $three_d_secure three_d_secure + * + * @return self + */ + public function setThreeDSecure($three_d_secure) + { + if (is_null($three_d_secure)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure'] = $three_d_secure; + + return $this; + } + + /** + * Gets cvv_result + * + * @return string|null + */ + public function getCvvResult() + { + return $this->container['cvv_result']; + } + + /** + * Sets cvv_result + * + * @param string|null $cvv_result cvv_result + * + * @return self + */ + public function setCvvResult($cvv_result) + { + if (is_null($cvv_result)) { + array_push($this->openAPINullablesSetToNull, 'cvv_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cvv_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cvv_result'] = $cvv_result; + + return $this; + } + + /** + * Gets address_verification_result + * + * @return string|null + */ + public function getAddressVerificationResult() + { + return $this->container['address_verification_result']; + } + + /** + * Sets address_verification_result + * + * @param string|null $address_verification_result address_verification_result + * + * @return self + */ + public function setAddressVerificationResult($address_verification_result) + { + if (is_null($address_verification_result)) { + array_push($this->openAPINullablesSetToNull, 'address_verification_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address_verification_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address_verification_result'] = $address_verification_result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CardVerificationResultsThreeDSecure.php b/lib/PaymentMethod/CardVerificationResultsThreeDSecure.php new file mode 100644 index 0000000..0c641ba --- /dev/null +++ b/lib/PaymentMethod/CardVerificationResultsThreeDSecure.php @@ -0,0 +1,607 @@ + + */ +class CardVerificationResultsThreeDSecure implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardVerificationResultsThreeDSecure'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure_flow' => 'string', + 'eci_code' => 'string', + 'three_d_secure_result' => 'string', + 'three_d_secure_result_reason' => 'string', + 'three_d_secure_version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure_flow' => null, + 'eci_code' => null, + 'three_d_secure_result' => null, + 'three_d_secure_result_reason' => null, + 'three_d_secure_version' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure_flow' => true, + 'eci_code' => true, + 'three_d_secure_result' => true, + 'three_d_secure_result_reason' => true, + 'three_d_secure_version' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure_flow' => 'three_d_secure_flow', + 'eci_code' => 'eci_code', + 'three_d_secure_result' => 'three_d_secure_result', + 'three_d_secure_result_reason' => 'three_d_secure_result_reason', + 'three_d_secure_version' => 'three_d_secure_version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure_flow' => 'setThreeDSecureFlow', + 'eci_code' => 'setEciCode', + 'three_d_secure_result' => 'setThreeDSecureResult', + 'three_d_secure_result_reason' => 'setThreeDSecureResultReason', + 'three_d_secure_version' => 'setThreeDSecureVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure_flow' => 'getThreeDSecureFlow', + 'eci_code' => 'getEciCode', + 'three_d_secure_result' => 'getThreeDSecureResult', + 'three_d_secure_result_reason' => 'getThreeDSecureResultReason', + 'three_d_secure_version' => 'getThreeDSecureVersion' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const THREE_D_SECURE_FLOW_CHALLENGE = 'CHALLENGE'; + public const THREE_D_SECURE_FLOW_FRICTIONLESS = 'FRICTIONLESS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getThreeDSecureFlowAllowableValues() + { + return [ + self::THREE_D_SECURE_FLOW_CHALLENGE, + self::THREE_D_SECURE_FLOW_FRICTIONLESS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure_flow', $data ?? [], null); + $this->setIfExists('eci_code', $data ?? [], null); + $this->setIfExists('three_d_secure_result', $data ?? [], null); + $this->setIfExists('three_d_secure_result_reason', $data ?? [], null); + $this->setIfExists('three_d_secure_version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getThreeDSecureFlowAllowableValues(); + if (!is_null($this->container['three_d_secure_flow']) && !in_array($this->container['three_d_secure_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'three_d_secure_flow', must be one of '%s'", + $this->container['three_d_secure_flow'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure_flow + * + * @return string|null + */ + public function getThreeDSecureFlow() + { + return $this->container['three_d_secure_flow']; + } + + /** + * Sets three_d_secure_flow + * + * @param string|null $three_d_secure_flow three_d_secure_flow + * + * @return self + */ + public function setThreeDSecureFlow($three_d_secure_flow) + { + if (is_null($three_d_secure_flow)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_flow'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_flow', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getThreeDSecureFlowAllowableValues(); + if (!is_null($three_d_secure_flow) && !in_array($three_d_secure_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'three_d_secure_flow', must be one of '%s'", + $three_d_secure_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['three_d_secure_flow'] = $three_d_secure_flow; + + return $this; + } + + /** + * Gets eci_code + * + * @return string|null + */ + public function getEciCode() + { + return $this->container['eci_code']; + } + + /** + * Sets eci_code + * + * @param string|null $eci_code eci_code + * + * @return self + */ + public function setEciCode($eci_code) + { + if (is_null($eci_code)) { + array_push($this->openAPINullablesSetToNull, 'eci_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('eci_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['eci_code'] = $eci_code; + + return $this; + } + + /** + * Gets three_d_secure_result + * + * @return string|null + */ + public function getThreeDSecureResult() + { + return $this->container['three_d_secure_result']; + } + + /** + * Sets three_d_secure_result + * + * @param string|null $three_d_secure_result three_d_secure_result + * + * @return self + */ + public function setThreeDSecureResult($three_d_secure_result) + { + if (is_null($three_d_secure_result)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_result'] = $three_d_secure_result; + + return $this; + } + + /** + * Gets three_d_secure_result_reason + * + * @return string|null + */ + public function getThreeDSecureResultReason() + { + return $this->container['three_d_secure_result_reason']; + } + + /** + * Sets three_d_secure_result_reason + * + * @param string|null $three_d_secure_result_reason three_d_secure_result_reason + * + * @return self + */ + public function setThreeDSecureResultReason($three_d_secure_result_reason) + { + if (is_null($three_d_secure_result_reason)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_result_reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_result_reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_result_reason'] = $three_d_secure_result_reason; + + return $this; + } + + /** + * Gets three_d_secure_version + * + * @return string|null + */ + public function getThreeDSecureVersion() + { + return $this->container['three_d_secure_version']; + } + + /** + * Sets three_d_secure_version + * + * @param string|null $three_d_secure_version three_d_secure_version + * + * @return self + */ + public function setThreeDSecureVersion($three_d_secure_version) + { + if (is_null($three_d_secure_version)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_version'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_version', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_version'] = $three_d_secure_version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/ChannelAmountLimits.php b/lib/PaymentMethod/ChannelAmountLimits.php new file mode 100644 index 0000000..88b288a --- /dev/null +++ b/lib/PaymentMethod/ChannelAmountLimits.php @@ -0,0 +1,470 @@ + + */ +class ChannelAmountLimits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelAmountLimits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'min_limit' => 'float', + 'max_limit' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'min_limit' => null, + 'max_limit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'min_limit' => false, + 'max_limit' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'min_limit' => 'min_limit', + 'max_limit' => 'max_limit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'min_limit' => 'setMinLimit', + 'max_limit' => 'setMaxLimit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'min_limit' => 'getMinLimit', + 'max_limit' => 'getMaxLimit' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('min_limit', $data ?? [], null); + $this->setIfExists('max_limit', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency supported by the payment channel + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets min_limit + * + * @return float|null + */ + public function getMinLimit() + { + return $this->container['min_limit']; + } + + /** + * Sets min_limit + * + * @param float|null $min_limit The minimum allowed transaction amount for the payment channel + * + * @return self + */ + public function setMinLimit($min_limit) + { + if (is_null($min_limit)) { + throw new \InvalidArgumentException('non-nullable min_limit cannot be null'); + } + $this->container['min_limit'] = $min_limit; + + return $this; + } + + /** + * Gets max_limit + * + * @return float|null + */ + public function getMaxLimit() + { + return $this->container['max_limit']; + } + + /** + * Sets max_limit + * + * @param float|null $max_limit The minimum allowed transaction amount for the payment channel + * + * @return self + */ + public function setMaxLimit($max_limit) + { + if (is_null($max_limit)) { + throw new \InvalidArgumentException('non-nullable max_limit cannot be null'); + } + $this->container['max_limit'] = $max_limit; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/ChannelAmountLimitsAllOf.php b/lib/PaymentMethod/ChannelAmountLimitsAllOf.php new file mode 100644 index 0000000..1d09915 --- /dev/null +++ b/lib/PaymentMethod/ChannelAmountLimitsAllOf.php @@ -0,0 +1,471 @@ + + */ +class ChannelAmountLimitsAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelAmountLimits_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'min_limit' => 'float', + 'max_limit' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'min_limit' => null, + 'max_limit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'min_limit' => false, + 'max_limit' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'min_limit' => 'min_limit', + 'max_limit' => 'max_limit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'min_limit' => 'setMinLimit', + 'max_limit' => 'setMaxLimit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'min_limit' => 'getMinLimit', + 'max_limit' => 'getMaxLimit' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('min_limit', $data ?? [], null); + $this->setIfExists('max_limit', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency supported by the payment channel + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets min_limit + * + * @return float|null + */ + public function getMinLimit() + { + return $this->container['min_limit']; + } + + /** + * Sets min_limit + * + * @param float|null $min_limit The minimum allowed transaction amount for the payment channel + * + * @return self + */ + public function setMinLimit($min_limit) + { + if (is_null($min_limit)) { + throw new \InvalidArgumentException('non-nullable min_limit cannot be null'); + } + $this->container['min_limit'] = $min_limit; + + return $this; + } + + /** + * Gets max_limit + * + * @return float|null + */ + public function getMaxLimit() + { + return $this->container['max_limit']; + } + + /** + * Sets max_limit + * + * @param float|null $max_limit The minimum allowed transaction amount for the payment channel + * + * @return self + */ + public function setMaxLimit($max_limit) + { + if (is_null($max_limit)) { + throw new \InvalidArgumentException('non-nullable max_limit cannot be null'); + } + $this->container['max_limit'] = $max_limit; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/ChannelProperty.php b/lib/PaymentMethod/ChannelProperty.php new file mode 100644 index 0000000..911e3f2 --- /dev/null +++ b/lib/PaymentMethod/ChannelProperty.php @@ -0,0 +1,470 @@ + + */ +class ChannelProperty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelProperty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'type' => 'string', + 'is_required' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'type' => null, + 'is_required' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'type' => false, + 'is_required' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'type' => 'type', + 'is_required' => 'is_required' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'type' => 'setType', + 'is_required' => 'setIsRequired' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'type' => 'getType', + 'is_required' => 'getIsRequired' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('is_required', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The corresponding parameter name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Data type of the parameter + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets is_required + * + * @return bool|null + */ + public function getIsRequired() + { + return $this->container['is_required']; + } + + /** + * Sets is_required + * + * @param bool|null $is_required Indicates whether or not the parameter is required + * + * @return self + */ + public function setIsRequired($is_required) + { + if (is_null($is_required)) { + throw new \InvalidArgumentException('non-nullable is_required cannot be null'); + } + $this->container['is_required'] = $is_required; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/ChannelPropertyAllOf.php b/lib/PaymentMethod/ChannelPropertyAllOf.php new file mode 100644 index 0000000..f0a6fea --- /dev/null +++ b/lib/PaymentMethod/ChannelPropertyAllOf.php @@ -0,0 +1,471 @@ + + */ +class ChannelPropertyAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelProperty_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'type' => 'string', + 'is_required' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'type' => null, + 'is_required' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'type' => false, + 'is_required' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'type' => 'type', + 'is_required' => 'is_required' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'type' => 'setType', + 'is_required' => 'setIsRequired' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'type' => 'getType', + 'is_required' => 'getIsRequired' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('is_required', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The corresponding parameter name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Data type of the parameter + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets is_required + * + * @return bool|null + */ + public function getIsRequired() + { + return $this->container['is_required']; + } + + /** + * Sets is_required + * + * @param bool|null $is_required Indicates whether or not the parameter is required + * + * @return self + */ + public function setIsRequired($is_required) + { + if (is_null($is_required)) { + throw new \InvalidArgumentException('non-nullable is_required cannot be null'); + } + $this->container['is_required'] = $is_required; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CreatePaymentMethod409Response.php b/lib/PaymentMethod/CreatePaymentMethod409Response.php new file mode 100644 index 0000000..2c06d1d --- /dev/null +++ b/lib/PaymentMethod/CreatePaymentMethod409Response.php @@ -0,0 +1,474 @@ + + */ +class CreatePaymentMethod409Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createPaymentMethod_409_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_PAYMENT_METHOD_ALREADY_ACTIVE = 'PAYMENT_METHOD_ALREADY_ACTIVE'; + public const ERROR_CODE_PAYMENT_METHOD_ALREADY_FAILED = 'PAYMENT_METHOD_ALREADY_FAILED'; + public const ERROR_CODE_DUPLICATE_ERROR = 'DUPLICATE_ERROR'; + public const ERROR_CODE_IDEMPOTENCY_ERROR = 'IDEMPOTENCY_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_PAYMENT_METHOD_ALREADY_ACTIVE, + self::ERROR_CODE_PAYMENT_METHOD_ALREADY_FAILED, + self::ERROR_CODE_DUPLICATE_ERROR, + self::ERROR_CODE_IDEMPOTENCY_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/CreatePaymentMethod503Response.php b/lib/PaymentMethod/CreatePaymentMethod503Response.php new file mode 100644 index 0000000..0e42211 --- /dev/null +++ b/lib/PaymentMethod/CreatePaymentMethod503Response.php @@ -0,0 +1,470 @@ + + */ +class CreatePaymentMethod503Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createPaymentMethod_503_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_CHANNEL_UNAVAILABLE = 'CHANNEL_UNAVAILABLE'; + public const ERROR_CODE_OTP_DELIVERY_ERROR = 'OTP_DELIVERY_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_CHANNEL_UNAVAILABLE, + self::ERROR_CODE_OTP_DELIVERY_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebit.php b/lib/PaymentMethod/DirectDebit.php new file mode 100644 index 0000000..771cccf --- /dev/null +++ b/lib/PaymentMethod/DirectDebit.php @@ -0,0 +1,569 @@ + + */ +class DirectDebit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentMethod\DirectDebitChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\DirectDebitChannelProperties', + 'type' => '\Xendit\PaymentMethod\DirectDebitType', + 'bank_account' => '\Xendit\PaymentMethod\DirectDebitBankAccount', + 'debit_card' => '\Xendit\PaymentMethod\DirectDebitDebitCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'type' => null, + 'bank_account' => null, + 'debit_card' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => true, + 'type' => false, + 'bank_account' => true, + 'debit_card' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'type' => 'type', + 'bank_account' => 'bank_account', + 'debit_card' => 'debit_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'type' => 'setType', + 'bank_account' => 'setBankAccount', + 'debit_card' => 'setDebitCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'type' => 'getType', + 'bank_account' => 'getBankAccount', + 'debit_card' => 'getDebitCard' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('bank_account', $data ?? [], null); + $this->setIfExists('debit_card', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentMethod\DirectDebitChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\DirectDebitChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\DirectDebitChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\DirectDebitChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets type + * + * @return \PaymentMethod\DirectDebitType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentMethod\DirectDebitType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets bank_account + * + * @return \PaymentMethod\DirectDebitBankAccount|null + */ + public function getBankAccount() + { + return $this->container['bank_account']; + } + + /** + * Sets bank_account + * + * @param \PaymentMethod\DirectDebitBankAccount|null $bank_account bank_account + * + * @return self + */ + public function setBankAccount($bank_account) + { + if (is_null($bank_account)) { + array_push($this->openAPINullablesSetToNull, 'bank_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account'] = $bank_account; + + return $this; + } + + /** + * Gets debit_card + * + * @return \PaymentMethod\DirectDebitDebitCard|null + */ + public function getDebitCard() + { + return $this->container['debit_card']; + } + + /** + * Sets debit_card + * + * @param \PaymentMethod\DirectDebitDebitCard|null $debit_card debit_card + * + * @return self + */ + public function setDebitCard($debit_card) + { + if (is_null($debit_card)) { + array_push($this->openAPINullablesSetToNull, 'debit_card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('debit_card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['debit_card'] = $debit_card; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitAllOf.php b/lib/PaymentMethod/DirectDebitAllOf.php new file mode 100644 index 0000000..ceb6cc1 --- /dev/null +++ b/lib/PaymentMethod/DirectDebitAllOf.php @@ -0,0 +1,487 @@ + + */ +class DirectDebitAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebit_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Xendit\PaymentMethod\DirectDebitType', + 'bank_account' => '\Xendit\PaymentMethod\DirectDebitBankAccount', + 'debit_card' => '\Xendit\PaymentMethod\DirectDebitDebitCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'bank_account' => null, + 'debit_card' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'bank_account' => true, + 'debit_card' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'bank_account' => 'bank_account', + 'debit_card' => 'debit_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'bank_account' => 'setBankAccount', + 'debit_card' => 'setDebitCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'bank_account' => 'getBankAccount', + 'debit_card' => 'getDebitCard' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('bank_account', $data ?? [], null); + $this->setIfExists('debit_card', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \PaymentMethod\DirectDebitType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentMethod\DirectDebitType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets bank_account + * + * @return \PaymentMethod\DirectDebitBankAccount|null + */ + public function getBankAccount() + { + return $this->container['bank_account']; + } + + /** + * Sets bank_account + * + * @param \PaymentMethod\DirectDebitBankAccount|null $bank_account bank_account + * + * @return self + */ + public function setBankAccount($bank_account) + { + if (is_null($bank_account)) { + array_push($this->openAPINullablesSetToNull, 'bank_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account'] = $bank_account; + + return $this; + } + + /** + * Gets debit_card + * + * @return \PaymentMethod\DirectDebitDebitCard|null + */ + public function getDebitCard() + { + return $this->container['debit_card']; + } + + /** + * Sets debit_card + * + * @param \PaymentMethod\DirectDebitDebitCard|null $debit_card debit_card + * + * @return self + */ + public function setDebitCard($debit_card) + { + if (is_null($debit_card)) { + array_push($this->openAPINullablesSetToNull, 'debit_card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('debit_card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['debit_card'] = $debit_card; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitBankAccount.php b/lib/PaymentMethod/DirectDebitBankAccount.php new file mode 100644 index 0000000..38eda9f --- /dev/null +++ b/lib/PaymentMethod/DirectDebitBankAccount.php @@ -0,0 +1,532 @@ + + */ +class DirectDebitBankAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitBankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'masked_bank_account_number' => 'string', + 'bank_account_hash' => 'string', + 'mobile_number' => 'string', + 'identity_document_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'masked_bank_account_number' => null, + 'bank_account_hash' => null, + 'mobile_number' => null, + 'identity_document_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'masked_bank_account_number' => true, + 'bank_account_hash' => true, + 'mobile_number' => true, + 'identity_document_number' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'masked_bank_account_number' => 'masked_bank_account_number', + 'bank_account_hash' => 'bank_account_hash', + 'mobile_number' => 'mobile_number', + 'identity_document_number' => 'identity_document_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'masked_bank_account_number' => 'setMaskedBankAccountNumber', + 'bank_account_hash' => 'setBankAccountHash', + 'mobile_number' => 'setMobileNumber', + 'identity_document_number' => 'setIdentityDocumentNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'masked_bank_account_number' => 'getMaskedBankAccountNumber', + 'bank_account_hash' => 'getBankAccountHash', + 'mobile_number' => 'getMobileNumber', + 'identity_document_number' => 'getIdentityDocumentNumber' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('masked_bank_account_number', $data ?? [], null); + $this->setIfExists('bank_account_hash', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('identity_document_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets masked_bank_account_number + * + * @return string|null + */ + public function getMaskedBankAccountNumber() + { + return $this->container['masked_bank_account_number']; + } + + /** + * Sets masked_bank_account_number + * + * @param string|null $masked_bank_account_number masked_bank_account_number + * + * @return self + */ + public function setMaskedBankAccountNumber($masked_bank_account_number) + { + if (is_null($masked_bank_account_number)) { + array_push($this->openAPINullablesSetToNull, 'masked_bank_account_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('masked_bank_account_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['masked_bank_account_number'] = $masked_bank_account_number; + + return $this; + } + + /** + * Gets bank_account_hash + * + * @return string|null + */ + public function getBankAccountHash() + { + return $this->container['bank_account_hash']; + } + + /** + * Sets bank_account_hash + * + * @param string|null $bank_account_hash bank_account_hash + * + * @return self + */ + public function setBankAccountHash($bank_account_hash) + { + if (is_null($bank_account_hash)) { + array_push($this->openAPINullablesSetToNull, 'bank_account_hash'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account_hash', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account_hash'] = $bank_account_hash; + + return $this; + } + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + array_push($this->openAPINullablesSetToNull, 'mobile_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets identity_document_number + * + * @return string|null + */ + public function getIdentityDocumentNumber() + { + return $this->container['identity_document_number']; + } + + /** + * Sets identity_document_number + * + * @param string|null $identity_document_number Identity number of the customer registered to the partner channel + * + * @return self + */ + public function setIdentityDocumentNumber($identity_document_number) + { + if (is_null($identity_document_number)) { + array_push($this->openAPINullablesSetToNull, 'identity_document_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('identity_document_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['identity_document_number'] = $identity_document_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitChannelCode.php b/lib/PaymentMethod/DirectDebitChannelCode.php new file mode 100644 index 0000000..df53d59 --- /dev/null +++ b/lib/PaymentMethod/DirectDebitChannelCode.php @@ -0,0 +1,262 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum DirectDebitChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BCA_KLIKPAY, + self::BCA_ONEKLIK, + self::BDO, + self::BPI, + self::BRI, + self::BNI, + self::CHINABANK, + self::CIMBNIAGA, + self::MTB, + self::RCBC, + self::UBP, + self::MANDIRI, + self::BBL, + self::SCB, + self::KTB, + self::BAY, + self::KBANK_MB, + self::BAY_MB, + self::KTB_MB, + self::BBL_MB, + self::SCB_MB, + self::BDO_EPAY, + self::AUTODEBIT_UBP, + self::AFFIN_FPX, + self::AGRO_FPX, + self::ALLIANCE_FPX, + self::AMBANK_FPX, + self::ISLAM_FPX, + self::MUAMALAT_FPX, + self::BOC_FPX, + self::RAKYAT_FPX, + self::BSN_FPX, + self::CIMB_FPX, + self::HLB_FPX, + self::HSBC_FPX, + self::KFH_FPX, + self::MAYB2_E_FPX, + self::MAYB2_U_FPX, + self::OCBC_FPX, + self::PUBLIC_FPX, + self::RHB_FPX, + self::SCH_FPX, + self::UOB_FPX, + self::AFFIN_FPX_BUSINESS, + self::AGRO_FPX_BUSINESS, + self::ALLIANCE_FPX_BUSINESS, + self::AMBANK_FPX_BUSINESS, + self::ISLAM_FPX_BUSINESS, + self::MUAMALAT_FPX_BUSINESS, + self::BNP_FPX_BUSINESS, + self::CIMB_FPX_BUSINESS, + self::CITIBANK_FPX_BUSINESS, + self::DEUTSCHE_FPX_BUSINESS, + self::HLB_FPX_BUSINESS, + self::HSBC_FPX_BUSINESS, + self::RAKYAT_FPX_BUSINESS, + self::KFH_FPX_BUSINESS, + self::MAYB2_E_FPX_BUSINESS, + self::OCBC_FPX_BUSINESS, + self::PUBLIC_FPX_BUSINESS, + self::RHB_FPX_BUSINESS, + self::SCH_FPX_BUSINESS, + self::UOB_FPX_BUSINESS + ]; + } +} + + diff --git a/lib/PaymentMethod/DirectDebitChannelProperties.php b/lib/PaymentMethod/DirectDebitChannelProperties.php new file mode 100644 index 0000000..bee0e81 --- /dev/null +++ b/lib/PaymentMethod/DirectDebitChannelProperties.php @@ -0,0 +1,690 @@ + + */ +class DirectDebitChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'mobile_number' => 'string', + 'card_last_four' => 'string', + 'card_expiry' => 'string', + 'email' => 'string', + 'identity_document_number' => 'string', + 'require_auth' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => 'uri', + 'failure_return_url' => 'uri', + 'mobile_number' => null, + 'card_last_four' => null, + 'card_expiry' => null, + 'email' => null, + 'identity_document_number' => null, + 'require_auth' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => true, + 'mobile_number' => true, + 'card_last_four' => true, + 'card_expiry' => true, + 'email' => true, + 'identity_document_number' => true, + 'require_auth' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'mobile_number' => 'mobile_number', + 'card_last_four' => 'card_last_four', + 'card_expiry' => 'card_expiry', + 'email' => 'email', + 'identity_document_number' => 'identity_document_number', + 'require_auth' => 'require_auth' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'mobile_number' => 'setMobileNumber', + 'card_last_four' => 'setCardLastFour', + 'card_expiry' => 'setCardExpiry', + 'email' => 'setEmail', + 'identity_document_number' => 'setIdentityDocumentNumber', + 'require_auth' => 'setRequireAuth' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'mobile_number' => 'getMobileNumber', + 'card_last_four' => 'getCardLastFour', + 'card_expiry' => 'getCardExpiry', + 'email' => 'getEmail', + 'identity_document_number' => 'getIdentityDocumentNumber', + 'require_auth' => 'getRequireAuth' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('card_last_four', $data ?? [], null); + $this->setIfExists('card_expiry', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('identity_document_number', $data ?? [], null); + $this->setIfExists('require_auth', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url success_return_url + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url failure_return_url + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + array_push($this->openAPINullablesSetToNull, 'failure_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + array_push($this->openAPINullablesSetToNull, 'mobile_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets card_last_four + * + * @return string|null + */ + public function getCardLastFour() + { + return $this->container['card_last_four']; + } + + /** + * Sets card_last_four + * + * @param string|null $card_last_four Last four digits of the debit card + * + * @return self + */ + public function setCardLastFour($card_last_four) + { + if (is_null($card_last_four)) { + array_push($this->openAPINullablesSetToNull, 'card_last_four'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_last_four', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_last_four'] = $card_last_four; + + return $this; + } + + /** + * Gets card_expiry + * + * @return string|null + */ + public function getCardExpiry() + { + return $this->container['card_expiry']; + } + + /** + * Sets card_expiry + * + * @param string|null $card_expiry Expiry month and year of the debit card (in MM/YY format) + * + * @return self + */ + public function setCardExpiry($card_expiry) + { + if (is_null($card_expiry)) { + array_push($this->openAPINullablesSetToNull, 'card_expiry'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_expiry', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_expiry'] = $card_expiry; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the customer that is registered to the partner channel + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets identity_document_number + * + * @return string|null + */ + public function getIdentityDocumentNumber() + { + return $this->container['identity_document_number']; + } + + /** + * Sets identity_document_number + * + * @param string|null $identity_document_number Identity number of the customer registered to the partner channel + * + * @return self + */ + public function setIdentityDocumentNumber($identity_document_number) + { + if (is_null($identity_document_number)) { + array_push($this->openAPINullablesSetToNull, 'identity_document_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('identity_document_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['identity_document_number'] = $identity_document_number; + + return $this; + } + + /** + * Gets require_auth + * + * @return bool|null + */ + public function getRequireAuth() + { + return $this->container['require_auth']; + } + + /** + * Sets require_auth + * + * @param bool|null $require_auth require_auth + * + * @return self + */ + public function setRequireAuth($require_auth) + { + if (is_null($require_auth)) { + array_push($this->openAPINullablesSetToNull, 'require_auth'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('require_auth', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['require_auth'] = $require_auth; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitDebitCard.php b/lib/PaymentMethod/DirectDebitDebitCard.php new file mode 100644 index 0000000..b485558 --- /dev/null +++ b/lib/PaymentMethod/DirectDebitDebitCard.php @@ -0,0 +1,532 @@ + + */ +class DirectDebitDebitCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitDebitCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mobile_number' => 'string', + 'card_last_four' => 'string', + 'card_expiry' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mobile_number' => null, + 'card_last_four' => null, + 'card_expiry' => null, + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mobile_number' => true, + 'card_last_four' => true, + 'card_expiry' => true, + 'email' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mobile_number' => 'mobile_number', + 'card_last_four' => 'card_last_four', + 'card_expiry' => 'card_expiry', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mobile_number' => 'setMobileNumber', + 'card_last_four' => 'setCardLastFour', + 'card_expiry' => 'setCardExpiry', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mobile_number' => 'getMobileNumber', + 'card_last_four' => 'getCardLastFour', + 'card_expiry' => 'getCardExpiry', + 'email' => 'getEmail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('card_last_four', $data ?? [], null); + $this->setIfExists('card_expiry', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + array_push($this->openAPINullablesSetToNull, 'mobile_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets card_last_four + * + * @return string|null + */ + public function getCardLastFour() + { + return $this->container['card_last_four']; + } + + /** + * Sets card_last_four + * + * @param string|null $card_last_four Last four digits of the debit card + * + * @return self + */ + public function setCardLastFour($card_last_four) + { + if (is_null($card_last_four)) { + array_push($this->openAPINullablesSetToNull, 'card_last_four'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_last_four', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_last_four'] = $card_last_four; + + return $this; + } + + /** + * Gets card_expiry + * + * @return string|null + */ + public function getCardExpiry() + { + return $this->container['card_expiry']; + } + + /** + * Sets card_expiry + * + * @param string|null $card_expiry Expiry month and year of the debit card (in MM/YY format) + * + * @return self + */ + public function setCardExpiry($card_expiry) + { + if (is_null($card_expiry)) { + array_push($this->openAPINullablesSetToNull, 'card_expiry'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_expiry', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_expiry'] = $card_expiry; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the customer that is registered to the partner channel + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitParameters.php b/lib/PaymentMethod/DirectDebitParameters.php new file mode 100644 index 0000000..f7c2b6e --- /dev/null +++ b/lib/PaymentMethod/DirectDebitParameters.php @@ -0,0 +1,449 @@ + + */ +class DirectDebitParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentMethod\DirectDebitChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\DirectDebitChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentMethod\DirectDebitChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\DirectDebitChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\DirectDebitChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\DirectDebitChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/DirectDebitType.php b/lib/PaymentMethod/DirectDebitType.php new file mode 100644 index 0000000..59f81b8 --- /dev/null +++ b/lib/PaymentMethod/DirectDebitType.php @@ -0,0 +1,81 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum DirectDebitType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::DEBIT_CARD, + self::BANK_ACCOUNT, + self::BANK_REDIRECT + ]; + } +} + + diff --git a/lib/PaymentMethod/EWallet.php b/lib/PaymentMethod/EWallet.php new file mode 100644 index 0000000..ed207a0 --- /dev/null +++ b/lib/PaymentMethod/EWallet.php @@ -0,0 +1,474 @@ + + */ +class EWallet implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWallet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentMethod\EWalletChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\EWalletChannelProperties', + 'account' => '\Xendit\PaymentMethod\EWalletAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => false, + 'account' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'account' => 'account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'account' => 'setAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'account' => 'getAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentMethod\EWalletChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\EWalletChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\EWalletChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\EWalletChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets account + * + * @return \PaymentMethod\EWalletAccount|null + */ + public function getAccount() + { + return $this->container['account']; + } + + /** + * Sets account + * + * @param \PaymentMethod\EWalletAccount|null $account account + * + * @return self + */ + public function setAccount($account) + { + if (is_null($account)) { + throw new \InvalidArgumentException('non-nullable account cannot be null'); + } + $this->container['account'] = $account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/EWalletAccount.php b/lib/PaymentMethod/EWalletAccount.php new file mode 100644 index 0000000..9d0c9b8 --- /dev/null +++ b/lib/PaymentMethod/EWalletAccount.php @@ -0,0 +1,533 @@ + + */ +class EWalletAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'account_details' => 'string', + 'balance' => 'float', + 'point_balance' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'account_details' => null, + 'balance' => 'double', + 'point_balance' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'account_details' => true, + 'balance' => true, + 'point_balance' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'account_details' => 'account_details', + 'balance' => 'balance', + 'point_balance' => 'point_balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'account_details' => 'setAccountDetails', + 'balance' => 'setBalance', + 'point_balance' => 'setPointBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'account_details' => 'getAccountDetails', + 'balance' => 'getBalance', + 'point_balance' => 'getPointBalance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('account_details', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('point_balance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the eWallet account holder. The value is null if unavailableName of the eWallet account holder. The value is null if unavailable + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets account_details + * + * @return string|null + */ + public function getAccountDetails() + { + return $this->container['account_details']; + } + + /** + * Sets account_details + * + * @param string|null $account_details Identifier from eWallet provider e.g. phone number. The value is null if unavailable + * + * @return self + */ + public function setAccountDetails($account_details) + { + if (is_null($account_details)) { + array_push($this->openAPINullablesSetToNull, 'account_details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('account_details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['account_details'] = $account_details; + + return $this; + } + + /** + * Gets balance + * + * @return float|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param float|null $balance The main balance amount on eWallet account provided from eWallet provider. The value is null if unavailable + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets point_balance + * + * @return float|null + */ + public function getPointBalance() + { + return $this->container['point_balance']; + } + + /** + * Sets point_balance + * + * @param float|null $point_balance The point balance amount on eWallet account. Applicable only on some eWallet provider that has point system. The value is null if unavailabl + * + * @return self + */ + public function setPointBalance($point_balance) + { + if (is_null($point_balance)) { + array_push($this->openAPINullablesSetToNull, 'point_balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('point_balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['point_balance'] = $point_balance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/EWalletChannelCode.php b/lib/PaymentMethod/EWalletChannelCode.php new file mode 100644 index 0000000..3a01679 --- /dev/null +++ b/lib/PaymentMethod/EWalletChannelCode.php @@ -0,0 +1,121 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum EWalletChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::GCASH, + self::GRABPAY, + self::PAYMAYA, + self::OVO, + self::DANA, + self::LINKAJA, + self::SHOPEEPAY, + self::SAKUKU, + self::NEXCASH, + self::ASTRAPAY, + self::JENIUSPAY, + self::APPOTA, + self::MOMO, + self::VNPTWALLET, + self::VIETTELPAY, + self::ZALOPAY + ]; + } +} + + diff --git a/lib/PaymentMethod/EWalletChannelProperties.php b/lib/PaymentMethod/EWalletChannelProperties.php new file mode 100644 index 0000000..69402d1 --- /dev/null +++ b/lib/PaymentMethod/EWalletChannelProperties.php @@ -0,0 +1,609 @@ + + */ +class EWalletChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cancel_return_url' => 'string', + 'mobile_number' => 'string', + 'redeem_points' => 'string', + 'cashtag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => null, + 'failure_return_url' => null, + 'cancel_return_url' => null, + 'mobile_number' => null, + 'redeem_points' => null, + 'cashtag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => false, + 'cancel_return_url' => false, + 'mobile_number' => false, + 'redeem_points' => false, + 'cashtag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cancel_return_url' => 'cancel_return_url', + 'mobile_number' => 'mobile_number', + 'redeem_points' => 'redeem_points', + 'cashtag' => 'cashtag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cancel_return_url' => 'setCancelReturnUrl', + 'mobile_number' => 'setMobileNumber', + 'redeem_points' => 'setRedeemPoints', + 'cashtag' => 'setCashtag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cancel_return_url' => 'getCancelReturnUrl', + 'mobile_number' => 'getMobileNumber', + 'redeem_points' => 'getRedeemPoints', + 'cashtag' => 'getCashtag' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cancel_return_url', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('redeem_points', $data ?? [], null); + $this->setIfExists('cashtag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['cancel_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['cancel_return_url'])) { + $invalidProperties[] = "invalid value for 'cancel_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['cashtag']) && !preg_match("/^[$][a-zA-Z0-9_]{3,15}$/", $this->container['cashtag'])) { + $invalidProperties[] = "invalid value for 'cashtag', must be conform to the pattern /^[$][a-zA-Z0-9_]{3,15}$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cancel_return_url + * + * @return string|null + */ + public function getCancelReturnUrl() + { + return $this->container['cancel_return_url']; + } + + /** + * Sets cancel_return_url + * + * @param string|null $cancel_return_url URL where the end-customer is redirected if the authorization cancelled + * + * @return self + */ + public function setCancelReturnUrl($cancel_return_url) + { + if (is_null($cancel_return_url)) { + throw new \InvalidArgumentException('non-nullable cancel_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $cancel_return_url))) { + throw new \InvalidArgumentException("invalid value for \$cancel_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['cancel_return_url'] = $cancel_return_url; + + return $this; + } + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of customer in E.164 format (e.g. +628123123123). For OVO one time payment use only. + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets redeem_points + * + * @return string|null + */ + public function getRedeemPoints() + { + return $this->container['redeem_points']; + } + + /** + * Sets redeem_points + * + * @param string|null $redeem_points REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. + * + * @return self + */ + public function setRedeemPoints($redeem_points) + { + if (is_null($redeem_points)) { + throw new \InvalidArgumentException('non-nullable redeem_points cannot be null'); + } + $this->container['redeem_points'] = $redeem_points; + + return $this; + } + + /** + * Gets cashtag + * + * @return string|null + */ + public function getCashtag() + { + return $this->container['cashtag']; + } + + /** + * Sets cashtag + * + * @param string|null $cashtag Available for JENIUSPAY only + * + * @return self + */ + public function setCashtag($cashtag) + { + if (is_null($cashtag)) { + throw new \InvalidArgumentException('non-nullable cashtag cannot be null'); + } + + if ((!preg_match("/^[$][a-zA-Z0-9_]{3,15}$/", $cashtag))) { + throw new \InvalidArgumentException("invalid value for \$cashtag when calling EWalletChannelProperties., must conform to the pattern /^[$][a-zA-Z0-9_]{3,15}$/."); + } + + $this->container['cashtag'] = $cashtag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/EWalletParameters.php b/lib/PaymentMethod/EWalletParameters.php new file mode 100644 index 0000000..f280a27 --- /dev/null +++ b/lib/PaymentMethod/EWalletParameters.php @@ -0,0 +1,473 @@ + + */ +class EWalletParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentMethod\EWalletChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\EWalletChannelProperties', + 'account' => '\Xendit\PaymentMethod\EWalletAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => false, + 'account' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'account' => 'account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'account' => 'setAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'account' => 'getAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentMethod\EWalletChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\EWalletChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\EWalletChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\EWalletChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets account + * + * @return \PaymentMethod\EWalletAccount|null + */ + public function getAccount() + { + return $this->container['account']; + } + + /** + * Sets account + * + * @param \PaymentMethod\EWalletAccount|null $account account + * + * @return self + */ + public function setAccount($account) + { + if (is_null($account)) { + throw new \InvalidArgumentException('non-nullable account cannot be null'); + } + $this->container['account'] = $account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/GetAllPaymentMethods400Response.php b/lib/PaymentMethod/GetAllPaymentMethods400Response.php new file mode 100644 index 0000000..64a33b0 --- /dev/null +++ b/lib/PaymentMethod/GetAllPaymentMethods400Response.php @@ -0,0 +1,494 @@ + + */ +class GetAllPaymentMethods400Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAllPaymentMethods_400_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_API_VALIDATION_ERROR = 'API_VALIDATION_ERROR'; + public const ERROR_CODE_NOT_SUPPORTED_BY_CHANNEL = 'NOT_SUPPORTED_BY_CHANNEL'; + public const ERROR_CODE_EXPIRED_OTP_ERROR = 'EXPIRED_OTP_ERROR'; + public const ERROR_CODE_INVALID_ACCOUNT_DETAILS = 'INVALID_ACCOUNT_DETAILS'; + public const ERROR_CODE_INVALID_OTP_ERROR = 'INVALID_OTP_ERROR'; + public const ERROR_CODE_INVALID_PAYMENT_METHOD = 'INVALID_PAYMENT_METHOD'; + public const ERROR_CODE_MAX_OTP_ATTEMPTS_ERROR = 'MAX_OTP_ATTEMPTS_ERROR'; + public const ERROR_CODE_CUSTOMER_NOT_FOUND_ERROR = 'CUSTOMER_NOT_FOUND_ERROR'; + public const ERROR_CODE_ACCOUNT_ACCESS_BLOCKED = 'ACCOUNT_ACCESS_BLOCKED'; + public const ERROR_CODE_MAX_ACCOUNT_LINKING = 'MAX_ACCOUNT_LINKING'; + public const ERROR_CODE_INACTIVE_PAYMENT_METHOD = 'INACTIVE_PAYMENT_METHOD'; + public const ERROR_CODE_PAYMENT_METHOD_NOT_SUPPORTED = 'PAYMENT_METHOD_NOT_SUPPORTED'; + public const ERROR_CODE_INCORRECT_AMOUNT = 'INCORRECT_AMOUNT'; + public const ERROR_CODE_DUPLICATED_FIXED_PAYMENT_INSTRUMENT = 'DUPLICATED_FIXED_PAYMENT_INSTRUMENT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_API_VALIDATION_ERROR, + self::ERROR_CODE_NOT_SUPPORTED_BY_CHANNEL, + self::ERROR_CODE_EXPIRED_OTP_ERROR, + self::ERROR_CODE_INVALID_ACCOUNT_DETAILS, + self::ERROR_CODE_INVALID_OTP_ERROR, + self::ERROR_CODE_INVALID_PAYMENT_METHOD, + self::ERROR_CODE_MAX_OTP_ATTEMPTS_ERROR, + self::ERROR_CODE_CUSTOMER_NOT_FOUND_ERROR, + self::ERROR_CODE_ACCOUNT_ACCESS_BLOCKED, + self::ERROR_CODE_MAX_ACCOUNT_LINKING, + self::ERROR_CODE_INACTIVE_PAYMENT_METHOD, + self::ERROR_CODE_PAYMENT_METHOD_NOT_SUPPORTED, + self::ERROR_CODE_INCORRECT_AMOUNT, + self::ERROR_CODE_DUPLICATED_FIXED_PAYMENT_INSTRUMENT, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/GetAllPaymentMethods403Response.php b/lib/PaymentMethod/GetAllPaymentMethods403Response.php new file mode 100644 index 0000000..5852b5e --- /dev/null +++ b/lib/PaymentMethod/GetAllPaymentMethods403Response.php @@ -0,0 +1,470 @@ + + */ +class GetAllPaymentMethods403Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAllPaymentMethods_403_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_UNAUTHORIZED = 'UNAUTHORIZED'; + public const ERROR_CODE_CHANNEL_NOT_ACTIVATED = 'CHANNEL_NOT_ACTIVATED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_UNAUTHORIZED, + self::ERROR_CODE_CHANNEL_NOT_ACTIVATED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/GetAllPaymentMethods404Response.php b/lib/PaymentMethod/GetAllPaymentMethods404Response.php new file mode 100644 index 0000000..b793e55 --- /dev/null +++ b/lib/PaymentMethod/GetAllPaymentMethods404Response.php @@ -0,0 +1,468 @@ + + */ +class GetAllPaymentMethods404Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAllPaymentMethods_404_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_DATA_NOT_FOUND = 'DATA_NOT_FOUND'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_DATA_NOT_FOUND, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/GetAllPaymentMethodsDefaultResponse.php b/lib/PaymentMethod/GetAllPaymentMethodsDefaultResponse.php new file mode 100644 index 0000000..b373d02 --- /dev/null +++ b/lib/PaymentMethod/GetAllPaymentMethodsDefaultResponse.php @@ -0,0 +1,436 @@ + + */ +class GetAllPaymentMethodsDefaultResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAllPaymentMethods_default_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/OverTheCounter.php b/lib/PaymentMethod/OverTheCounter.php new file mode 100644 index 0000000..2e10301 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounter.php @@ -0,0 +1,518 @@ + + */ +class OverTheCounter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\OverTheCounterChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\OverTheCounterChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\OverTheCounterChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\OverTheCounterChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\OverTheCounterChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\OverTheCounterChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/OverTheCounterChannelCode.php b/lib/PaymentMethod/OverTheCounterChannelCode.php new file mode 100644 index 0000000..5712b76 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounterChannelCode.php @@ -0,0 +1,121 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum OverTheCounterChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::_7_ELEVEN, + self::_7_ELEVEN_CLIQQ, + self::CEBUANA, + self::ECPAY, + self::PALAWAN, + self::MLHUILLIER, + self::ECPAY_DRAGONLOAN, + self::LBC, + self::ECPAY_SCHOOL, + self::RD_PAWNSHOP, + self::CVM, + self::USSC, + self::SM_BILLS, + self::ROBINSONS_BILLS, + self::ALFAMART, + self::INDOMARET + ]; + } +} + + diff --git a/lib/PaymentMethod/OverTheCounterChannelProperties.php b/lib/PaymentMethod/OverTheCounterChannelProperties.php new file mode 100644 index 0000000..6cb79b9 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounterChannelProperties.php @@ -0,0 +1,474 @@ + + */ +class OverTheCounterChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payment_code' => 'string', + 'customer_name' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payment_code' => null, + 'customer_name' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payment_code' => false, + 'customer_name' => false, + 'expires_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'payment_code' => 'payment_code', + 'customer_name' => 'customer_name', + 'expires_at' => 'expires_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payment_code' => 'setPaymentCode', + 'customer_name' => 'setCustomerName', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_code' => 'getPaymentCode', + 'customer_name' => 'getCustomerName', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('payment_code', $data ?? [], null); + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customer_name'] === null) { + $invalidProperties[] = "'customer_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets payment_code + * + * @return string|null + */ + public function getPaymentCode() + { + return $this->container['payment_code']; + } + + /** + * Sets payment_code + * + * @param string|null $payment_code The payment code that you want to assign, e.g 12345. If you do not send one, one will be picked at random. + * + * @return self + */ + public function setPaymentCode($payment_code) + { + if (is_null($payment_code)) { + throw new \InvalidArgumentException('non-nullable payment_code cannot be null'); + } + $this->container['payment_code'] = $payment_code; + + return $this; + } + + /** + * Gets customer_name + * + * @return string + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string $customer_name Name of customer. + * + * @return self + */ + public function setCustomerName($customer_name) + { + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/OverTheCounterChannelPropertiesUpdate.php b/lib/PaymentMethod/OverTheCounterChannelPropertiesUpdate.php new file mode 100644 index 0000000..595a333 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounterChannelPropertiesUpdate.php @@ -0,0 +1,437 @@ + + */ +class OverTheCounterChannelPropertiesUpdate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterChannelPropertiesUpdate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer_name' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer_name' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer_name' => false, + 'expires_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customer_name' => 'customer_name', + 'expires_at' => 'expires_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer_name' => 'setCustomerName', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer_name' => 'getCustomerName', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customer_name + * + * @return string|null + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string|null $customer_name Name of customer. + * + * @return self + */ + public function setCustomerName($customer_name) + { + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/OverTheCounterParameters.php b/lib/PaymentMethod/OverTheCounterParameters.php new file mode 100644 index 0000000..a52eff9 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounterParameters.php @@ -0,0 +1,517 @@ + + */ +class OverTheCounterParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\OverTheCounterChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\OverTheCounterChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\OverTheCounterChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\OverTheCounterChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\OverTheCounterChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\OverTheCounterChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/OverTheCounterUpdateParameters.php b/lib/PaymentMethod/OverTheCounterUpdateParameters.php new file mode 100644 index 0000000..a44cd89 --- /dev/null +++ b/lib/PaymentMethod/OverTheCounterUpdateParameters.php @@ -0,0 +1,443 @@ + + */ +class OverTheCounterUpdateParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterUpdateParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'channel_properties' => '\Xendit\PaymentMethod\OverTheCounterChannelPropertiesUpdate' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\OverTheCounterChannelPropertiesUpdate|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\OverTheCounterChannelPropertiesUpdate|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentChannel.php b/lib/PaymentMethod/PaymentChannel.php new file mode 100644 index 0000000..aadae78 --- /dev/null +++ b/lib/PaymentMethod/PaymentChannel.php @@ -0,0 +1,606 @@ + + */ +class PaymentChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => 'string', + 'type' => 'string', + 'country' => 'string', + 'channel_name' => 'string', + 'channel_properties' => '\Xendit\PaymentMethod\ChannelProperty[]', + 'logo_url' => 'string', + 'amount_limits' => '\Xendit\PaymentMethod\ChannelAmountLimits[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'type' => null, + 'country' => null, + 'channel_name' => null, + 'channel_properties' => null, + 'logo_url' => null, + 'amount_limits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'type' => false, + 'country' => false, + 'channel_name' => false, + 'channel_properties' => false, + 'logo_url' => false, + 'amount_limits' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'type' => 'type', + 'country' => 'country', + 'channel_name' => 'channel_name', + 'channel_properties' => 'channel_properties', + 'logo_url' => 'logo_url', + 'amount_limits' => 'amount_limits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'type' => 'setType', + 'country' => 'setCountry', + 'channel_name' => 'setChannelName', + 'channel_properties' => 'setChannelProperties', + 'logo_url' => 'setLogoUrl', + 'amount_limits' => 'setAmountLimits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'type' => 'getType', + 'country' => 'getCountry', + 'channel_name' => 'getChannelName', + 'channel_properties' => 'getChannelProperties', + 'logo_url' => 'getLogoUrl', + 'amount_limits' => 'getAmountLimits' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('channel_name', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('amount_limits', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return string|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string|null $channel_code The specific Xendit code used to identify the partner channel + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The payment method type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country The country where the channel operates in ISO 3166-2 country code + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets channel_name + * + * @return string|null + */ + public function getChannelName() + { + return $this->container['channel_name']; + } + + /** + * Sets channel_name + * + * @param string|null $channel_name Official parter name of the payment channel + * + * @return self + */ + public function setChannelName($channel_name) + { + if (is_null($channel_name)) { + throw new \InvalidArgumentException('non-nullable channel_name cannot be null'); + } + $this->container['channel_name'] = $channel_name; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\ChannelProperty[]|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\ChannelProperty[]|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets logo_url + * + * @return string|null + */ + public function getLogoUrl() + { + return $this->container['logo_url']; + } + + /** + * Sets logo_url + * + * @param string|null $logo_url If available, this contains a URL to the logo of the partner channel + * + * @return self + */ + public function setLogoUrl($logo_url) + { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } + $this->container['logo_url'] = $logo_url; + + return $this; + } + + /** + * Gets amount_limits + * + * @return \PaymentMethod\ChannelAmountLimits[]|null + */ + public function getAmountLimits() + { + return $this->container['amount_limits']; + } + + /** + * Sets amount_limits + * + * @param \PaymentMethod\ChannelAmountLimits[]|null $amount_limits amount_limits + * + * @return self + */ + public function setAmountLimits($amount_limits) + { + if (is_null($amount_limits)) { + throw new \InvalidArgumentException('non-nullable amount_limits cannot be null'); + } + $this->container['amount_limits'] = $amount_limits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentChannelAllOf.php b/lib/PaymentMethod/PaymentChannelAllOf.php new file mode 100644 index 0000000..e82ecb3 --- /dev/null +++ b/lib/PaymentMethod/PaymentChannelAllOf.php @@ -0,0 +1,606 @@ + + */ +class PaymentChannelAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentChannel_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => 'string', + 'type' => 'string', + 'country' => 'string', + 'channel_name' => 'string', + 'channel_properties' => '\Xendit\PaymentMethod\ChannelProperty[]', + 'logo_url' => 'string', + 'amount_limits' => '\Xendit\PaymentMethod\ChannelAmountLimits[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'type' => null, + 'country' => null, + 'channel_name' => null, + 'channel_properties' => null, + 'logo_url' => null, + 'amount_limits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'type' => false, + 'country' => false, + 'channel_name' => false, + 'channel_properties' => false, + 'logo_url' => false, + 'amount_limits' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'type' => 'type', + 'country' => 'country', + 'channel_name' => 'channel_name', + 'channel_properties' => 'channel_properties', + 'logo_url' => 'logo_url', + 'amount_limits' => 'amount_limits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'type' => 'setType', + 'country' => 'setCountry', + 'channel_name' => 'setChannelName', + 'channel_properties' => 'setChannelProperties', + 'logo_url' => 'setLogoUrl', + 'amount_limits' => 'setAmountLimits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'type' => 'getType', + 'country' => 'getCountry', + 'channel_name' => 'getChannelName', + 'channel_properties' => 'getChannelProperties', + 'logo_url' => 'getLogoUrl', + 'amount_limits' => 'getAmountLimits' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('channel_name', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('amount_limits', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return string|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string|null $channel_code The specific Xendit code used to identify the partner channel + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The payment method type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country The country where the channel operates in ISO 3166-2 country code + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets channel_name + * + * @return string|null + */ + public function getChannelName() + { + return $this->container['channel_name']; + } + + /** + * Sets channel_name + * + * @param string|null $channel_name Official parter name of the payment channel + * + * @return self + */ + public function setChannelName($channel_name) + { + if (is_null($channel_name)) { + throw new \InvalidArgumentException('non-nullable channel_name cannot be null'); + } + $this->container['channel_name'] = $channel_name; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\ChannelProperty[]|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\ChannelProperty[]|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets logo_url + * + * @return string|null + */ + public function getLogoUrl() + { + return $this->container['logo_url']; + } + + /** + * Sets logo_url + * + * @param string|null $logo_url If available, this contains a URL to the logo of the partner channel + * + * @return self + */ + public function setLogoUrl($logo_url) + { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } + $this->container['logo_url'] = $logo_url; + + return $this; + } + + /** + * Gets amount_limits + * + * @return \PaymentMethod\ChannelAmountLimits[]|null + */ + public function getAmountLimits() + { + return $this->container['amount_limits']; + } + + /** + * Sets amount_limits + * + * @param \PaymentMethod\ChannelAmountLimits[]|null $amount_limits amount_limits + * + * @return self + */ + public function setAmountLimits($amount_limits) + { + if (is_null($amount_limits)) { + throw new \InvalidArgumentException('non-nullable amount_limits cannot be null'); + } + $this->container['amount_limits'] = $amount_limits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentChannelList.php b/lib/PaymentMethod/PaymentChannelList.php new file mode 100644 index 0000000..bdebb04 --- /dev/null +++ b/lib/PaymentMethod/PaymentChannelList.php @@ -0,0 +1,470 @@ + + */ +class PaymentChannelList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentChannelList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\PaymentMethod\PaymentChannel[]', + 'links' => '\Xendit\PaymentMethod\PaymentChannelListLinksInner[]', + 'has_more' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'links' => null, + 'has_more' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'links' => false, + 'has_more' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'links' => 'links', + 'has_more' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'links' => 'setLinks', + 'has_more' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'links' => 'getLinks', + 'has_more' => 'getHasMore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \PaymentMethod\PaymentChannel[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \PaymentMethod\PaymentChannel[]|null $data Array of resources that match the provided filters + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets links + * + * @return \PaymentMethod\PaymentChannelListLinksInner[]|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \PaymentMethod\PaymentChannelListLinksInner[]|null $links Array of objects that can be used to assist on navigating through the data + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets has_more + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool|null $has_more Indicates whether there are more items in the list + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentChannelListLinksInner.php b/lib/PaymentMethod/PaymentChannelListLinksInner.php new file mode 100644 index 0000000..bf297e3 --- /dev/null +++ b/lib/PaymentMethod/PaymentChannelListLinksInner.php @@ -0,0 +1,508 @@ + + */ +class PaymentChannelListLinksInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentChannelList_links_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const REL_FIRST = 'first'; + public const REL_LAST = 'last'; + public const REL_NEXT = 'next'; + public const REL_PREV = 'prev'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelAllowableValues() + { + return [ + self::REL_FIRST, + self::REL_LAST, + self::REL_NEXT, + self::REL_PREV, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getRelAllowableValues(); + if (!is_null($this->container['rel']) && !in_array($this->container['rel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'rel', must be one of '%s'", + $this->container['rel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string|null + */ + public function getHref() + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href Target URI that should contain a target to Internationalized Resource Identifiers (IRI) + * + * @return self + */ + public function setHref($href) + { + if (is_null($href)) { + throw new \InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string|null + */ + public function getRel() + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel The link relation type described how the current context (source) is related to target resource + * + * @return self + */ + public function setRel($rel) + { + if (is_null($rel)) { + throw new \InvalidArgumentException('non-nullable rel cannot be null'); + } + $allowedValues = $this->getRelAllowableValues(); + if (!in_array($rel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'rel', must be one of '%s'", + $rel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method The HTTP method to be used to call `href` + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentChannelListLinksInnerAllOf.php b/lib/PaymentMethod/PaymentChannelListLinksInnerAllOf.php new file mode 100644 index 0000000..454e39e --- /dev/null +++ b/lib/PaymentMethod/PaymentChannelListLinksInnerAllOf.php @@ -0,0 +1,508 @@ + + */ +class PaymentChannelListLinksInnerAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentChannelList_links_inner_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const REL_FIRST = 'first'; + public const REL_LAST = 'last'; + public const REL_NEXT = 'next'; + public const REL_PREV = 'prev'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelAllowableValues() + { + return [ + self::REL_FIRST, + self::REL_LAST, + self::REL_NEXT, + self::REL_PREV, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getRelAllowableValues(); + if (!is_null($this->container['rel']) && !in_array($this->container['rel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'rel', must be one of '%s'", + $this->container['rel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string|null + */ + public function getHref() + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href Target URI that should contain a target to Internationalized Resource Identifiers (IRI) + * + * @return self + */ + public function setHref($href) + { + if (is_null($href)) { + throw new \InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string|null + */ + public function getRel() + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel The link relation type described how the current context (source) is related to target resource + * + * @return self + */ + public function setRel($rel) + { + if (is_null($rel)) { + throw new \InvalidArgumentException('non-nullable rel cannot be null'); + } + $allowedValues = $this->getRelAllowableValues(); + if (!in_array($rel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'rel', must be one of '%s'", + $rel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method The HTTP method to be used to call `href` + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethod.php b/lib/PaymentMethod/PaymentMethod.php new file mode 100644 index 0000000..b8ba041 --- /dev/null +++ b/lib/PaymentMethod/PaymentMethod.php @@ -0,0 +1,1203 @@ + + */ +class PaymentMethod implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethod'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'business_id' => 'string', + 'type' => '\Xendit\PaymentMethod\PaymentMethodType', + 'country' => '\Xendit\PaymentMethod\PaymentMethodCountry', + 'customer_id' => 'string', + 'customer' => 'object', + 'reference_id' => 'string', + 'description' => 'string', + 'status' => '\Xendit\PaymentMethod\PaymentMethodStatus', + 'reusability' => '\Xendit\PaymentMethod\PaymentMethodReusability', + 'actions' => '\Xendit\PaymentMethod\PaymentMethodAction[]', + 'metadata' => 'object', + 'billing_information' => '\Xendit\PaymentMethod\BillingInformation', + 'failure_code' => 'string', + 'created' => '\DateTime', + 'updated' => '\DateTime', + 'ewallet' => '\Xendit\PaymentMethod\EWallet', + 'direct_debit' => '\Xendit\PaymentMethod\DirectDebit', + 'over_the_counter' => '\Xendit\PaymentMethod\OverTheCounter', + 'card' => '\Xendit\PaymentMethod\Card', + 'qr_code' => '\Xendit\PaymentMethod\QRCode', + 'virtual_account' => '\Xendit\PaymentMethod\VirtualAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'business_id' => null, + 'type' => null, + 'country' => null, + 'customer_id' => null, + 'customer' => null, + 'reference_id' => null, + 'description' => null, + 'status' => null, + 'reusability' => null, + 'actions' => null, + 'metadata' => null, + 'billing_information' => null, + 'failure_code' => null, + 'created' => 'date-time', + 'updated' => 'date-time', + 'ewallet' => null, + 'direct_debit' => null, + 'over_the_counter' => null, + 'card' => null, + 'qr_code' => null, + 'virtual_account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'business_id' => false, + 'type' => false, + 'country' => false, + 'customer_id' => true, + 'customer' => true, + 'reference_id' => false, + 'description' => true, + 'status' => false, + 'reusability' => false, + 'actions' => false, + 'metadata' => true, + 'billing_information' => true, + 'failure_code' => true, + 'created' => false, + 'updated' => false, + 'ewallet' => true, + 'direct_debit' => true, + 'over_the_counter' => true, + 'card' => true, + 'qr_code' => true, + 'virtual_account' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'business_id' => 'business_id', + 'type' => 'type', + 'country' => 'country', + 'customer_id' => 'customer_id', + 'customer' => 'customer', + 'reference_id' => 'reference_id', + 'description' => 'description', + 'status' => 'status', + 'reusability' => 'reusability', + 'actions' => 'actions', + 'metadata' => 'metadata', + 'billing_information' => 'billing_information', + 'failure_code' => 'failure_code', + 'created' => 'created', + 'updated' => 'updated', + 'ewallet' => 'ewallet', + 'direct_debit' => 'direct_debit', + 'over_the_counter' => 'over_the_counter', + 'card' => 'card', + 'qr_code' => 'qr_code', + 'virtual_account' => 'virtual_account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'business_id' => 'setBusinessId', + 'type' => 'setType', + 'country' => 'setCountry', + 'customer_id' => 'setCustomerId', + 'customer' => 'setCustomer', + 'reference_id' => 'setReferenceId', + 'description' => 'setDescription', + 'status' => 'setStatus', + 'reusability' => 'setReusability', + 'actions' => 'setActions', + 'metadata' => 'setMetadata', + 'billing_information' => 'setBillingInformation', + 'failure_code' => 'setFailureCode', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'ewallet' => 'setEwallet', + 'direct_debit' => 'setDirectDebit', + 'over_the_counter' => 'setOverTheCounter', + 'card' => 'setCard', + 'qr_code' => 'setQrCode', + 'virtual_account' => 'setVirtualAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'business_id' => 'getBusinessId', + 'type' => 'getType', + 'country' => 'getCountry', + 'customer_id' => 'getCustomerId', + 'customer' => 'getCustomer', + 'reference_id' => 'getReferenceId', + 'description' => 'getDescription', + 'status' => 'getStatus', + 'reusability' => 'getReusability', + 'actions' => 'getActions', + 'metadata' => 'getMetadata', + 'billing_information' => 'getBillingInformation', + 'failure_code' => 'getFailureCode', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'ewallet' => 'getEwallet', + 'direct_debit' => 'getDirectDebit', + 'over_the_counter' => 'getOverTheCounter', + 'card' => 'getCard', + 'qr_code' => 'getQrCode', + 'virtual_account' => 'getVirtualAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('reusability', $data ?? [], null); + $this->setIfExists('actions', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('billing_information', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('ewallet', $data ?? [], null); + $this->setIfExists('direct_debit', $data ?? [], null); + $this->setIfExists('over_the_counter', $data ?? [], null); + $this->setIfExists('card', $data ?? [], null); + $this->setIfExists('qr_code', $data ?? [], null); + $this->setIfExists('virtual_account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets business_id + * + * @return string|null + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string|null $business_id business_id + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets type + * + * @return \PaymentMethod\PaymentMethodType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentMethod\PaymentMethodType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets country + * + * @return \PaymentMethod\PaymentMethodCountry|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param \PaymentMethod\PaymentMethodCountry|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets customer_id + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string|null $customer_id customer_id + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets customer + * + * @return object|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param object|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets status + * + * @return \PaymentMethod\PaymentMethodStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \PaymentMethod\PaymentMethodStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets reusability + * + * @return \PaymentMethod\PaymentMethodReusability|null + */ + public function getReusability() + { + return $this->container['reusability']; + } + + /** + * Sets reusability + * + * @param \PaymentMethod\PaymentMethodReusability|null $reusability reusability + * + * @return self + */ + public function setReusability($reusability) + { + if (is_null($reusability)) { + throw new \InvalidArgumentException('non-nullable reusability cannot be null'); + } + $this->container['reusability'] = $reusability; + + return $this; + } + + /** + * Gets actions + * + * @return \PaymentMethod\PaymentMethodAction[]|null + */ + public function getActions() + { + return $this->container['actions']; + } + + /** + * Sets actions + * + * @param \PaymentMethod\PaymentMethodAction[]|null $actions actions + * + * @return self + */ + public function setActions($actions) + { + if (is_null($actions)) { + throw new \InvalidArgumentException('non-nullable actions cannot be null'); + } + $this->container['actions'] = $actions; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets billing_information + * + * @return \PaymentMethod\BillingInformation|null + */ + public function getBillingInformation() + { + return $this->container['billing_information']; + } + + /** + * Sets billing_information + * + * @param \PaymentMethod\BillingInformation|null $billing_information billing_information + * + * @return self + */ + public function setBillingInformation($billing_information) + { + if (is_null($billing_information)) { + array_push($this->openAPINullablesSetToNull, 'billing_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('billing_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['billing_information'] = $billing_information; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code failure_code + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + array_push($this->openAPINullablesSetToNull, 'failure_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime|null + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime|null $created created + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime|null + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime|null $updated updated + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets ewallet + * + * @return \PaymentMethod\EWallet|null + */ + public function getEwallet() + { + return $this->container['ewallet']; + } + + /** + * Sets ewallet + * + * @param \PaymentMethod\EWallet|null $ewallet ewallet + * + * @return self + */ + public function setEwallet($ewallet) + { + if (is_null($ewallet)) { + array_push($this->openAPINullablesSetToNull, 'ewallet'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ewallet', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ewallet'] = $ewallet; + + return $this; + } + + /** + * Gets direct_debit + * + * @return \PaymentMethod\DirectDebit|null + */ + public function getDirectDebit() + { + return $this->container['direct_debit']; + } + + /** + * Sets direct_debit + * + * @param \PaymentMethod\DirectDebit|null $direct_debit direct_debit + * + * @return self + */ + public function setDirectDebit($direct_debit) + { + if (is_null($direct_debit)) { + array_push($this->openAPINullablesSetToNull, 'direct_debit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('direct_debit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['direct_debit'] = $direct_debit; + + return $this; + } + + /** + * Gets over_the_counter + * + * @return \PaymentMethod\OverTheCounter|null + */ + public function getOverTheCounter() + { + return $this->container['over_the_counter']; + } + + /** + * Sets over_the_counter + * + * @param \PaymentMethod\OverTheCounter|null $over_the_counter over_the_counter + * + * @return self + */ + public function setOverTheCounter($over_the_counter) + { + if (is_null($over_the_counter)) { + array_push($this->openAPINullablesSetToNull, 'over_the_counter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('over_the_counter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['over_the_counter'] = $over_the_counter; + + return $this; + } + + /** + * Gets card + * + * @return \PaymentMethod\Card|null + */ + public function getCard() + { + return $this->container['card']; + } + + /** + * Sets card + * + * @param \PaymentMethod\Card|null $card card + * + * @return self + */ + public function setCard($card) + { + if (is_null($card)) { + array_push($this->openAPINullablesSetToNull, 'card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card'] = $card; + + return $this; + } + + /** + * Gets qr_code + * + * @return \PaymentMethod\QRCode|null + */ + public function getQrCode() + { + return $this->container['qr_code']; + } + + /** + * Sets qr_code + * + * @param \PaymentMethod\QRCode|null $qr_code qr_code + * + * @return self + */ + public function setQrCode($qr_code) + { + if (is_null($qr_code)) { + array_push($this->openAPINullablesSetToNull, 'qr_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr_code'] = $qr_code; + + return $this; + } + + /** + * Gets virtual_account + * + * @return \PaymentMethod\VirtualAccount|null + */ + public function getVirtualAccount() + { + return $this->container['virtual_account']; + } + + /** + * Sets virtual_account + * + * @param \PaymentMethod\VirtualAccount|null $virtual_account virtual_account + * + * @return self + */ + public function setVirtualAccount($virtual_account) + { + if (is_null($virtual_account)) { + array_push($this->openAPINullablesSetToNull, 'virtual_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virtual_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['virtual_account'] = $virtual_account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodAction.php b/lib/PaymentMethod/PaymentMethodAction.php new file mode 100644 index 0000000..dad1322 --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodAction.php @@ -0,0 +1,504 @@ + + */ +class PaymentMethodAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'action' => 'string', + 'method' => 'string', + 'url' => 'string', + 'url_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'action' => null, + 'method' => null, + 'url' => null, + 'url_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'action' => false, + 'method' => false, + 'url' => false, + 'url_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'action' => 'action', + 'method' => 'method', + 'url' => 'url', + 'url_type' => 'url_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction', + 'method' => 'setMethod', + 'url' => 'setUrl', + 'url_type' => 'setUrlType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction', + 'method' => 'getMethod', + 'url' => 'getUrl', + 'url_type' => 'getUrlType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('url_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets action + * + * @return string|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method method + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets url_type + * + * @return string|null + */ + public function getUrlType() + { + return $this->container['url_type']; + } + + /** + * Sets url_type + * + * @param string|null $url_type url_type + * + * @return self + */ + public function setUrlType($url_type) + { + if (is_null($url_type)) { + throw new \InvalidArgumentException('non-nullable url_type cannot be null'); + } + $this->container['url_type'] = $url_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodApi.php b/lib/PaymentMethod/PaymentMethodApi.php new file mode 100644 index 0000000..2694c63 --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodApi.php @@ -0,0 +1,3986 @@ + [ + 'application/json', + ], + 'createPaymentMethod' => [ + 'application/json', + ], + 'expirePaymentMethod' => [ + 'application/json', + ], + 'getAllPaymentChannels' => [ + 'application/json', + ], + 'getAllPaymentMethods' => [ + 'application/json', + ], + 'getPaymentMethodByID' => [ + 'application/json', + ], + 'getPaymentsByPaymentMethodId' => [ + 'application/json', + ], + 'patchPaymentMethod' => [ + 'application/json', + ], + 'simulatePayment' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation authPaymentMethod + * + * Validate a payment method's linking OTP + * + * @param string $payment_method_id payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodAuthParameters $payment_method_auth_parameters payment_method_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod409Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function authPaymentMethod($payment_method_id, $payment_method_auth_parameters = null, string $contentType = self::contentTypes['authPaymentMethod'][0]) + { + list($response) = $this->authPaymentMethodWithHttpInfo($payment_method_id, $payment_method_auth_parameters, $contentType); + return $response; + } + + /** + * Operation authPaymentMethodWithHttpInfo + * + * Validate a payment method's linking OTP + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodAuthParameters $payment_method_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod409Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function authPaymentMethodWithHttpInfo($payment_method_id, $payment_method_auth_parameters = null, string $contentType = self::contentTypes['authPaymentMethod'][0]) + { + $request = $this->authPaymentMethodRequest($payment_method_id, $payment_method_auth_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentMethod' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethod' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethod', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('Xendit\PaymentMethod\CreatePaymentMethod409Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod409Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod409Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 503: + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod503Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethod'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethod', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod409Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation authPaymentMethodAsync + * + * Validate a payment method's linking OTP + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodAuthParameters $payment_method_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function authPaymentMethodAsync($payment_method_id, $payment_method_auth_parameters = null, string $contentType = self::contentTypes['authPaymentMethod'][0]) + { + return $this->authPaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_auth_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation authPaymentMethodAsyncWithHttpInfo + * + * Validate a payment method's linking OTP + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodAuthParameters $payment_method_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function authPaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_auth_parameters = null, string $contentType = self::contentTypes['authPaymentMethod'][0]) + { + $returnType = '\PaymentMethod\PaymentMethod'; + $request = $this->authPaymentMethodRequest($payment_method_id, $payment_method_auth_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'authPaymentMethod' + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodAuthParameters $payment_method_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function authPaymentMethodRequest($payment_method_id, $payment_method_auth_parameters = null, string $contentType = self::contentTypes['authPaymentMethod'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling authPaymentMethod' + ); + } + + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}/auth'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_method_auth_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_method_auth_parameters)); + } else { + $httpBody = $payment_method_auth_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createPaymentMethod + * + * Creates payment method + * + * @param \Xendit\PaymentMethod\PaymentMethodParameters $payment_method_parameters payment_method_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod409Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function createPaymentMethod($payment_method_parameters = null, string $contentType = self::contentTypes['createPaymentMethod'][0]) + { + list($response) = $this->createPaymentMethodWithHttpInfo($payment_method_parameters, $contentType); + return $response; + } + + /** + * Operation createPaymentMethodWithHttpInfo + * + * Creates payment method + * + * @param \Xendit\PaymentMethod\PaymentMethodParameters $payment_method_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod409Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createPaymentMethodWithHttpInfo($payment_method_parameters = null, string $contentType = self::contentTypes['createPaymentMethod'][0]) + { + $request = $this->createPaymentMethodRequest($payment_method_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('Xendit\PaymentMethod\PaymentMethod' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethod' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethod', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('Xendit\PaymentMethod\CreatePaymentMethod409Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod409Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod409Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 503: + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod503Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethod'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethod', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod409Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPaymentMethodAsync + * + * Creates payment method + * + * @param Xendit\Xendit\PaymentMethod\PaymentMethodParameters $payment_method_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPaymentMethodAsync($payment_method_parameters = null, string $contentType = self::contentTypes['createPaymentMethod'][0]) + { + return $this->createPaymentMethodAsyncWithHttpInfo($payment_method_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPaymentMethodAsyncWithHttpInfo + * + * Creates payment method + * + * @param Xendit\Xendit\PaymentMethod\PaymentMethodParameters $payment_method_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPaymentMethodAsyncWithHttpInfo($payment_method_parameters = null, string $contentType = self::contentTypes['createPaymentMethod'][0]) + { + $returnType = '\PaymentMethod\PaymentMethod'; + $request = $this->createPaymentMethodRequest($payment_method_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createPaymentMethod' + * + * @param \Xendit\PaymentMethod\PaymentMethodParameters $payment_method_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPaymentMethodRequest($payment_method_parameters = null, string $contentType = self::contentTypes['createPaymentMethod'][0]) + { + + + + $resourcePath = '/v2/payment_methods'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_method_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_method_parameters)); + } else { + $httpBody = $payment_method_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation expirePaymentMethod + * + * Expires a payment method + * + * @param string $payment_method_id payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodExpireParameters $payment_method_expire_parameters payment_method_expire_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expirePaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function expirePaymentMethod($payment_method_id, $payment_method_expire_parameters = null, string $contentType = self::contentTypes['expirePaymentMethod'][0]) + { + list($response) = $this->expirePaymentMethodWithHttpInfo($payment_method_id, $payment_method_expire_parameters, $contentType); + return $response; + } + + /** + * Operation expirePaymentMethodWithHttpInfo + * + * Expires a payment method + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodExpireParameters $payment_method_expire_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expirePaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function expirePaymentMethodWithHttpInfo($payment_method_id, $payment_method_expire_parameters = null, string $contentType = self::contentTypes['expirePaymentMethod'][0]) + { + $request = $this->expirePaymentMethodRequest($payment_method_id, $payment_method_expire_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentMethod' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethod' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethod', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 503: + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod503Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethod'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethod', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation expirePaymentMethodAsync + * + * Expires a payment method + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodExpireParameters $payment_method_expire_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expirePaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expirePaymentMethodAsync($payment_method_id, $payment_method_expire_parameters = null, string $contentType = self::contentTypes['expirePaymentMethod'][0]) + { + return $this->expirePaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_expire_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation expirePaymentMethodAsyncWithHttpInfo + * + * Expires a payment method + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodExpireParameters $payment_method_expire_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expirePaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expirePaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_expire_parameters = null, string $contentType = self::contentTypes['expirePaymentMethod'][0]) + { + $returnType = '\PaymentMethod\PaymentMethod'; + $request = $this->expirePaymentMethodRequest($payment_method_id, $payment_method_expire_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'expirePaymentMethod' + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodExpireParameters $payment_method_expire_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expirePaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function expirePaymentMethodRequest($payment_method_id, $payment_method_expire_parameters = null, string $contentType = self::contentTypes['expirePaymentMethod'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling expirePaymentMethod' + ); + } + + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}/expire'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_method_expire_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_method_expire_parameters)); + } else { + $httpBody = $payment_method_expire_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllPaymentChannels + * + * Get all payment channels + * + * @param bool $is_activated is_activated (optional, default to true) + * @param string $type type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentChannels'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentChannelList|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function getAllPaymentChannels($is_activated = true, $type = null, string $contentType = self::contentTypes['getAllPaymentChannels'][0]) + { + list($response) = $this->getAllPaymentChannelsWithHttpInfo($is_activated, $type, $contentType); + return $response; + } + + /** + * Operation getAllPaymentChannelsWithHttpInfo + * + * Get all payment channels + * + * @param bool $is_activated (optional, default to true) + * @param string $type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentChannels'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentChannelList|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllPaymentChannelsWithHttpInfo($is_activated = true, $type = null, string $contentType = self::contentTypes['getAllPaymentChannels'][0]) + { + $request = $this->getAllPaymentChannelsRequest($is_activated, $type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentChannelList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentChannelList' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentChannelList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentChannelList'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentChannelList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllPaymentChannelsAsync + * + * Get all payment channels + * + * @param Xenditbool $is_activated (optional, default to true) + * @param Xenditstring $type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentChannelsAsync($is_activated = true, $type = null, string $contentType = self::contentTypes['getAllPaymentChannels'][0]) + { + return $this->getAllPaymentChannelsAsyncWithHttpInfo($is_activated, $type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllPaymentChannelsAsyncWithHttpInfo + * + * Get all payment channels + * + * @param Xenditbool $is_activated (optional, default to true) + * @param Xenditstring $type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentChannelsAsyncWithHttpInfo($is_activated = true, $type = null, string $contentType = self::contentTypes['getAllPaymentChannels'][0]) + { + $returnType = '\PaymentMethod\PaymentChannelList'; + $request = $this->getAllPaymentChannelsRequest($is_activated, $type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllPaymentChannels' + * + * @param bool $is_activated (optional, default to true) + * @param string $type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllPaymentChannelsRequest($is_activated = true, $type = null, string $contentType = self::contentTypes['getAllPaymentChannels'][0]) + { + + + + + $resourcePath = '/v2/payment_methods/channels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $is_activated, + 'is_activated', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllPaymentMethods + * + * Get all payment methods by filters + * + * @param string[] $id id (optional) + * @param string[] $type type (optional) + * @param \PaymentMethod\PaymentMethodStatus[] $status status (optional) + * @param PaymentMethodReusability $reusability reusability (optional) + * @param string $customer_id customer_id (optional) + * @param string $reference_id reference_id (optional) + * @param string $after_id after_id (optional) + * @param string $before_id before_id (optional) + * @param int $limit limit (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentMethods'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethodList|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function getAllPaymentMethods($id = null, $type = null, $status = null, $reusability = null, $customer_id = null, $reference_id = null, $after_id = null, $before_id = null, $limit = null, string $contentType = self::contentTypes['getAllPaymentMethods'][0]) + { + list($response) = $this->getAllPaymentMethodsWithHttpInfo($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit, $contentType); + return $response; + } + + /** + * Operation getAllPaymentMethodsWithHttpInfo + * + * Get all payment methods by filters + * + * @param string[] $id (optional) + * @param string[] $type (optional) + * @param \PaymentMethod\PaymentMethodStatus[] $status (optional) + * @param PaymentMethodReusability $reusability (optional) + * @param string $customer_id (optional) + * @param string $reference_id (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param int $limit (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentMethods'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethodList|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllPaymentMethodsWithHttpInfo($id = null, $type = null, $status = null, $reusability = null, $customer_id = null, $reference_id = null, $after_id = null, $before_id = null, $limit = null, string $contentType = self::contentTypes['getAllPaymentMethods'][0]) + { + $request = $this->getAllPaymentMethodsRequest($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentMethodList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethodList' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethodList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethodList'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethodList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllPaymentMethodsAsync + * + * Get all payment methods by filters + * + * @param Xenditstring[] $id (optional) + * @param Xenditstring[] $type (optional) + * @param Xendit\PaymentMethod\PaymentMethodStatus[] $status (optional) + * @param XenditPaymentMethodReusability $reusability (optional) + * @param Xenditstring $customer_id (optional) + * @param Xenditstring $reference_id (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param Xenditint $limit (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentMethods'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentMethodsAsync($id = null, $type = null, $status = null, $reusability = null, $customer_id = null, $reference_id = null, $after_id = null, $before_id = null, $limit = null, string $contentType = self::contentTypes['getAllPaymentMethods'][0]) + { + return $this->getAllPaymentMethodsAsyncWithHttpInfo($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllPaymentMethodsAsyncWithHttpInfo + * + * Get all payment methods by filters + * + * @param Xenditstring[] $id (optional) + * @param Xenditstring[] $type (optional) + * @param Xendit\PaymentMethod\PaymentMethodStatus[] $status (optional) + * @param XenditPaymentMethodReusability $reusability (optional) + * @param Xenditstring $customer_id (optional) + * @param Xenditstring $reference_id (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param Xenditint $limit (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentMethods'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentMethodsAsyncWithHttpInfo($id = null, $type = null, $status = null, $reusability = null, $customer_id = null, $reference_id = null, $after_id = null, $before_id = null, $limit = null, string $contentType = self::contentTypes['getAllPaymentMethods'][0]) + { + $returnType = '\PaymentMethod\PaymentMethodList'; + $request = $this->getAllPaymentMethodsRequest($id, $type, $status, $reusability, $customer_id, $reference_id, $after_id, $before_id, $limit, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllPaymentMethods' + * + * @param string[] $id (optional) + * @param string[] $type (optional) + * @param \PaymentMethod\PaymentMethodStatus[] $status (optional) + * @param PaymentMethodReusability $reusability (optional) + * @param string $customer_id (optional) + * @param string $reference_id (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param int $limit (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentMethods'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllPaymentMethodsRequest($id = null, $type = null, $status = null, $reusability = null, $customer_id = null, $reference_id = null, $after_id = null, $before_id = null, $limit = null, string $contentType = self::contentTypes['getAllPaymentMethods'][0]) + { + + + + + + + + + + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PaymentMethodApi.getAllPaymentMethods, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v2/payment_methods'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reusability, + 'reusability', // param base name + 'PaymentMethodReusability', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer_id, + 'customer_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reference_id, + 'reference_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentMethodByID + * + * Get payment method by ID + * + * @param string $payment_method_id payment_method_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentMethodByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function getPaymentMethodByID($payment_method_id, string $contentType = self::contentTypes['getPaymentMethodByID'][0]) + { + list($response) = $this->getPaymentMethodByIDWithHttpInfo($payment_method_id, $contentType); + return $response; + } + + /** + * Operation getPaymentMethodByIDWithHttpInfo + * + * Get payment method by ID + * + * @param string $payment_method_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentMethodByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentMethodByIDWithHttpInfo($payment_method_id, string $contentType = self::contentTypes['getPaymentMethodByID'][0]) + { + $request = $this->getPaymentMethodByIDRequest($payment_method_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentMethod' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethod' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethod', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethod'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethod', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentMethodByIDAsync + * + * Get payment method by ID + * + * @param Xenditstring $payment_method_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentMethodByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentMethodByIDAsync($payment_method_id, string $contentType = self::contentTypes['getPaymentMethodByID'][0]) + { + return $this->getPaymentMethodByIDAsyncWithHttpInfo($payment_method_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentMethodByIDAsyncWithHttpInfo + * + * Get payment method by ID + * + * @param Xenditstring $payment_method_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentMethodByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentMethodByIDAsyncWithHttpInfo($payment_method_id, string $contentType = self::contentTypes['getPaymentMethodByID'][0]) + { + $returnType = '\PaymentMethod\PaymentMethod'; + $request = $this->getPaymentMethodByIDRequest($payment_method_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPaymentMethodByID' + * + * @param string $payment_method_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentMethodByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentMethodByIDRequest($payment_method_id, string $contentType = self::contentTypes['getPaymentMethodByID'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling getPaymentMethodByID' + ); + } + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentsByPaymentMethodId + * + * Returns payments with matching PaymentMethodID. + * + * @param string $payment_method_id payment_method_id (required) + * @param string[] $payment_request_id payment_request_id (optional) + * @param string[] $payment_method_id2 payment_method_id2 (optional) + * @param string[] $reference_id reference_id (optional) + * @param \PaymentMethod\PaymentMethodType[] $payment_method_type payment_method_type (optional) + * @param string[] $channel_code channel_code (optional) + * @param string[] $status status (optional) + * @param string[] $currency currency (optional) + * @param \DateTime $created_gte created_gte (optional) + * @param \DateTime $created_lte created_lte (optional) + * @param \DateTime $updated_gte updated_gte (optional) + * @param \DateTime $updated_lte updated_lte (optional) + * @param int $limit limit (optional) + * @param string $after_id after_id (optional) + * @param string $before_id before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentsByPaymentMethodId'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xenditobject|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function getPaymentsByPaymentMethodId($payment_method_id, $payment_request_id = null, $payment_method_id2 = null, $reference_id = null, $payment_method_type = null, $channel_code = null, $status = null, $currency = null, $created_gte = null, $created_lte = null, $updated_gte = null, $updated_lte = null, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentsByPaymentMethodId'][0]) + { + list($response) = $this->getPaymentsByPaymentMethodIdWithHttpInfo($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id, $contentType); + return $response; + } + + /** + * Operation getPaymentsByPaymentMethodIdWithHttpInfo + * + * Returns payments with matching PaymentMethodID. + * + * @param string $payment_method_id (required) + * @param string[] $payment_request_id (optional) + * @param string[] $payment_method_id2 (optional) + * @param string[] $reference_id (optional) + * @param \PaymentMethod\PaymentMethodType[] $payment_method_type (optional) + * @param string[] $channel_code (optional) + * @param string[] $status (optional) + * @param string[] $currency (optional) + * @param \DateTime $created_gte (optional) + * @param \DateTime $created_lte (optional) + * @param \DateTime $updated_gte (optional) + * @param \DateTime $updated_lte (optional) + * @param int $limit (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentsByPaymentMethodId'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xenditobject|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\CreatePaymentMethod503Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentsByPaymentMethodIdWithHttpInfo($payment_method_id, $payment_request_id = null, $payment_method_id2 = null, $reference_id = null, $payment_method_type = null, $channel_code = null, $status = null, $currency = null, $created_gte = null, $created_lte = null, $updated_gte = null, $updated_lte = null, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentsByPaymentMethodId'][0]) + { + $request = $this->getPaymentsByPaymentMethodIdRequest($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xenditobject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xenditobject' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xenditobject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 503: + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\CreatePaymentMethod503Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\CreatePaymentMethod503Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xenditobject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentsByPaymentMethodIdAsync + * + * Returns payments with matching PaymentMethodID. + * + * @param Xenditstring $payment_method_id (required) + * @param Xenditstring[] $payment_request_id (optional) + * @param Xenditstring[] $payment_method_id2 (optional) + * @param Xenditstring[] $reference_id (optional) + * @param Xendit\PaymentMethod\PaymentMethodType[] $payment_method_type (optional) + * @param Xenditstring[] $channel_code (optional) + * @param Xenditstring[] $status (optional) + * @param Xenditstring[] $currency (optional) + * @param Xendit\DateTime $created_gte (optional) + * @param Xendit\DateTime $created_lte (optional) + * @param Xendit\DateTime $updated_gte (optional) + * @param Xendit\DateTime $updated_lte (optional) + * @param Xenditint $limit (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentsByPaymentMethodId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentsByPaymentMethodIdAsync($payment_method_id, $payment_request_id = null, $payment_method_id2 = null, $reference_id = null, $payment_method_type = null, $channel_code = null, $status = null, $currency = null, $created_gte = null, $created_lte = null, $updated_gte = null, $updated_lte = null, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentsByPaymentMethodId'][0]) + { + return $this->getPaymentsByPaymentMethodIdAsyncWithHttpInfo($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentsByPaymentMethodIdAsyncWithHttpInfo + * + * Returns payments with matching PaymentMethodID. + * + * @param Xenditstring $payment_method_id (required) + * @param Xenditstring[] $payment_request_id (optional) + * @param Xenditstring[] $payment_method_id2 (optional) + * @param Xenditstring[] $reference_id (optional) + * @param Xendit\PaymentMethod\PaymentMethodType[] $payment_method_type (optional) + * @param Xenditstring[] $channel_code (optional) + * @param Xenditstring[] $status (optional) + * @param Xenditstring[] $currency (optional) + * @param Xendit\DateTime $created_gte (optional) + * @param Xendit\DateTime $created_lte (optional) + * @param Xendit\DateTime $updated_gte (optional) + * @param Xendit\DateTime $updated_lte (optional) + * @param Xenditint $limit (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentsByPaymentMethodId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentsByPaymentMethodIdAsyncWithHttpInfo($payment_method_id, $payment_request_id = null, $payment_method_id2 = null, $reference_id = null, $payment_method_type = null, $channel_code = null, $status = null, $currency = null, $created_gte = null, $created_lte = null, $updated_gte = null, $updated_lte = null, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentsByPaymentMethodId'][0]) + { + $returnType = 'object'; + $request = $this->getPaymentsByPaymentMethodIdRequest($payment_method_id, $payment_request_id, $payment_method_id2, $reference_id, $payment_method_type, $channel_code, $status, $currency, $created_gte, $created_lte, $updated_gte, $updated_lte, $limit, $after_id, $before_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPaymentsByPaymentMethodId' + * + * @param string $payment_method_id (required) + * @param string[] $payment_request_id (optional) + * @param string[] $payment_method_id2 (optional) + * @param string[] $reference_id (optional) + * @param \PaymentMethod\PaymentMethodType[] $payment_method_type (optional) + * @param string[] $channel_code (optional) + * @param string[] $status (optional) + * @param string[] $currency (optional) + * @param \DateTime $created_gte (optional) + * @param \DateTime $created_lte (optional) + * @param \DateTime $updated_gte (optional) + * @param \DateTime $updated_lte (optional) + * @param int $limit (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentsByPaymentMethodId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentsByPaymentMethodIdRequest($payment_method_id, $payment_request_id = null, $payment_method_id2 = null, $reference_id = null, $payment_method_type = null, $channel_code = null, $status = null, $currency = null, $created_gte = null, $created_lte = null, $updated_gte = null, $updated_lte = null, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentsByPaymentMethodId'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling getPaymentsByPaymentMethodId' + ); + } + + + + + + + + + + + + + + + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}/payments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $payment_request_id, + 'payment_request_id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $payment_method_id2, + 'payment_method_id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reference_id, + 'reference_id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $payment_method_type, + 'payment_method_type', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $channel_code, + 'channel_code', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $currency, + 'currency', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_gte, + 'created[gte]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_lte, + 'created[lte]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_gte, + 'updated[gte]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_lte, + 'updated[lte]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation patchPaymentMethod + * + * Patch payment methods + * + * @param string $payment_method_id payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodUpdateParameters $payment_method_update_parameters payment_method_update_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse + */ + public function patchPaymentMethod($payment_method_id, $payment_method_update_parameters = null, string $contentType = self::contentTypes['patchPaymentMethod'][0]) + { + list($response) = $this->patchPaymentMethodWithHttpInfo($payment_method_id, $payment_method_update_parameters, $contentType); + return $response; + } + + /** + * Operation patchPaymentMethodWithHttpInfo + * + * Patch payment methods + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodUpdateParameters $payment_method_update_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchPaymentMethod'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentMethod\PaymentMethod|Xendit\PaymentMethod\GetAllPaymentMethods400Response|Xendit\PaymentMethod\GetAllPaymentMethods403Response|Xendit\PaymentMethod\GetAllPaymentMethods404Response|Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function patchPaymentMethodWithHttpInfo($payment_method_id, $payment_method_update_parameters = null, string $contentType = self::contentTypes['patchPaymentMethod'][0]) + { + $request = $this->patchPaymentMethodRequest($payment_method_id, $payment_method_update_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentMethod\PaymentMethod' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\PaymentMethod' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\PaymentMethod', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethods404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentMethod\PaymentMethod'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\PaymentMethod', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation patchPaymentMethodAsync + * + * Patch payment methods + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodUpdateParameters $payment_method_update_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function patchPaymentMethodAsync($payment_method_id, $payment_method_update_parameters = null, string $contentType = self::contentTypes['patchPaymentMethod'][0]) + { + return $this->patchPaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_update_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation patchPaymentMethodAsyncWithHttpInfo + * + * Patch payment methods + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\PaymentMethodUpdateParameters $payment_method_update_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function patchPaymentMethodAsyncWithHttpInfo($payment_method_id, $payment_method_update_parameters = null, string $contentType = self::contentTypes['patchPaymentMethod'][0]) + { + $returnType = '\PaymentMethod\PaymentMethod'; + $request = $this->patchPaymentMethodRequest($payment_method_id, $payment_method_update_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'patchPaymentMethod' + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\PaymentMethodUpdateParameters $payment_method_update_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchPaymentMethod'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function patchPaymentMethodRequest($payment_method_id, $payment_method_update_parameters = null, string $contentType = self::contentTypes['patchPaymentMethod'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling patchPaymentMethod' + ); + } + + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_method_update_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_method_update_parameters)); + } else { + $httpBody = $payment_method_update_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation simulatePayment + * + * Makes payment with matching PaymentMethodID. + * + * @param string $payment_method_id payment_method_id (required) + * @param \Xendit\PaymentMethod\SimulatePaymentRequest $simulate_payment_request simulate_payment_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['simulatePayment'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function simulatePayment($payment_method_id, $simulate_payment_request = null, string $contentType = self::contentTypes['simulatePayment'][0]) + { + $this->simulatePaymentWithHttpInfo($payment_method_id, $simulate_payment_request, $contentType); + } + + /** + * Operation simulatePaymentWithHttpInfo + * + * Makes payment with matching PaymentMethodID. + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\SimulatePaymentRequest $simulate_payment_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['simulatePayment'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function simulatePaymentWithHttpInfo($payment_method_id, $simulate_payment_request = null, string $contentType = self::contentTypes['simulatePayment'][0]) + { + $request = $this->simulatePaymentRequest($payment_method_id, $simulate_payment_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethods404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\CreatePaymentMethod503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentMethod\GetAllPaymentMethodsDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation simulatePaymentAsync + * + * Makes payment with matching PaymentMethodID. + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\SimulatePaymentRequest $simulate_payment_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['simulatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function simulatePaymentAsync($payment_method_id, $simulate_payment_request = null, string $contentType = self::contentTypes['simulatePayment'][0]) + { + return $this->simulatePaymentAsyncWithHttpInfo($payment_method_id, $simulate_payment_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation simulatePaymentAsyncWithHttpInfo + * + * Makes payment with matching PaymentMethodID. + * + * @param Xenditstring $payment_method_id (required) + * @param Xendit\Xendit\PaymentMethod\SimulatePaymentRequest $simulate_payment_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['simulatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function simulatePaymentAsyncWithHttpInfo($payment_method_id, $simulate_payment_request = null, string $contentType = self::contentTypes['simulatePayment'][0]) + { + $returnType = ''; + $request = $this->simulatePaymentRequest($payment_method_id, $simulate_payment_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'simulatePayment' + * + * @param string $payment_method_id (required) + * @param \Xendit\PaymentMethod\SimulatePaymentRequest $simulate_payment_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['simulatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function simulatePaymentRequest($payment_method_id, $simulate_payment_request = null, string $contentType = self::contentTypes['simulatePayment'][0]) + { + + // verify the required parameter 'payment_method_id' is set + if ($payment_method_id === null || (is_array($payment_method_id) && count($payment_method_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_method_id when calling simulatePayment' + ); + } + + + + $resourcePath = '/v2/payment_methods/{paymentMethodId}/payments/simulate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_method_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentMethodId' . '}', + ObjectSerializer::toPathValue($payment_method_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($simulate_payment_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simulate_payment_request)); + } else { + $httpBody = $simulate_payment_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/PaymentMethod/PaymentMethodAuthParameters.php b/lib/PaymentMethod/PaymentMethodAuthParameters.php new file mode 100644 index 0000000..e5abfce --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodAuthParameters.php @@ -0,0 +1,420 @@ + + */ +class PaymentMethodAuthParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodAuthParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_code' => 'auth_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_code' => 'setAuthCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_code' => 'getAuthCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('auth_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['auth_code'] === null) { + $invalidProperties[] = "'auth_code' can't be null"; + } + if ((mb_strlen($this->container['auth_code']) > 6)) { + $invalidProperties[] = "invalid value for 'auth_code', the character length must be smaller than or equal to 6."; + } + + if ((mb_strlen($this->container['auth_code']) < 6)) { + $invalidProperties[] = "invalid value for 'auth_code', the character length must be bigger than or equal to 6."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_code + * + * @return string + */ + public function getAuthCode() + { + return $this->container['auth_code']; + } + + /** + * Sets auth_code + * + * @param string $auth_code auth_code + * + * @return self + */ + public function setAuthCode($auth_code) + { + if (is_null($auth_code)) { + throw new \InvalidArgumentException('non-nullable auth_code cannot be null'); + } + if ((mb_strlen($auth_code) > 6)) { + throw new \InvalidArgumentException('invalid length for $auth_code when calling PaymentMethodAuthParameters., must be smaller than or equal to 6.'); + } + if ((mb_strlen($auth_code) < 6)) { + throw new \InvalidArgumentException('invalid length for $auth_code when calling PaymentMethodAuthParameters., must be bigger than or equal to 6.'); + } + + $this->container['auth_code'] = $auth_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodCountry.php b/lib/PaymentMethod/PaymentMethodCountry.php new file mode 100644 index 0000000..60ccf5d --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodCountry.php @@ -0,0 +1,87 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodCountry: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::PH, + self::ID, + self::VN, + self::TH, + self::MY + ]; + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodExpireParameters.php b/lib/PaymentMethod/PaymentMethodExpireParameters.php new file mode 100644 index 0000000..f716103 --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodExpireParameters.php @@ -0,0 +1,450 @@ + + */ +class PaymentMethodExpireParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodExpireParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => null, + 'failure_return_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => true, + 'failure_return_url' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end customer is redirected if the unlinking authorization is successful. + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + array_push($this->openAPINullablesSetToNull, 'success_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('success_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end customer is redirected if the unlinking authorization is failed. + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + array_push($this->openAPINullablesSetToNull, 'failure_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodList.php b/lib/PaymentMethod/PaymentMethodList.php new file mode 100644 index 0000000..e633dd2 --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodList.php @@ -0,0 +1,439 @@ + + */ +class PaymentMethodList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\PaymentMethod\PaymentMethod[]', + 'has_more' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'has_more' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'has_more' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'has_more' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'has_more' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'has_more' => 'getHasMore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \PaymentMethod\PaymentMethod[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \PaymentMethod\PaymentMethod[] $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets has_more + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool|null $has_more has_more + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodParameters.php b/lib/PaymentMethod/PaymentMethodParameters.php new file mode 100644 index 0000000..1ee30ad --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodParameters.php @@ -0,0 +1,885 @@ + + */ +class PaymentMethodParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Xendit\PaymentMethod\PaymentMethodType', + 'country' => 'string', + 'reusability' => '\Xendit\PaymentMethod\PaymentMethodReusability', + 'customer_id' => 'string', + 'reference_id' => 'string', + 'description' => 'string', + 'card' => '\Xendit\PaymentMethod\CardParameters', + 'direct_debit' => '\Xendit\PaymentMethod\DirectDebitParameters', + 'ewallet' => '\Xendit\PaymentMethod\EWalletParameters', + 'over_the_counter' => '\Xendit\PaymentMethod\OverTheCounterParameters', + 'virtual_account' => '\Xendit\PaymentMethod\VirtualAccountParameters', + 'qr_code' => '\Xendit\PaymentMethod\QRCodeParameters', + 'metadata' => 'object', + 'billing_information' => '\Xendit\PaymentMethod\BillingInformation' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'country' => null, + 'reusability' => null, + 'customer_id' => null, + 'reference_id' => null, + 'description' => null, + 'card' => null, + 'direct_debit' => null, + 'ewallet' => null, + 'over_the_counter' => null, + 'virtual_account' => null, + 'qr_code' => null, + 'metadata' => null, + 'billing_information' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'country' => true, + 'reusability' => false, + 'customer_id' => true, + 'reference_id' => false, + 'description' => true, + 'card' => false, + 'direct_debit' => false, + 'ewallet' => false, + 'over_the_counter' => false, + 'virtual_account' => false, + 'qr_code' => false, + 'metadata' => true, + 'billing_information' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'country' => 'country', + 'reusability' => 'reusability', + 'customer_id' => 'customer_id', + 'reference_id' => 'reference_id', + 'description' => 'description', + 'card' => 'card', + 'direct_debit' => 'direct_debit', + 'ewallet' => 'ewallet', + 'over_the_counter' => 'over_the_counter', + 'virtual_account' => 'virtual_account', + 'qr_code' => 'qr_code', + 'metadata' => 'metadata', + 'billing_information' => 'billing_information' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'country' => 'setCountry', + 'reusability' => 'setReusability', + 'customer_id' => 'setCustomerId', + 'reference_id' => 'setReferenceId', + 'description' => 'setDescription', + 'card' => 'setCard', + 'direct_debit' => 'setDirectDebit', + 'ewallet' => 'setEwallet', + 'over_the_counter' => 'setOverTheCounter', + 'virtual_account' => 'setVirtualAccount', + 'qr_code' => 'setQrCode', + 'metadata' => 'setMetadata', + 'billing_information' => 'setBillingInformation' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'country' => 'getCountry', + 'reusability' => 'getReusability', + 'customer_id' => 'getCustomerId', + 'reference_id' => 'getReferenceId', + 'description' => 'getDescription', + 'card' => 'getCard', + 'direct_debit' => 'getDirectDebit', + 'ewallet' => 'getEwallet', + 'over_the_counter' => 'getOverTheCounter', + 'virtual_account' => 'getVirtualAccount', + 'qr_code' => 'getQrCode', + 'metadata' => 'getMetadata', + 'billing_information' => 'getBillingInformation' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('reusability', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('card', $data ?? [], null); + $this->setIfExists('direct_debit', $data ?? [], null); + $this->setIfExists('ewallet', $data ?? [], null); + $this->setIfExists('over_the_counter', $data ?? [], null); + $this->setIfExists('virtual_account', $data ?? [], null); + $this->setIfExists('qr_code', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('billing_information', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['reusability'] === null) { + $invalidProperties[] = "'reusability' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \PaymentMethod\PaymentMethodType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentMethod\PaymentMethodType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets reusability + * + * @return \PaymentMethod\PaymentMethodReusability + */ + public function getReusability() + { + return $this->container['reusability']; + } + + /** + * Sets reusability + * + * @param \PaymentMethod\PaymentMethodReusability $reusability reusability + * + * @return self + */ + public function setReusability($reusability) + { + if (is_null($reusability)) { + throw new \InvalidArgumentException('non-nullable reusability cannot be null'); + } + $this->container['reusability'] = $reusability; + + return $this; + } + + /** + * Gets customer_id + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string|null $customer_id customer_id + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets card + * + * @return \PaymentMethod\CardParameters|null + */ + public function getCard() + { + return $this->container['card']; + } + + /** + * Sets card + * + * @param \PaymentMethod\CardParameters|null $card card + * + * @return self + */ + public function setCard($card) + { + if (is_null($card)) { + throw new \InvalidArgumentException('non-nullable card cannot be null'); + } + $this->container['card'] = $card; + + return $this; + } + + /** + * Gets direct_debit + * + * @return \PaymentMethod\DirectDebitParameters|null + */ + public function getDirectDebit() + { + return $this->container['direct_debit']; + } + + /** + * Sets direct_debit + * + * @param \PaymentMethod\DirectDebitParameters|null $direct_debit direct_debit + * + * @return self + */ + public function setDirectDebit($direct_debit) + { + if (is_null($direct_debit)) { + throw new \InvalidArgumentException('non-nullable direct_debit cannot be null'); + } + $this->container['direct_debit'] = $direct_debit; + + return $this; + } + + /** + * Gets ewallet + * + * @return \PaymentMethod\EWalletParameters|null + */ + public function getEwallet() + { + return $this->container['ewallet']; + } + + /** + * Sets ewallet + * + * @param \PaymentMethod\EWalletParameters|null $ewallet ewallet + * + * @return self + */ + public function setEwallet($ewallet) + { + if (is_null($ewallet)) { + throw new \InvalidArgumentException('non-nullable ewallet cannot be null'); + } + $this->container['ewallet'] = $ewallet; + + return $this; + } + + /** + * Gets over_the_counter + * + * @return \PaymentMethod\OverTheCounterParameters|null + */ + public function getOverTheCounter() + { + return $this->container['over_the_counter']; + } + + /** + * Sets over_the_counter + * + * @param \PaymentMethod\OverTheCounterParameters|null $over_the_counter over_the_counter + * + * @return self + */ + public function setOverTheCounter($over_the_counter) + { + if (is_null($over_the_counter)) { + throw new \InvalidArgumentException('non-nullable over_the_counter cannot be null'); + } + $this->container['over_the_counter'] = $over_the_counter; + + return $this; + } + + /** + * Gets virtual_account + * + * @return \PaymentMethod\VirtualAccountParameters|null + */ + public function getVirtualAccount() + { + return $this->container['virtual_account']; + } + + /** + * Sets virtual_account + * + * @param \PaymentMethod\VirtualAccountParameters|null $virtual_account virtual_account + * + * @return self + */ + public function setVirtualAccount($virtual_account) + { + if (is_null($virtual_account)) { + throw new \InvalidArgumentException('non-nullable virtual_account cannot be null'); + } + $this->container['virtual_account'] = $virtual_account; + + return $this; + } + + /** + * Gets qr_code + * + * @return \PaymentMethod\QRCodeParameters|null + */ + public function getQrCode() + { + return $this->container['qr_code']; + } + + /** + * Sets qr_code + * + * @param \PaymentMethod\QRCodeParameters|null $qr_code qr_code + * + * @return self + */ + public function setQrCode($qr_code) + { + if (is_null($qr_code)) { + throw new \InvalidArgumentException('non-nullable qr_code cannot be null'); + } + $this->container['qr_code'] = $qr_code; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets billing_information + * + * @return \PaymentMethod\BillingInformation|null + */ + public function getBillingInformation() + { + return $this->container['billing_information']; + } + + /** + * Sets billing_information + * + * @param \PaymentMethod\BillingInformation|null $billing_information billing_information + * + * @return self + */ + public function setBillingInformation($billing_information) + { + if (is_null($billing_information)) { + array_push($this->openAPINullablesSetToNull, 'billing_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('billing_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['billing_information'] = $billing_information; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodReusability.php b/lib/PaymentMethod/PaymentMethodReusability.php new file mode 100644 index 0000000..9dc9efd --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodReusability.php @@ -0,0 +1,78 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodReusability: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::MULTIPLE_USE, + self::ONE_TIME_USE + ]; + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodStatus.php b/lib/PaymentMethod/PaymentMethodStatus.php new file mode 100644 index 0000000..cd70a9b --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodStatus.php @@ -0,0 +1,90 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodStatus: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::ACTIVE, + self::EXPIRED, + self::INACTIVE, + self::PENDING, + self::REQUIRES_ACTION, + self::FAILED + ]; + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodType.php b/lib/PaymentMethod/PaymentMethodType.php new file mode 100644 index 0000000..45ee9cc --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodType.php @@ -0,0 +1,96 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::CARD, + self::CRYPTOCURRENCY, + self::DIRECT_BANK_TRANSFER, + self::DIRECT_DEBIT, + self::EWALLET, + self::OVER_THE_COUNTER, + self::QR_CODE, + self::VIRTUAL_ACCOUNT + ]; + } +} + + diff --git a/lib/PaymentMethod/PaymentMethodUpdateParameters.php b/lib/PaymentMethod/PaymentMethodUpdateParameters.php new file mode 100644 index 0000000..ad92aad --- /dev/null +++ b/lib/PaymentMethod/PaymentMethodUpdateParameters.php @@ -0,0 +1,572 @@ + + */ +class PaymentMethodUpdateParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodUpdateParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'description' => 'string', + 'reference_id' => 'string', + 'reusability' => '\Xendit\PaymentMethod\PaymentMethodReusability', + 'status' => '\Xendit\PaymentMethod\PaymentMethodStatus', + 'over_the_counter' => '\Xendit\PaymentMethod\OverTheCounterUpdateParameters', + 'virtual_account' => '\Xendit\PaymentMethod\VirtualAccountUpdateParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'description' => null, + 'reference_id' => null, + 'reusability' => null, + 'status' => null, + 'over_the_counter' => null, + 'virtual_account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'description' => false, + 'reference_id' => false, + 'reusability' => false, + 'status' => false, + 'over_the_counter' => false, + 'virtual_account' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'reference_id' => 'reference_id', + 'reusability' => 'reusability', + 'status' => 'status', + 'over_the_counter' => 'over_the_counter', + 'virtual_account' => 'virtual_account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'reference_id' => 'setReferenceId', + 'reusability' => 'setReusability', + 'status' => 'setStatus', + 'over_the_counter' => 'setOverTheCounter', + 'virtual_account' => 'setVirtualAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'reference_id' => 'getReferenceId', + 'reusability' => 'getReusability', + 'status' => 'getStatus', + 'over_the_counter' => 'getOverTheCounter', + 'virtual_account' => 'getVirtualAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('reusability', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('over_the_counter', $data ?? [], null); + $this->setIfExists('virtual_account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets reusability + * + * @return \PaymentMethod\PaymentMethodReusability|null + */ + public function getReusability() + { + return $this->container['reusability']; + } + + /** + * Sets reusability + * + * @param \PaymentMethod\PaymentMethodReusability|null $reusability reusability + * + * @return self + */ + public function setReusability($reusability) + { + if (is_null($reusability)) { + throw new \InvalidArgumentException('non-nullable reusability cannot be null'); + } + $this->container['reusability'] = $reusability; + + return $this; + } + + /** + * Gets status + * + * @return \PaymentMethod\PaymentMethodStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \PaymentMethod\PaymentMethodStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets over_the_counter + * + * @return \PaymentMethod\OverTheCounterUpdateParameters|null + */ + public function getOverTheCounter() + { + return $this->container['over_the_counter']; + } + + /** + * Sets over_the_counter + * + * @param \PaymentMethod\OverTheCounterUpdateParameters|null $over_the_counter over_the_counter + * + * @return self + */ + public function setOverTheCounter($over_the_counter) + { + if (is_null($over_the_counter)) { + throw new \InvalidArgumentException('non-nullable over_the_counter cannot be null'); + } + $this->container['over_the_counter'] = $over_the_counter; + + return $this; + } + + /** + * Gets virtual_account + * + * @return \PaymentMethod\VirtualAccountUpdateParameters|null + */ + public function getVirtualAccount() + { + return $this->container['virtual_account']; + } + + /** + * Sets virtual_account + * + * @param \PaymentMethod\VirtualAccountUpdateParameters|null $virtual_account virtual_account + * + * @return self + */ + public function setVirtualAccount($virtual_account) + { + if (is_null($virtual_account)) { + throw new \InvalidArgumentException('non-nullable virtual_account cannot be null'); + } + $this->container['virtual_account'] = $virtual_account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/QRCode.php b/lib/PaymentMethod/QRCode.php new file mode 100644 index 0000000..4762d65 --- /dev/null +++ b/lib/PaymentMethod/QRCode.php @@ -0,0 +1,526 @@ + + */ +class QRCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\QRCodeChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\QRCodeChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => true, + 'channel_properties' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\QRCodeChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\QRCodeChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + array_push($this->openAPINullablesSetToNull, 'channel_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\QRCodeChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\QRCodeChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/QRCodeChannelCode.php b/lib/PaymentMethod/QRCodeChannelCode.php new file mode 100644 index 0000000..d96e7f8 --- /dev/null +++ b/lib/PaymentMethod/QRCodeChannelCode.php @@ -0,0 +1,88 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum QRCodeChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::QRIS, + self::DANA, + self::RCBC, + self::PROMPTPAY, + self::LINKAJA + ]; + } +} + + diff --git a/lib/PaymentMethod/QRCodeChannelProperties.php b/lib/PaymentMethod/QRCodeChannelProperties.php new file mode 100644 index 0000000..d0fb293 --- /dev/null +++ b/lib/PaymentMethod/QRCodeChannelProperties.php @@ -0,0 +1,437 @@ + + */ +class QRCodeChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCodeChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qr_string' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qr_string' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qr_string' => false, + 'expires_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'qr_string' => 'qr_string', + 'expires_at' => 'expires_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qr_string' => 'setQrString', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qr_string' => 'getQrString', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('qr_string', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets qr_string + * + * @return string|null + */ + public function getQrString() + { + return $this->container['qr_string']; + } + + /** + * Sets qr_string + * + * @param string|null $qr_string QR string to be rendered for display to end users. QR string to image rendering are commonly available in software libraries (e.g Nodejs, PHP, Java) + * + * @return self + */ + public function setQrString($qr_string) + { + if (is_null($qr_string)) { + throw new \InvalidArgumentException('non-nullable qr_string cannot be null'); + } + $this->container['qr_string'] = $qr_string; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/QRCodeParameters.php b/lib/PaymentMethod/QRCodeParameters.php new file mode 100644 index 0000000..9a8625d --- /dev/null +++ b/lib/PaymentMethod/QRCodeParameters.php @@ -0,0 +1,525 @@ + + */ +class QRCodeParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCodeParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\QRCodeChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\QRCodeChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => true, + 'channel_properties' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\QRCodeChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\QRCodeChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + array_push($this->openAPINullablesSetToNull, 'channel_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\QRCodeChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\QRCodeChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/SimulatePaymentRequest.php b/lib/PaymentMethod/SimulatePaymentRequest.php new file mode 100644 index 0000000..4d452b6 --- /dev/null +++ b/lib/PaymentMethod/SimulatePaymentRequest.php @@ -0,0 +1,402 @@ + + */ +class SimulatePaymentRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'simulatePayment_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/TokenizedCardInformation.php b/lib/PaymentMethod/TokenizedCardInformation.php new file mode 100644 index 0000000..03b8800 --- /dev/null +++ b/lib/PaymentMethod/TokenizedCardInformation.php @@ -0,0 +1,743 @@ + + */ +class TokenizedCardInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TokenizedCardInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'token_id' => 'string', + 'masked_card_number' => 'string', + 'cardholder_name' => 'string', + 'expiry_month' => 'string', + 'expiry_year' => 'string', + 'fingerprint' => 'string', + 'type' => 'string', + 'network' => 'string', + 'country' => 'string', + 'issuer' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'token_id' => null, + 'masked_card_number' => null, + 'cardholder_name' => null, + 'expiry_month' => null, + 'expiry_year' => null, + 'fingerprint' => null, + 'type' => null, + 'network' => null, + 'country' => null, + 'issuer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'token_id' => false, + 'masked_card_number' => false, + 'cardholder_name' => true, + 'expiry_month' => false, + 'expiry_year' => false, + 'fingerprint' => false, + 'type' => false, + 'network' => false, + 'country' => false, + 'issuer' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'token_id' => 'token_id', + 'masked_card_number' => 'masked_card_number', + 'cardholder_name' => 'cardholder_name', + 'expiry_month' => 'expiry_month', + 'expiry_year' => 'expiry_year', + 'fingerprint' => 'fingerprint', + 'type' => 'type', + 'network' => 'network', + 'country' => 'country', + 'issuer' => 'issuer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'token_id' => 'setTokenId', + 'masked_card_number' => 'setMaskedCardNumber', + 'cardholder_name' => 'setCardholderName', + 'expiry_month' => 'setExpiryMonth', + 'expiry_year' => 'setExpiryYear', + 'fingerprint' => 'setFingerprint', + 'type' => 'setType', + 'network' => 'setNetwork', + 'country' => 'setCountry', + 'issuer' => 'setIssuer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'token_id' => 'getTokenId', + 'masked_card_number' => 'getMaskedCardNumber', + 'cardholder_name' => 'getCardholderName', + 'expiry_month' => 'getExpiryMonth', + 'expiry_year' => 'getExpiryYear', + 'fingerprint' => 'getFingerprint', + 'type' => 'getType', + 'network' => 'getNetwork', + 'country' => 'getCountry', + 'issuer' => 'getIssuer' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('token_id', $data ?? [], null); + $this->setIfExists('masked_card_number', $data ?? [], null); + $this->setIfExists('cardholder_name', $data ?? [], null); + $this->setIfExists('expiry_month', $data ?? [], null); + $this->setIfExists('expiry_year', $data ?? [], null); + $this->setIfExists('fingerprint', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('network', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('issuer', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['token_id'] === null) { + $invalidProperties[] = "'token_id' can't be null"; + } + if ($this->container['masked_card_number'] === null) { + $invalidProperties[] = "'masked_card_number' can't be null"; + } + if ($this->container['expiry_month'] === null) { + $invalidProperties[] = "'expiry_month' can't be null"; + } + if ($this->container['expiry_year'] === null) { + $invalidProperties[] = "'expiry_year' can't be null"; + } + if ($this->container['fingerprint'] === null) { + $invalidProperties[] = "'fingerprint' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['network'] === null) { + $invalidProperties[] = "'network' can't be null"; + } + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if ($this->container['issuer'] === null) { + $invalidProperties[] = "'issuer' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets token_id + * + * @return string + */ + public function getTokenId() + { + return $this->container['token_id']; + } + + /** + * Sets token_id + * + * @param string $token_id token_id + * + * @return self + */ + public function setTokenId($token_id) + { + if (is_null($token_id)) { + throw new \InvalidArgumentException('non-nullable token_id cannot be null'); + } + $this->container['token_id'] = $token_id; + + return $this; + } + + /** + * Gets masked_card_number + * + * @return string + */ + public function getMaskedCardNumber() + { + return $this->container['masked_card_number']; + } + + /** + * Sets masked_card_number + * + * @param string $masked_card_number 1st 6 and last 4 digits of the card + * + * @return self + */ + public function setMaskedCardNumber($masked_card_number) + { + if (is_null($masked_card_number)) { + throw new \InvalidArgumentException('non-nullable masked_card_number cannot be null'); + } + $this->container['masked_card_number'] = $masked_card_number; + + return $this; + } + + /** + * Gets cardholder_name + * + * @return string|null + */ + public function getCardholderName() + { + return $this->container['cardholder_name']; + } + + /** + * Sets cardholder_name + * + * @param string|null $cardholder_name Cardholder name is optional but recommended for 3DS 2 / AVS verification + * + * @return self + */ + public function setCardholderName($cardholder_name) + { + if (is_null($cardholder_name)) { + array_push($this->openAPINullablesSetToNull, 'cardholder_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardholder_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardholder_name'] = $cardholder_name; + + return $this; + } + + /** + * Gets expiry_month + * + * @return string + */ + public function getExpiryMonth() + { + return $this->container['expiry_month']; + } + + /** + * Sets expiry_month + * + * @param string $expiry_month Card expiry month in MM format + * + * @return self + */ + public function setExpiryMonth($expiry_month) + { + if (is_null($expiry_month)) { + throw new \InvalidArgumentException('non-nullable expiry_month cannot be null'); + } + $this->container['expiry_month'] = $expiry_month; + + return $this; + } + + /** + * Gets expiry_year + * + * @return string + */ + public function getExpiryYear() + { + return $this->container['expiry_year']; + } + + /** + * Sets expiry_year + * + * @param string $expiry_year Card expiry month in YY format + * + * @return self + */ + public function setExpiryYear($expiry_year) + { + if (is_null($expiry_year)) { + throw new \InvalidArgumentException('non-nullable expiry_year cannot be null'); + } + $this->container['expiry_year'] = $expiry_year; + + return $this; + } + + /** + * Gets fingerprint + * + * @return string + */ + public function getFingerprint() + { + return $this->container['fingerprint']; + } + + /** + * Sets fingerprint + * + * @param string $fingerprint Xendit-generated identifier for the unique card number. Multiple payment method objects can be created for the same account - e.g. if the user first creates a one-time payment request, and then later on creates a multiple-use payment method using the same account. The fingerprint helps to identify the unique account being used. + * + * @return self + */ + public function setFingerprint($fingerprint) + { + if (is_null($fingerprint)) { + throw new \InvalidArgumentException('non-nullable fingerprint cannot be null'); + } + $this->container['fingerprint'] = $fingerprint; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Whether the card is a credit or debit card + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets network + * + * @return string + */ + public function getNetwork() + { + return $this->container['network']; + } + + /** + * Sets network + * + * @param string $network Card network - VISA, MASTERCARD, JCB, AMEX, DISCOVER, BCA + * + * @return self + */ + public function setNetwork($network) + { + if (is_null($network)) { + throw new \InvalidArgumentException('non-nullable network cannot be null'); + } + $this->container['network'] = $network; + + return $this; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country Country where the card was issued ISO 3166-1 Alpha-2 + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets issuer + * + * @return string + */ + public function getIssuer() + { + return $this->container['issuer']; + } + + /** + * Sets issuer + * + * @param string $issuer Issuer of the card, most often an issuing bank For example, “BCA”, “MANDIRI” + * + * @return self + */ + public function setIssuer($issuer) + { + if (is_null($issuer)) { + throw new \InvalidArgumentException('non-nullable issuer cannot be null'); + } + $this->container['issuer'] = $issuer; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccount.php b/lib/PaymentMethod/VirtualAccount.php new file mode 100644 index 0000000..4183b07 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccount.php @@ -0,0 +1,708 @@ + + */ +class VirtualAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'min_amount' => 'float', + 'max_amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\VirtualAccountChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\VirtualAccountChannelProperties', + 'alternative_display_types' => 'string[]', + 'alternative_displays' => '\Xendit\PaymentMethod\VirtualAccountAlternativeDisplay[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'min_amount' => 'double', + 'max_amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'alternative_display_types' => null, + 'alternative_displays' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'min_amount' => true, + 'max_amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'alternative_display_types' => false, + 'alternative_displays' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'alternative_display_types' => 'alternative_display_types', + 'alternative_displays' => 'alternative_displays' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'alternative_display_types' => 'setAlternativeDisplayTypes', + 'alternative_displays' => 'setAlternativeDisplays' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'alternative_display_types' => 'getAlternativeDisplayTypes', + 'alternative_displays' => 'getAlternativeDisplays' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ALTERNATIVE_DISPLAY_TYPES_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativeDisplayTypesAllowableValues() + { + return [ + self::ALTERNATIVE_DISPLAY_TYPES_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('alternative_display_types', $data ?? [], null); + $this->setIfExists('alternative_displays', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['min_amount']) && ($this->container['min_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'min_amount', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['max_amount']) && ($this->container['max_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'max_amount', must be bigger than or equal to 1."; + } + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($min_amount) && ($min_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $min_amount when calling VirtualAccount., must be bigger than or equal to 1.'); + } + + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($max_amount) && ($max_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $max_amount when calling VirtualAccount., must be bigger than or equal to 1.'); + } + + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\VirtualAccountChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\VirtualAccountChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\VirtualAccountChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\VirtualAccountChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets alternative_display_types + * + * @return string[]|null + */ + public function getAlternativeDisplayTypes() + { + return $this->container['alternative_display_types']; + } + + /** + * Sets alternative_display_types + * + * @param string[]|null $alternative_display_types For payments in Vietnam only, alternative display requested for the virtual account + * + * @return self + */ + public function setAlternativeDisplayTypes($alternative_display_types) + { + if (is_null($alternative_display_types)) { + throw new \InvalidArgumentException('non-nullable alternative_display_types cannot be null'); + } + $allowedValues = $this->getAlternativeDisplayTypesAllowableValues(); + if (array_diff($alternative_display_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternative_display_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternative_display_types'] = $alternative_display_types; + + return $this; + } + + /** + * Gets alternative_displays + * + * @return \PaymentMethod\VirtualAccountAlternativeDisplay[]|null + */ + public function getAlternativeDisplays() + { + return $this->container['alternative_displays']; + } + + /** + * Sets alternative_displays + * + * @param \PaymentMethod\VirtualAccountAlternativeDisplay[]|null $alternative_displays alternative_displays + * + * @return self + */ + public function setAlternativeDisplays($alternative_displays) + { + if (is_null($alternative_displays)) { + throw new \InvalidArgumentException('non-nullable alternative_displays cannot be null'); + } + $this->container['alternative_displays'] = $alternative_displays; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountAllOf.php b/lib/PaymentMethod/VirtualAccountAllOf.php new file mode 100644 index 0000000..95dd970 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountAllOf.php @@ -0,0 +1,402 @@ + + */ +class VirtualAccountAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccount_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alternative_displays' => '\Xendit\PaymentMethod\VirtualAccountAlternativeDisplay[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alternative_displays' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alternative_displays' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alternative_displays' => 'alternative_displays' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alternative_displays' => 'setAlternativeDisplays' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alternative_displays' => 'getAlternativeDisplays' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('alternative_displays', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alternative_displays + * + * @return \PaymentMethod\VirtualAccountAlternativeDisplay[]|null + */ + public function getAlternativeDisplays() + { + return $this->container['alternative_displays']; + } + + /** + * Sets alternative_displays + * + * @param \PaymentMethod\VirtualAccountAlternativeDisplay[]|null $alternative_displays alternative_displays + * + * @return self + */ + public function setAlternativeDisplays($alternative_displays) + { + if (is_null($alternative_displays)) { + throw new \InvalidArgumentException('non-nullable alternative_displays cannot be null'); + } + $this->container['alternative_displays'] = $alternative_displays; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountAlternativeDisplay.php b/lib/PaymentMethod/VirtualAccountAlternativeDisplay.php new file mode 100644 index 0000000..eb4c576 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountAlternativeDisplay.php @@ -0,0 +1,469 @@ + + */ +class VirtualAccountAlternativeDisplay implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountAlternativeDisplay'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const TYPE_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the alternative display + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets data + * + * @return string|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string|null $data Data payload of the given alternative display + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountChannelCode.php b/lib/PaymentMethod/VirtualAccountChannelCode.php new file mode 100644 index 0000000..daf2c26 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountChannelCode.php @@ -0,0 +1,115 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum VirtualAccountChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BCA, + self::BJB, + self::BNI, + self::BRI, + self::MANDIRI, + self::PERMATA, + self::BSI, + self::CIMB, + self::SAHABAT_SAMPOERNA, + self::ARTAJASA, + self::PV, + self::VIETCAPITAL, + self::WOORI, + self::MSB + ]; + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountChannelProperties.php b/lib/PaymentMethod/VirtualAccountChannelProperties.php new file mode 100644 index 0000000..345b390 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountChannelProperties.php @@ -0,0 +1,505 @@ + + */ +class VirtualAccountChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer_name' => 'string', + 'virtual_account_number' => 'string', + 'expires_at' => '\DateTime', + 'suggested_amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer_name' => null, + 'virtual_account_number' => null, + 'expires_at' => 'date-time', + 'suggested_amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer_name' => false, + 'virtual_account_number' => false, + 'expires_at' => false, + 'suggested_amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customer_name' => 'customer_name', + 'virtual_account_number' => 'virtual_account_number', + 'expires_at' => 'expires_at', + 'suggested_amount' => 'suggested_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer_name' => 'setCustomerName', + 'virtual_account_number' => 'setVirtualAccountNumber', + 'expires_at' => 'setExpiresAt', + 'suggested_amount' => 'setSuggestedAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer_name' => 'getCustomerName', + 'virtual_account_number' => 'getVirtualAccountNumber', + 'expires_at' => 'getExpiresAt', + 'suggested_amount' => 'getSuggestedAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('virtual_account_number', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('suggested_amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customer_name + * + * @return string|null + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string|null $customer_name Name of customer. + * + * @return self + */ + public function setCustomerName($customer_name) + { + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets virtual_account_number + * + * @return string|null + */ + public function getVirtualAccountNumber() + { + return $this->container['virtual_account_number']; + } + + /** + * Sets virtual_account_number + * + * @param string|null $virtual_account_number You can assign specific Virtual Account number using this parameter. If you do not send one, one will be picked at random. Make sure the number you specify is within your Virtual Account range. + * + * @return self + */ + public function setVirtualAccountNumber($virtual_account_number) + { + if (is_null($virtual_account_number)) { + throw new \InvalidArgumentException('non-nullable virtual_account_number cannot be null'); + } + $this->container['virtual_account_number'] = $virtual_account_number; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets suggested_amount + * + * @return float|null + */ + public function getSuggestedAmount() + { + return $this->container['suggested_amount']; + } + + /** + * Sets suggested_amount + * + * @param float|null $suggested_amount The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) + * + * @return self + */ + public function setSuggestedAmount($suggested_amount) + { + if (is_null($suggested_amount)) { + throw new \InvalidArgumentException('non-nullable suggested_amount cannot be null'); + } + $this->container['suggested_amount'] = $suggested_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountChannelPropertiesPatch.php b/lib/PaymentMethod/VirtualAccountChannelPropertiesPatch.php new file mode 100644 index 0000000..4536a37 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountChannelPropertiesPatch.php @@ -0,0 +1,446 @@ + + */ +class VirtualAccountChannelPropertiesPatch implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountChannelPropertiesPatch'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expires_at' => '\DateTime', + 'suggested_amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expires_at' => 'date-time', + 'suggested_amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expires_at' => false, + 'suggested_amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'expires_at' => 'expires_at', + 'suggested_amount' => 'suggested_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expires_at' => 'setExpiresAt', + 'suggested_amount' => 'setSuggestedAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expires_at' => 'getExpiresAt', + 'suggested_amount' => 'getSuggestedAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('suggested_amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['suggested_amount']) && ($this->container['suggested_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'suggested_amount', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets suggested_amount + * + * @return float|null + */ + public function getSuggestedAmount() + { + return $this->container['suggested_amount']; + } + + /** + * Sets suggested_amount + * + * @param float|null $suggested_amount The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) + * + * @return self + */ + public function setSuggestedAmount($suggested_amount) + { + if (is_null($suggested_amount)) { + throw new \InvalidArgumentException('non-nullable suggested_amount cannot be null'); + } + + if (($suggested_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $suggested_amount when calling VirtualAccountChannelPropertiesPatch., must be bigger than or equal to 1.'); + } + + $this->container['suggested_amount'] = $suggested_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountParameters.php b/lib/PaymentMethod/VirtualAccountParameters.php new file mode 100644 index 0000000..494d30b --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountParameters.php @@ -0,0 +1,673 @@ + + */ +class VirtualAccountParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'min_amount' => 'float', + 'max_amount' => 'float', + 'currency' => 'string', + 'channel_code' => '\Xendit\PaymentMethod\VirtualAccountChannelCode', + 'channel_properties' => '\Xendit\PaymentMethod\VirtualAccountChannelProperties', + 'alternative_display_types' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'min_amount' => 'double', + 'max_amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'alternative_display_types' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'min_amount' => true, + 'max_amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'alternative_display_types' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'alternative_display_types' => 'alternative_display_types' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'alternative_display_types' => 'setAlternativeDisplayTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'alternative_display_types' => 'getAlternativeDisplayTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ALTERNATIVE_DISPLAY_TYPES_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativeDisplayTypesAllowableValues() + { + return [ + self::ALTERNATIVE_DISPLAY_TYPES_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('alternative_display_types', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['min_amount']) && ($this->container['min_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'min_amount', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['max_amount']) && ($this->container['max_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'max_amount', must be bigger than or equal to 1."; + } + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($min_amount) && ($min_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $min_amount when calling VirtualAccountParameters., must be bigger than or equal to 1.'); + } + + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($max_amount) && ($max_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $max_amount when calling VirtualAccountParameters., must be bigger than or equal to 1.'); + } + + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentMethod\VirtualAccountChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentMethod\VirtualAccountChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\VirtualAccountChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\VirtualAccountChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets alternative_display_types + * + * @return string[]|null + */ + public function getAlternativeDisplayTypes() + { + return $this->container['alternative_display_types']; + } + + /** + * Sets alternative_display_types + * + * @param string[]|null $alternative_display_types For payments in Vietnam only, alternative display requested for the virtual account + * + * @return self + */ + public function setAlternativeDisplayTypes($alternative_display_types) + { + if (is_null($alternative_display_types)) { + throw new \InvalidArgumentException('non-nullable alternative_display_types cannot be null'); + } + $allowedValues = $this->getAlternativeDisplayTypesAllowableValues(); + if (array_diff($alternative_display_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternative_display_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternative_display_types'] = $alternative_display_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentMethod/VirtualAccountUpdateParameters.php b/lib/PaymentMethod/VirtualAccountUpdateParameters.php new file mode 100644 index 0000000..7823058 --- /dev/null +++ b/lib/PaymentMethod/VirtualAccountUpdateParameters.php @@ -0,0 +1,599 @@ + + */ +class VirtualAccountUpdateParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountUpdateParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'min_amount' => 'float', + 'max_amount' => 'float', + 'channel_properties' => '\Xendit\PaymentMethod\VirtualAccountChannelPropertiesPatch', + 'alternative_display_types' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'min_amount' => 'double', + 'max_amount' => 'double', + 'channel_properties' => null, + 'alternative_display_types' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'min_amount' => true, + 'max_amount' => true, + 'channel_properties' => false, + 'alternative_display_types' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'channel_properties' => 'channel_properties', + 'alternative_display_types' => 'alternative_display_types' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'channel_properties' => 'setChannelProperties', + 'alternative_display_types' => 'setAlternativeDisplayTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'channel_properties' => 'getChannelProperties', + 'alternative_display_types' => 'getAlternativeDisplayTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ALTERNATIVE_DISPLAY_TYPES_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativeDisplayTypesAllowableValues() + { + return [ + self::ALTERNATIVE_DISPLAY_TYPES_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('alternative_display_types', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['min_amount']) && ($this->container['min_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'min_amount', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['max_amount']) && ($this->container['max_amount'] < 1)) { + $invalidProperties[] = "invalid value for 'max_amount', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($min_amount) && ($min_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $min_amount when calling VirtualAccountUpdateParameters., must be bigger than or equal to 1.'); + } + + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($max_amount) && ($max_amount < 1)) { + throw new \InvalidArgumentException('invalid value for $max_amount when calling VirtualAccountUpdateParameters., must be bigger than or equal to 1.'); + } + + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentMethod\VirtualAccountChannelPropertiesPatch|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentMethod\VirtualAccountChannelPropertiesPatch|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets alternative_display_types + * + * @return string[]|null + */ + public function getAlternativeDisplayTypes() + { + return $this->container['alternative_display_types']; + } + + /** + * Sets alternative_display_types + * + * @param string[]|null $alternative_display_types For payments in Vietnam only, alternative display requested for the virtual account + * + * @return self + */ + public function setAlternativeDisplayTypes($alternative_display_types) + { + if (is_null($alternative_display_types)) { + throw new \InvalidArgumentException('non-nullable alternative_display_types cannot be null'); + } + $allowedValues = $this->getAlternativeDisplayTypesAllowableValues(); + if (array_diff($alternative_display_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternative_display_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternative_display_types'] = $alternative_display_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/Capture.php b/lib/PaymentRequest/Capture.php new file mode 100644 index 0000000..9e4b8ad --- /dev/null +++ b/lib/PaymentRequest/Capture.php @@ -0,0 +1,985 @@ + + */ +class Capture implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Capture'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'payment_request_id' => 'string', + 'payment_id' => 'string', + 'reference_id' => 'string', + 'currency' => 'string', + 'authorized_amount' => 'float', + 'captured_amount' => 'float', + 'status' => 'string', + 'payment_method' => '\Xendit\PaymentRequest\PaymentMethod', + 'failure_code' => 'string', + 'customer_id' => 'string', + 'metadata' => 'object', + 'channel_properties' => 'object', + 'created' => 'string', + 'updated' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'payment_request_id' => null, + 'payment_id' => null, + 'reference_id' => null, + 'currency' => null, + 'authorized_amount' => 'double', + 'captured_amount' => 'double', + 'status' => null, + 'payment_method' => null, + 'failure_code' => null, + 'customer_id' => null, + 'metadata' => null, + 'channel_properties' => null, + 'created' => null, + 'updated' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'payment_request_id' => false, + 'payment_id' => false, + 'reference_id' => false, + 'currency' => false, + 'authorized_amount' => false, + 'captured_amount' => false, + 'status' => false, + 'payment_method' => false, + 'failure_code' => true, + 'customer_id' => true, + 'metadata' => true, + 'channel_properties' => true, + 'created' => false, + 'updated' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'payment_request_id' => 'payment_request_id', + 'payment_id' => 'payment_id', + 'reference_id' => 'reference_id', + 'currency' => 'currency', + 'authorized_amount' => 'authorized_amount', + 'captured_amount' => 'captured_amount', + 'status' => 'status', + 'payment_method' => 'payment_method', + 'failure_code' => 'failure_code', + 'customer_id' => 'customer_id', + 'metadata' => 'metadata', + 'channel_properties' => 'channel_properties', + 'created' => 'created', + 'updated' => 'updated' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'payment_request_id' => 'setPaymentRequestId', + 'payment_id' => 'setPaymentId', + 'reference_id' => 'setReferenceId', + 'currency' => 'setCurrency', + 'authorized_amount' => 'setAuthorizedAmount', + 'captured_amount' => 'setCapturedAmount', + 'status' => 'setStatus', + 'payment_method' => 'setPaymentMethod', + 'failure_code' => 'setFailureCode', + 'customer_id' => 'setCustomerId', + 'metadata' => 'setMetadata', + 'channel_properties' => 'setChannelProperties', + 'created' => 'setCreated', + 'updated' => 'setUpdated' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'payment_request_id' => 'getPaymentRequestId', + 'payment_id' => 'getPaymentId', + 'reference_id' => 'getReferenceId', + 'currency' => 'getCurrency', + 'authorized_amount' => 'getAuthorizedAmount', + 'captured_amount' => 'getCapturedAmount', + 'status' => 'getStatus', + 'payment_method' => 'getPaymentMethod', + 'failure_code' => 'getFailureCode', + 'customer_id' => 'getCustomerId', + 'metadata' => 'getMetadata', + 'channel_properties' => 'getChannelProperties', + 'created' => 'getCreated', + 'updated' => 'getUpdated' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('payment_request_id', $data ?? [], null); + $this->setIfExists('payment_id', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('authorized_amount', $data ?? [], null); + $this->setIfExists('captured_amount', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['payment_request_id'] === null) { + $invalidProperties[] = "'payment_request_id' can't be null"; + } + if ($this->container['payment_id'] === null) { + $invalidProperties[] = "'payment_id' can't be null"; + } + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['authorized_amount'] === null) { + $invalidProperties[] = "'authorized_amount' can't be null"; + } + if ($this->container['captured_amount'] === null) { + $invalidProperties[] = "'captured_amount' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['payment_method'] === null) { + $invalidProperties[] = "'payment_method' can't be null"; + } + if ($this->container['failure_code'] === null) { + $invalidProperties[] = "'failure_code' can't be null"; + } + if ($this->container['customer_id'] === null) { + $invalidProperties[] = "'customer_id' can't be null"; + } + if ($this->container['metadata'] === null) { + $invalidProperties[] = "'metadata' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets payment_request_id + * + * @return string + */ + public function getPaymentRequestId() + { + return $this->container['payment_request_id']; + } + + /** + * Sets payment_request_id + * + * @param string $payment_request_id payment_request_id + * + * @return self + */ + public function setPaymentRequestId($payment_request_id) + { + if (is_null($payment_request_id)) { + throw new \InvalidArgumentException('non-nullable payment_request_id cannot be null'); + } + $this->container['payment_request_id'] = $payment_request_id; + + return $this; + } + + /** + * Gets payment_id + * + * @return string + */ + public function getPaymentId() + { + return $this->container['payment_id']; + } + + /** + * Sets payment_id + * + * @param string $payment_id payment_id + * + * @return self + */ + public function setPaymentId($payment_id) + { + if (is_null($payment_id)) { + throw new \InvalidArgumentException('non-nullable payment_id cannot be null'); + } + $this->container['payment_id'] = $payment_id; + + return $this; + } + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets authorized_amount + * + * @return float + */ + public function getAuthorizedAmount() + { + return $this->container['authorized_amount']; + } + + /** + * Sets authorized_amount + * + * @param float $authorized_amount authorized_amount + * + * @return self + */ + public function setAuthorizedAmount($authorized_amount) + { + if (is_null($authorized_amount)) { + throw new \InvalidArgumentException('non-nullable authorized_amount cannot be null'); + } + $this->container['authorized_amount'] = $authorized_amount; + + return $this; + } + + /** + * Gets captured_amount + * + * @return float + */ + public function getCapturedAmount() + { + return $this->container['captured_amount']; + } + + /** + * Sets captured_amount + * + * @param float $captured_amount captured_amount + * + * @return self + */ + public function setCapturedAmount($captured_amount) + { + if (is_null($captured_amount)) { + throw new \InvalidArgumentException('non-nullable captured_amount cannot be null'); + } + $this->container['captured_amount'] = $captured_amount; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets payment_method + * + * @return \PaymentRequest\PaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['payment_method']; + } + + /** + * Sets payment_method + * + * @param \PaymentRequest\PaymentMethod $payment_method payment_method + * + * @return self + */ + public function setPaymentMethod($payment_method) + { + if (is_null($payment_method)) { + throw new \InvalidArgumentException('non-nullable payment_method cannot be null'); + } + $this->container['payment_method'] = $payment_method; + + return $this; + } + + /** + * Gets failure_code + * + * @return string + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string $failure_code failure_code + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + array_push($this->openAPINullablesSetToNull, 'failure_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets customer_id + * + * @return string + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string $customer_id customer_id + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets metadata + * + * @return object + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets channel_properties + * + * @return object + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param object $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets created + * + * @return string + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string $created created + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string $updated updated + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CaptureListResponse.php b/lib/PaymentRequest/CaptureListResponse.php new file mode 100644 index 0000000..b6b2655 --- /dev/null +++ b/lib/PaymentRequest/CaptureListResponse.php @@ -0,0 +1,442 @@ + + */ +class CaptureListResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CaptureListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\PaymentRequest\Capture[]', + 'has_more' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'has_more' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'has_more' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'has_more' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'has_more' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'has_more' => 'getHasMore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['has_more'] === null) { + $invalidProperties[] = "'has_more' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \PaymentRequest\Capture[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \PaymentRequest\Capture[] $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets has_more + * + * @return bool + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool $has_more has_more + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CaptureParameters.php b/lib/PaymentRequest/CaptureParameters.php new file mode 100644 index 0000000..0af85b8 --- /dev/null +++ b/lib/PaymentRequest/CaptureParameters.php @@ -0,0 +1,446 @@ + + */ +class CaptureParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CaptureParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'capture_amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'capture_amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => true, + 'capture_amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'capture_amount' => 'capture_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'capture_amount' => 'setCaptureAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'capture_amount' => 'getCaptureAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('capture_amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['capture_amount'] === null) { + $invalidProperties[] = "'capture_amount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + array_push($this->openAPINullablesSetToNull, 'reference_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reference_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets capture_amount + * + * @return float + */ + public function getCaptureAmount() + { + return $this->container['capture_amount']; + } + + /** + * Sets capture_amount + * + * @param float $capture_amount capture_amount + * + * @return self + */ + public function setCaptureAmount($capture_amount) + { + if (is_null($capture_amount)) { + throw new \InvalidArgumentException('non-nullable capture_amount cannot be null'); + } + $this->container['capture_amount'] = $capture_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/Card.php b/lib/PaymentRequest/Card.php new file mode 100644 index 0000000..dacc2d0 --- /dev/null +++ b/lib/PaymentRequest/Card.php @@ -0,0 +1,520 @@ + + */ +class Card implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Card'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'channel_properties' => '\Xendit\PaymentRequest\CardChannelProperties', + 'card_information' => '\Xendit\PaymentRequest\CardInformation', + 'card_verification_results' => '\Xendit\PaymentRequest\CardVerificationResults' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'channel_properties' => null, + 'card_information' => null, + 'card_verification_results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'channel_properties' => false, + 'card_information' => false, + 'card_verification_results' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'channel_properties' => 'channel_properties', + 'card_information' => 'card_information', + 'card_verification_results' => 'card_verification_results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'channel_properties' => 'setChannelProperties', + 'card_information' => 'setCardInformation', + 'card_verification_results' => 'setCardVerificationResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'channel_properties' => 'getChannelProperties', + 'card_information' => 'getCardInformation', + 'card_verification_results' => 'getCardVerificationResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('card_information', $data ?? [], null); + $this->setIfExists('card_verification_results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['card_information'] === null) { + $invalidProperties[] = "'card_information' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\CardChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\CardChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets card_information + * + * @return \PaymentRequest\CardInformation + */ + public function getCardInformation() + { + return $this->container['card_information']; + } + + /** + * Sets card_information + * + * @param \PaymentRequest\CardInformation $card_information card_information + * + * @return self + */ + public function setCardInformation($card_information) + { + if (is_null($card_information)) { + throw new \InvalidArgumentException('non-nullable card_information cannot be null'); + } + $this->container['card_information'] = $card_information; + + return $this; + } + + /** + * Gets card_verification_results + * + * @return \PaymentRequest\CardVerificationResults|null + */ + public function getCardVerificationResults() + { + return $this->container['card_verification_results']; + } + + /** + * Sets card_verification_results + * + * @param \PaymentRequest\CardVerificationResults|null $card_verification_results card_verification_results + * + * @return self + */ + public function setCardVerificationResults($card_verification_results) + { + if (is_null($card_verification_results)) { + array_push($this->openAPINullablesSetToNull, 'card_verification_results'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_verification_results', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_verification_results'] = $card_verification_results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CardChannelProperties.php b/lib/PaymentRequest/CardChannelProperties.php new file mode 100644 index 0000000..a538268 --- /dev/null +++ b/lib/PaymentRequest/CardChannelProperties.php @@ -0,0 +1,585 @@ + + */ +class CardChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'skip_three_d_secure' => 'bool', + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cardonfile_type' => 'string', + 'merchant_id_tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'skip_three_d_secure' => null, + 'success_return_url' => null, + 'failure_return_url' => null, + 'cardonfile_type' => null, + 'merchant_id_tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'skip_three_d_secure' => true, + 'success_return_url' => true, + 'failure_return_url' => true, + 'cardonfile_type' => true, + 'merchant_id_tag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'skip_three_d_secure' => 'skip_three_d_secure', + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cardonfile_type' => 'cardonfile_type', + 'merchant_id_tag' => 'merchant_id_tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'skip_three_d_secure' => 'setSkipThreeDSecure', + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cardonfile_type' => 'setCardonfileType', + 'merchant_id_tag' => 'setMerchantIdTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'skip_three_d_secure' => 'getSkipThreeDSecure', + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cardonfile_type' => 'getCardonfileType', + 'merchant_id_tag' => 'getMerchantIdTag' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('skip_three_d_secure', $data ?? [], null); + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cardonfile_type', $data ?? [], null); + $this->setIfExists('merchant_id_tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets skip_three_d_secure + * + * @return bool|null + */ + public function getSkipThreeDSecure() + { + return $this->container['skip_three_d_secure']; + } + + /** + * Sets skip_three_d_secure + * + * @param bool|null $skip_three_d_secure To indicate whether to perform 3DS during the linking phase + * + * @return self + */ + public function setSkipThreeDSecure($skip_three_d_secure) + { + if (is_null($skip_three_d_secure)) { + array_push($this->openAPINullablesSetToNull, 'skip_three_d_secure'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skip_three_d_secure', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skip_three_d_secure'] = $skip_three_d_secure; + + return $this; + } + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + array_push($this->openAPINullablesSetToNull, 'success_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('success_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($success_return_url) && (!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling CardChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + array_push($this->openAPINullablesSetToNull, 'failure_return_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_return_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($failure_return_url) && (!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling CardChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cardonfile_type + * + * @return string|null + */ + public function getCardonfileType() + { + return $this->container['cardonfile_type']; + } + + /** + * Sets cardonfile_type + * + * @param string|null $cardonfile_type Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. + * + * @return self + */ + public function setCardonfileType($cardonfile_type) + { + if (is_null($cardonfile_type)) { + array_push($this->openAPINullablesSetToNull, 'cardonfile_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardonfile_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardonfile_type'] = $cardonfile_type; + + return $this; + } + + /** + * Gets merchant_id_tag + * + * @return string|null + */ + public function getMerchantIdTag() + { + return $this->container['merchant_id_tag']; + } + + /** + * Sets merchant_id_tag + * + * @param string|null $merchant_id_tag Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use + * + * @return self + */ + public function setMerchantIdTag($merchant_id_tag) + { + if (is_null($merchant_id_tag)) { + throw new \InvalidArgumentException('non-nullable merchant_id_tag cannot be null'); + } + $this->container['merchant_id_tag'] = $merchant_id_tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CardInformation.php b/lib/PaymentRequest/CardInformation.php new file mode 100644 index 0000000..f6f4af0 --- /dev/null +++ b/lib/PaymentRequest/CardInformation.php @@ -0,0 +1,768 @@ + + */ +class CardInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'token_id' => 'string', + 'masked_card_number' => 'string', + 'expiry_month' => 'string', + 'expiry_year' => 'string', + 'cardholder_name' => 'string', + 'fingerprint' => 'string', + 'type' => 'string', + 'network' => 'string', + 'country' => 'string', + 'issuer' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'token_id' => null, + 'masked_card_number' => null, + 'expiry_month' => null, + 'expiry_year' => null, + 'cardholder_name' => null, + 'fingerprint' => null, + 'type' => null, + 'network' => null, + 'country' => null, + 'issuer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'token_id' => false, + 'masked_card_number' => false, + 'expiry_month' => false, + 'expiry_year' => false, + 'cardholder_name' => true, + 'fingerprint' => false, + 'type' => false, + 'network' => false, + 'country' => false, + 'issuer' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'token_id' => 'token_id', + 'masked_card_number' => 'masked_card_number', + 'expiry_month' => 'expiry_month', + 'expiry_year' => 'expiry_year', + 'cardholder_name' => 'cardholder_name', + 'fingerprint' => 'fingerprint', + 'type' => 'type', + 'network' => 'network', + 'country' => 'country', + 'issuer' => 'issuer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'token_id' => 'setTokenId', + 'masked_card_number' => 'setMaskedCardNumber', + 'expiry_month' => 'setExpiryMonth', + 'expiry_year' => 'setExpiryYear', + 'cardholder_name' => 'setCardholderName', + 'fingerprint' => 'setFingerprint', + 'type' => 'setType', + 'network' => 'setNetwork', + 'country' => 'setCountry', + 'issuer' => 'setIssuer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'token_id' => 'getTokenId', + 'masked_card_number' => 'getMaskedCardNumber', + 'expiry_month' => 'getExpiryMonth', + 'expiry_year' => 'getExpiryYear', + 'cardholder_name' => 'getCardholderName', + 'fingerprint' => 'getFingerprint', + 'type' => 'getType', + 'network' => 'getNetwork', + 'country' => 'getCountry', + 'issuer' => 'getIssuer' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const NETWORK_VISA = 'VISA'; + public const NETWORK_MASTERCARD = 'MASTERCARD'; + public const NETWORK_JCB = 'JCB'; + public const NETWORK_AMEX = 'AMEX'; + public const NETWORK_DISCOVER = 'DISCOVER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNetworkAllowableValues() + { + return [ + self::NETWORK_VISA, + self::NETWORK_MASTERCARD, + self::NETWORK_JCB, + self::NETWORK_AMEX, + self::NETWORK_DISCOVER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('token_id', $data ?? [], null); + $this->setIfExists('masked_card_number', $data ?? [], null); + $this->setIfExists('expiry_month', $data ?? [], null); + $this->setIfExists('expiry_year', $data ?? [], null); + $this->setIfExists('cardholder_name', $data ?? [], null); + $this->setIfExists('fingerprint', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('network', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('issuer', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['token_id'] === null) { + $invalidProperties[] = "'token_id' can't be null"; + } + if ($this->container['masked_card_number'] === null) { + $invalidProperties[] = "'masked_card_number' can't be null"; + } + if ($this->container['expiry_month'] === null) { + $invalidProperties[] = "'expiry_month' can't be null"; + } + if ($this->container['expiry_year'] === null) { + $invalidProperties[] = "'expiry_year' can't be null"; + } + $allowedValues = $this->getNetworkAllowableValues(); + if (!is_null($this->container['network']) && !in_array($this->container['network'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'network', must be one of '%s'", + $this->container['network'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets token_id + * + * @return string + */ + public function getTokenId() + { + return $this->container['token_id']; + } + + /** + * Sets token_id + * + * @param string $token_id token_id + * + * @return self + */ + public function setTokenId($token_id) + { + if (is_null($token_id)) { + throw new \InvalidArgumentException('non-nullable token_id cannot be null'); + } + $this->container['token_id'] = $token_id; + + return $this; + } + + /** + * Gets masked_card_number + * + * @return string + */ + public function getMaskedCardNumber() + { + return $this->container['masked_card_number']; + } + + /** + * Sets masked_card_number + * + * @param string $masked_card_number 1st 6 and last 4 digits of the card + * + * @return self + */ + public function setMaskedCardNumber($masked_card_number) + { + if (is_null($masked_card_number)) { + throw new \InvalidArgumentException('non-nullable masked_card_number cannot be null'); + } + $this->container['masked_card_number'] = $masked_card_number; + + return $this; + } + + /** + * Gets expiry_month + * + * @return string + */ + public function getExpiryMonth() + { + return $this->container['expiry_month']; + } + + /** + * Sets expiry_month + * + * @param string $expiry_month Card expiry month in MM format + * + * @return self + */ + public function setExpiryMonth($expiry_month) + { + if (is_null($expiry_month)) { + throw new \InvalidArgumentException('non-nullable expiry_month cannot be null'); + } + $this->container['expiry_month'] = $expiry_month; + + return $this; + } + + /** + * Gets expiry_year + * + * @return string + */ + public function getExpiryYear() + { + return $this->container['expiry_year']; + } + + /** + * Sets expiry_year + * + * @param string $expiry_year Card expiry month in YY format + * + * @return self + */ + public function setExpiryYear($expiry_year) + { + if (is_null($expiry_year)) { + throw new \InvalidArgumentException('non-nullable expiry_year cannot be null'); + } + $this->container['expiry_year'] = $expiry_year; + + return $this; + } + + /** + * Gets cardholder_name + * + * @return string|null + */ + public function getCardholderName() + { + return $this->container['cardholder_name']; + } + + /** + * Sets cardholder_name + * + * @param string|null $cardholder_name Cardholder name + * + * @return self + */ + public function setCardholderName($cardholder_name) + { + if (is_null($cardholder_name)) { + array_push($this->openAPINullablesSetToNull, 'cardholder_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardholder_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardholder_name'] = $cardholder_name; + + return $this; + } + + /** + * Gets fingerprint + * + * @return string|null + */ + public function getFingerprint() + { + return $this->container['fingerprint']; + } + + /** + * Sets fingerprint + * + * @param string|null $fingerprint fingerprint + * + * @return self + */ + public function setFingerprint($fingerprint) + { + if (is_null($fingerprint)) { + throw new \InvalidArgumentException('non-nullable fingerprint cannot be null'); + } + $this->container['fingerprint'] = $fingerprint; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets network + * + * @return string|null + */ + public function getNetwork() + { + return $this->container['network']; + } + + /** + * Sets network + * + * @param string|null $network network + * + * @return self + */ + public function setNetwork($network) + { + if (is_null($network)) { + throw new \InvalidArgumentException('non-nullable network cannot be null'); + } + $allowedValues = $this->getNetworkAllowableValues(); + if (!in_array($network, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'network', must be one of '%s'", + $network, + implode("', '", $allowedValues) + ) + ); + } + $this->container['network'] = $network; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets issuer + * + * @return string|null + */ + public function getIssuer() + { + return $this->container['issuer']; + } + + /** + * Sets issuer + * + * @param string|null $issuer issuer + * + * @return self + */ + public function setIssuer($issuer) + { + if (is_null($issuer)) { + throw new \InvalidArgumentException('non-nullable issuer cannot be null'); + } + $this->container['issuer'] = $issuer; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CardVerificationResults.php b/lib/PaymentRequest/CardVerificationResults.php new file mode 100644 index 0000000..a67ff06 --- /dev/null +++ b/lib/PaymentRequest/CardVerificationResults.php @@ -0,0 +1,484 @@ + + */ +class CardVerificationResults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardVerificationResults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure' => '\Xendit\PaymentRequest\CardVerificationResultsThreeDSecure', + 'cvv_result' => 'string', + 'address_verification_result' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure' => null, + 'cvv_result' => null, + 'address_verification_result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure' => false, + 'cvv_result' => true, + 'address_verification_result' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure' => 'three_d_secure', + 'cvv_result' => 'cvv_result', + 'address_verification_result' => 'address_verification_result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure' => 'setThreeDSecure', + 'cvv_result' => 'setCvvResult', + 'address_verification_result' => 'setAddressVerificationResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure' => 'getThreeDSecure', + 'cvv_result' => 'getCvvResult', + 'address_verification_result' => 'getAddressVerificationResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure', $data ?? [], null); + $this->setIfExists('cvv_result', $data ?? [], null); + $this->setIfExists('address_verification_result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure + * + * @return \PaymentRequest\CardVerificationResultsThreeDSecure|null + */ + public function getThreeDSecure() + { + return $this->container['three_d_secure']; + } + + /** + * Sets three_d_secure + * + * @param \PaymentRequest\CardVerificationResultsThreeDSecure|null $three_d_secure three_d_secure + * + * @return self + */ + public function setThreeDSecure($three_d_secure) + { + if (is_null($three_d_secure)) { + throw new \InvalidArgumentException('non-nullable three_d_secure cannot be null'); + } + $this->container['three_d_secure'] = $three_d_secure; + + return $this; + } + + /** + * Gets cvv_result + * + * @return string|null + */ + public function getCvvResult() + { + return $this->container['cvv_result']; + } + + /** + * Sets cvv_result + * + * @param string|null $cvv_result cvv_result + * + * @return self + */ + public function setCvvResult($cvv_result) + { + if (is_null($cvv_result)) { + array_push($this->openAPINullablesSetToNull, 'cvv_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cvv_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cvv_result'] = $cvv_result; + + return $this; + } + + /** + * Gets address_verification_result + * + * @return string|null + */ + public function getAddressVerificationResult() + { + return $this->container['address_verification_result']; + } + + /** + * Sets address_verification_result + * + * @param string|null $address_verification_result address_verification_result + * + * @return self + */ + public function setAddressVerificationResult($address_verification_result) + { + if (is_null($address_verification_result)) { + array_push($this->openAPINullablesSetToNull, 'address_verification_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address_verification_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address_verification_result'] = $address_verification_result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/CardVerificationResultsThreeDSecure.php b/lib/PaymentRequest/CardVerificationResultsThreeDSecure.php new file mode 100644 index 0000000..f7fac62 --- /dev/null +++ b/lib/PaymentRequest/CardVerificationResultsThreeDSecure.php @@ -0,0 +1,607 @@ + + */ +class CardVerificationResultsThreeDSecure implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardVerificationResultsThreeDSecure'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure_flow' => 'string', + 'eci_code' => 'string', + 'three_d_secure_result' => 'string', + 'three_d_secure_result_reason' => 'string', + 'three_d_secure_version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure_flow' => null, + 'eci_code' => null, + 'three_d_secure_result' => null, + 'three_d_secure_result_reason' => null, + 'three_d_secure_version' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure_flow' => true, + 'eci_code' => true, + 'three_d_secure_result' => true, + 'three_d_secure_result_reason' => true, + 'three_d_secure_version' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure_flow' => 'three_d_secure_flow', + 'eci_code' => 'eci_code', + 'three_d_secure_result' => 'three_d_secure_result', + 'three_d_secure_result_reason' => 'three_d_secure_result_reason', + 'three_d_secure_version' => 'three_d_secure_version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure_flow' => 'setThreeDSecureFlow', + 'eci_code' => 'setEciCode', + 'three_d_secure_result' => 'setThreeDSecureResult', + 'three_d_secure_result_reason' => 'setThreeDSecureResultReason', + 'three_d_secure_version' => 'setThreeDSecureVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure_flow' => 'getThreeDSecureFlow', + 'eci_code' => 'getEciCode', + 'three_d_secure_result' => 'getThreeDSecureResult', + 'three_d_secure_result_reason' => 'getThreeDSecureResultReason', + 'three_d_secure_version' => 'getThreeDSecureVersion' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const THREE_D_SECURE_FLOW_CHALLENGE = 'CHALLENGE'; + public const THREE_D_SECURE_FLOW_FRICTIONLESS = 'FRICTIONLESS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getThreeDSecureFlowAllowableValues() + { + return [ + self::THREE_D_SECURE_FLOW_CHALLENGE, + self::THREE_D_SECURE_FLOW_FRICTIONLESS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure_flow', $data ?? [], null); + $this->setIfExists('eci_code', $data ?? [], null); + $this->setIfExists('three_d_secure_result', $data ?? [], null); + $this->setIfExists('three_d_secure_result_reason', $data ?? [], null); + $this->setIfExists('three_d_secure_version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getThreeDSecureFlowAllowableValues(); + if (!is_null($this->container['three_d_secure_flow']) && !in_array($this->container['three_d_secure_flow'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'three_d_secure_flow', must be one of '%s'", + $this->container['three_d_secure_flow'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure_flow + * + * @return string|null + */ + public function getThreeDSecureFlow() + { + return $this->container['three_d_secure_flow']; + } + + /** + * Sets three_d_secure_flow + * + * @param string|null $three_d_secure_flow three_d_secure_flow + * + * @return self + */ + public function setThreeDSecureFlow($three_d_secure_flow) + { + if (is_null($three_d_secure_flow)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_flow'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_flow', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getThreeDSecureFlowAllowableValues(); + if (!is_null($three_d_secure_flow) && !in_array($three_d_secure_flow, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'three_d_secure_flow', must be one of '%s'", + $three_d_secure_flow, + implode("', '", $allowedValues) + ) + ); + } + $this->container['three_d_secure_flow'] = $three_d_secure_flow; + + return $this; + } + + /** + * Gets eci_code + * + * @return string|null + */ + public function getEciCode() + { + return $this->container['eci_code']; + } + + /** + * Sets eci_code + * + * @param string|null $eci_code eci_code + * + * @return self + */ + public function setEciCode($eci_code) + { + if (is_null($eci_code)) { + array_push($this->openAPINullablesSetToNull, 'eci_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('eci_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['eci_code'] = $eci_code; + + return $this; + } + + /** + * Gets three_d_secure_result + * + * @return string|null + */ + public function getThreeDSecureResult() + { + return $this->container['three_d_secure_result']; + } + + /** + * Sets three_d_secure_result + * + * @param string|null $three_d_secure_result three_d_secure_result + * + * @return self + */ + public function setThreeDSecureResult($three_d_secure_result) + { + if (is_null($three_d_secure_result)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_result'] = $three_d_secure_result; + + return $this; + } + + /** + * Gets three_d_secure_result_reason + * + * @return string|null + */ + public function getThreeDSecureResultReason() + { + return $this->container['three_d_secure_result_reason']; + } + + /** + * Sets three_d_secure_result_reason + * + * @param string|null $three_d_secure_result_reason three_d_secure_result_reason + * + * @return self + */ + public function setThreeDSecureResultReason($three_d_secure_result_reason) + { + if (is_null($three_d_secure_result_reason)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_result_reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_result_reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_result_reason'] = $three_d_secure_result_reason; + + return $this; + } + + /** + * Gets three_d_secure_version + * + * @return string|null + */ + public function getThreeDSecureVersion() + { + return $this->container['three_d_secure_version']; + } + + /** + * Sets three_d_secure_version + * + * @param string|null $three_d_secure_version three_d_secure_version + * + * @return self + */ + public function setThreeDSecureVersion($three_d_secure_version) + { + if (is_null($three_d_secure_version)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_version'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_version', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_version'] = $three_d_secure_version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebit.php b/lib/PaymentRequest/DirectDebit.php new file mode 100644 index 0000000..0157a66 --- /dev/null +++ b/lib/PaymentRequest/DirectDebit.php @@ -0,0 +1,569 @@ + + */ +class DirectDebit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\DirectDebitChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\DirectDebitChannelProperties', + 'type' => '\Xendit\PaymentRequest\DirectDebitType', + 'bank_account' => '\Xendit\PaymentRequest\DirectDebitBankAccount', + 'debit_card' => '\Xendit\PaymentRequest\DirectDebitDebitCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'type' => null, + 'bank_account' => null, + 'debit_card' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => true, + 'type' => false, + 'bank_account' => true, + 'debit_card' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'type' => 'type', + 'bank_account' => 'bank_account', + 'debit_card' => 'debit_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'type' => 'setType', + 'bank_account' => 'setBankAccount', + 'debit_card' => 'setDebitCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'type' => 'getType', + 'bank_account' => 'getBankAccount', + 'debit_card' => 'getDebitCard' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('bank_account', $data ?? [], null); + $this->setIfExists('debit_card', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\DirectDebitChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\DirectDebitChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\DirectDebitChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\DirectDebitChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets type + * + * @return \PaymentRequest\DirectDebitType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentRequest\DirectDebitType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets bank_account + * + * @return \PaymentRequest\DirectDebitBankAccount|null + */ + public function getBankAccount() + { + return $this->container['bank_account']; + } + + /** + * Sets bank_account + * + * @param \PaymentRequest\DirectDebitBankAccount|null $bank_account bank_account + * + * @return self + */ + public function setBankAccount($bank_account) + { + if (is_null($bank_account)) { + array_push($this->openAPINullablesSetToNull, 'bank_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account'] = $bank_account; + + return $this; + } + + /** + * Gets debit_card + * + * @return \PaymentRequest\DirectDebitDebitCard|null + */ + public function getDebitCard() + { + return $this->container['debit_card']; + } + + /** + * Sets debit_card + * + * @param \PaymentRequest\DirectDebitDebitCard|null $debit_card debit_card + * + * @return self + */ + public function setDebitCard($debit_card) + { + if (is_null($debit_card)) { + array_push($this->openAPINullablesSetToNull, 'debit_card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('debit_card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['debit_card'] = $debit_card; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitAllOf.php b/lib/PaymentRequest/DirectDebitAllOf.php new file mode 100644 index 0000000..d912263 --- /dev/null +++ b/lib/PaymentRequest/DirectDebitAllOf.php @@ -0,0 +1,487 @@ + + */ +class DirectDebitAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebit_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Xendit\PaymentRequest\DirectDebitType', + 'bank_account' => '\Xendit\PaymentRequest\DirectDebitBankAccount', + 'debit_card' => '\Xendit\PaymentRequest\DirectDebitDebitCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'bank_account' => null, + 'debit_card' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'bank_account' => true, + 'debit_card' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'bank_account' => 'bank_account', + 'debit_card' => 'debit_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'bank_account' => 'setBankAccount', + 'debit_card' => 'setDebitCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'bank_account' => 'getBankAccount', + 'debit_card' => 'getDebitCard' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('bank_account', $data ?? [], null); + $this->setIfExists('debit_card', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \PaymentRequest\DirectDebitType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentRequest\DirectDebitType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets bank_account + * + * @return \PaymentRequest\DirectDebitBankAccount|null + */ + public function getBankAccount() + { + return $this->container['bank_account']; + } + + /** + * Sets bank_account + * + * @param \PaymentRequest\DirectDebitBankAccount|null $bank_account bank_account + * + * @return self + */ + public function setBankAccount($bank_account) + { + if (is_null($bank_account)) { + array_push($this->openAPINullablesSetToNull, 'bank_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account'] = $bank_account; + + return $this; + } + + /** + * Gets debit_card + * + * @return \PaymentRequest\DirectDebitDebitCard|null + */ + public function getDebitCard() + { + return $this->container['debit_card']; + } + + /** + * Sets debit_card + * + * @param \PaymentRequest\DirectDebitDebitCard|null $debit_card debit_card + * + * @return self + */ + public function setDebitCard($debit_card) + { + if (is_null($debit_card)) { + array_push($this->openAPINullablesSetToNull, 'debit_card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('debit_card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['debit_card'] = $debit_card; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitBankAccount.php b/lib/PaymentRequest/DirectDebitBankAccount.php new file mode 100644 index 0000000..e9fc01d --- /dev/null +++ b/lib/PaymentRequest/DirectDebitBankAccount.php @@ -0,0 +1,450 @@ + + */ +class DirectDebitBankAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitBankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'masked_bank_account_number' => 'string', + 'bank_account_hash' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'masked_bank_account_number' => null, + 'bank_account_hash' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'masked_bank_account_number' => true, + 'bank_account_hash' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'masked_bank_account_number' => 'masked_bank_account_number', + 'bank_account_hash' => 'bank_account_hash' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'masked_bank_account_number' => 'setMaskedBankAccountNumber', + 'bank_account_hash' => 'setBankAccountHash' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'masked_bank_account_number' => 'getMaskedBankAccountNumber', + 'bank_account_hash' => 'getBankAccountHash' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('masked_bank_account_number', $data ?? [], null); + $this->setIfExists('bank_account_hash', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets masked_bank_account_number + * + * @return string|null + */ + public function getMaskedBankAccountNumber() + { + return $this->container['masked_bank_account_number']; + } + + /** + * Sets masked_bank_account_number + * + * @param string|null $masked_bank_account_number masked_bank_account_number + * + * @return self + */ + public function setMaskedBankAccountNumber($masked_bank_account_number) + { + if (is_null($masked_bank_account_number)) { + array_push($this->openAPINullablesSetToNull, 'masked_bank_account_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('masked_bank_account_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['masked_bank_account_number'] = $masked_bank_account_number; + + return $this; + } + + /** + * Gets bank_account_hash + * + * @return string|null + */ + public function getBankAccountHash() + { + return $this->container['bank_account_hash']; + } + + /** + * Sets bank_account_hash + * + * @param string|null $bank_account_hash bank_account_hash + * + * @return self + */ + public function setBankAccountHash($bank_account_hash) + { + if (is_null($bank_account_hash)) { + array_push($this->openAPINullablesSetToNull, 'bank_account_hash'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bank_account_hash', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bank_account_hash'] = $bank_account_hash; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitChannelCode.php b/lib/PaymentRequest/DirectDebitChannelCode.php new file mode 100644 index 0000000..47d5d5f --- /dev/null +++ b/lib/PaymentRequest/DirectDebitChannelCode.php @@ -0,0 +1,262 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum DirectDebitChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BCA_KLIKPAY, + self::BCA_ONEKLIK, + self::BRI, + self::BNI, + self::MANDIRI, + self::BPI, + self::BDO, + self::CIMBNIAGA, + self::MTB, + self::RCBC, + self::UBP, + self::AUTODEBIT_UBP, + self::CHINABANK, + self::BAY, + self::KTB, + self::BBL, + self::SCB, + self::KBANK_MB, + self::BAY_MB, + self::KTB_MB, + self::BBL_MB, + self::SCB_MB, + self::BDO_EPAY, + self::AFFIN_FPX, + self::AGRO_FPX, + self::ALLIANCE_FPX, + self::AMBANK_FPX, + self::ISLAM_FPX, + self::MUAMALAT_FPX, + self::BOC_FPX, + self::RAKYAT_FPX, + self::BSN_FPX, + self::CIMB_FPX, + self::HLB_FPX, + self::HSBC_FPX, + self::KFH_FPX, + self::MAYB2_E_FPX, + self::MAYB2_U_FPX, + self::OCBC_FPX, + self::PUBLIC_FPX, + self::RHB_FPX, + self::SCH_FPX, + self::UOB_FPX, + self::AFFIN_FPX_BUSINESS, + self::AGRO_FPX_BUSINESS, + self::ALLIANCE_FPX_BUSINESS, + self::AMBANK_FPX_BUSINESS, + self::ISLAM_FPX_BUSINESS, + self::MUAMALAT_FPX_BUSINESS, + self::BNP_FPX_BUSINESS, + self::CIMB_FPX_BUSINESS, + self::CITIBANK_FPX_BUSINESS, + self::DEUTSCHE_FPX_BUSINESS, + self::HLB_FPX_BUSINESS, + self::HSBC_FPX_BUSINESS, + self::RAKYAT_FPX_BUSINESS, + self::KFH_FPX_BUSINESS, + self::MAYB2_E_FPX_BUSINESS, + self::OCBC_FPX_BUSINESS, + self::PUBLIC_FPX_BUSINESS, + self::RHB_FPX_BUSINESS, + self::SCH_FPX_BUSINESS, + self::UOB_FPX_BUSINESS + ]; + } +} + + diff --git a/lib/PaymentRequest/DirectDebitChannelProperties.php b/lib/PaymentRequest/DirectDebitChannelProperties.php new file mode 100644 index 0000000..f2ab1ec --- /dev/null +++ b/lib/PaymentRequest/DirectDebitChannelProperties.php @@ -0,0 +1,640 @@ + + */ +class DirectDebitChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mobile_number' => 'string', + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'identity_document_number' => 'string', + 'account_number' => 'string', + 'card_last_four' => 'string', + 'card_expiry' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mobile_number' => null, + 'success_return_url' => 'uri', + 'failure_return_url' => 'uri', + 'identity_document_number' => null, + 'account_number' => null, + 'card_last_four' => null, + 'card_expiry' => null, + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mobile_number' => false, + 'success_return_url' => false, + 'failure_return_url' => false, + 'identity_document_number' => false, + 'account_number' => false, + 'card_last_four' => false, + 'card_expiry' => false, + 'email' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mobile_number' => 'mobile_number', + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'identity_document_number' => 'identity_document_number', + 'account_number' => 'account_number', + 'card_last_four' => 'card_last_four', + 'card_expiry' => 'card_expiry', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mobile_number' => 'setMobileNumber', + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'identity_document_number' => 'setIdentityDocumentNumber', + 'account_number' => 'setAccountNumber', + 'card_last_four' => 'setCardLastFour', + 'card_expiry' => 'setCardExpiry', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mobile_number' => 'getMobileNumber', + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'identity_document_number' => 'getIdentityDocumentNumber', + 'account_number' => 'getAccountNumber', + 'card_last_four' => 'getCardLastFour', + 'card_expiry' => 'getCardExpiry', + 'email' => 'getEmail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('identity_document_number', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('card_last_four', $data ?? [], null); + $this->setIfExists('card_expiry', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url success_return_url + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url failure_return_url + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets identity_document_number + * + * @return string|null + */ + public function getIdentityDocumentNumber() + { + return $this->container['identity_document_number']; + } + + /** + * Sets identity_document_number + * + * @param string|null $identity_document_number identity_document_number + * + * @return self + */ + public function setIdentityDocumentNumber($identity_document_number) + { + if (is_null($identity_document_number)) { + throw new \InvalidArgumentException('non-nullable identity_document_number cannot be null'); + } + $this->container['identity_document_number'] = $identity_document_number; + + return $this; + } + + /** + * Gets account_number + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['account_number']; + } + + /** + * Sets account_number + * + * @param string|null $account_number account_number + * + * @return self + */ + public function setAccountNumber($account_number) + { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } + $this->container['account_number'] = $account_number; + + return $this; + } + + /** + * Gets card_last_four + * + * @return string|null + */ + public function getCardLastFour() + { + return $this->container['card_last_four']; + } + + /** + * Sets card_last_four + * + * @param string|null $card_last_four Last four digits of the debit card + * + * @return self + */ + public function setCardLastFour($card_last_four) + { + if (is_null($card_last_four)) { + throw new \InvalidArgumentException('non-nullable card_last_four cannot be null'); + } + $this->container['card_last_four'] = $card_last_four; + + return $this; + } + + /** + * Gets card_expiry + * + * @return string|null + */ + public function getCardExpiry() + { + return $this->container['card_expiry']; + } + + /** + * Sets card_expiry + * + * @param string|null $card_expiry Expiry month and year of the debit card (in MM/YY format) + * + * @return self + */ + public function setCardExpiry($card_expiry) + { + if (is_null($card_expiry)) { + throw new \InvalidArgumentException('non-nullable card_expiry cannot be null'); + } + $this->container['card_expiry'] = $card_expiry; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the customer that is registered to the partner channel + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitChannelPropertiesBankAccount.php b/lib/PaymentRequest/DirectDebitChannelPropertiesBankAccount.php new file mode 100644 index 0000000..b97a271 --- /dev/null +++ b/lib/PaymentRequest/DirectDebitChannelPropertiesBankAccount.php @@ -0,0 +1,505 @@ + + */ +class DirectDebitChannelPropertiesBankAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitChannelPropertiesBankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'mobile_number' => 'string', + 'identity_document_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => 'uri', + 'failure_return_url' => 'uri', + 'mobile_number' => null, + 'identity_document_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => false, + 'mobile_number' => false, + 'identity_document_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'mobile_number' => 'mobile_number', + 'identity_document_number' => 'identity_document_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'mobile_number' => 'setMobileNumber', + 'identity_document_number' => 'setIdentityDocumentNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'mobile_number' => 'getMobileNumber', + 'identity_document_number' => 'getIdentityDocumentNumber' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('identity_document_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url success_return_url + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url failure_return_url + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number mobile_number + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets identity_document_number + * + * @return string|null + */ + public function getIdentityDocumentNumber() + { + return $this->container['identity_document_number']; + } + + /** + * Sets identity_document_number + * + * @param string|null $identity_document_number identity_document_number + * + * @return self + */ + public function setIdentityDocumentNumber($identity_document_number) + { + if (is_null($identity_document_number)) { + throw new \InvalidArgumentException('non-nullable identity_document_number cannot be null'); + } + $this->container['identity_document_number'] = $identity_document_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.php b/lib/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.php new file mode 100644 index 0000000..44f43e4 --- /dev/null +++ b/lib/PaymentRequest/DirectDebitChannelPropertiesBankRedirect.php @@ -0,0 +1,471 @@ + + */ +class DirectDebitChannelPropertiesBankRedirect implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitChannelPropertiesBankRedirect'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mobile_number' => 'string', + 'success_return_url' => 'string', + 'failure_return_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mobile_number' => null, + 'success_return_url' => 'uri', + 'failure_return_url' => 'uri' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mobile_number' => false, + 'success_return_url' => false, + 'failure_return_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mobile_number' => 'mobile_number', + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mobile_number' => 'setMobileNumber', + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mobile_number' => 'getMobileNumber', + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer that is registered to channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url success_return_url + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url failure_return_url + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitChannelPropertiesDebitCard.php b/lib/PaymentRequest/DirectDebitChannelPropertiesDebitCard.php new file mode 100644 index 0000000..b4ce79a --- /dev/null +++ b/lib/PaymentRequest/DirectDebitChannelPropertiesDebitCard.php @@ -0,0 +1,539 @@ + + */ +class DirectDebitChannelPropertiesDebitCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitChannelPropertiesDebitCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mobile_number' => 'string', + 'account_number' => 'string', + 'card_last_four' => 'string', + 'card_expiry' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mobile_number' => null, + 'account_number' => null, + 'card_last_four' => null, + 'card_expiry' => null, + 'email' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mobile_number' => false, + 'account_number' => false, + 'card_last_four' => false, + 'card_expiry' => false, + 'email' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mobile_number' => 'mobile_number', + 'account_number' => 'account_number', + 'card_last_four' => 'card_last_four', + 'card_expiry' => 'card_expiry', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mobile_number' => 'setMobileNumber', + 'account_number' => 'setAccountNumber', + 'card_last_four' => 'setCardLastFour', + 'card_expiry' => 'setCardExpiry', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mobile_number' => 'getMobileNumber', + 'account_number' => 'getAccountNumber', + 'card_last_four' => 'getCardLastFour', + 'card_expiry' => 'getCardExpiry', + 'email' => 'getEmail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('card_last_four', $data ?? [], null); + $this->setIfExists('card_expiry', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets account_number + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['account_number']; + } + + /** + * Sets account_number + * + * @param string|null $account_number account_number + * + * @return self + */ + public function setAccountNumber($account_number) + { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } + $this->container['account_number'] = $account_number; + + return $this; + } + + /** + * Gets card_last_four + * + * @return string|null + */ + public function getCardLastFour() + { + return $this->container['card_last_four']; + } + + /** + * Sets card_last_four + * + * @param string|null $card_last_four Last four digits of the debit card + * + * @return self + */ + public function setCardLastFour($card_last_four) + { + if (is_null($card_last_four)) { + throw new \InvalidArgumentException('non-nullable card_last_four cannot be null'); + } + $this->container['card_last_four'] = $card_last_four; + + return $this; + } + + /** + * Gets card_expiry + * + * @return string|null + */ + public function getCardExpiry() + { + return $this->container['card_expiry']; + } + + /** + * Sets card_expiry + * + * @param string|null $card_expiry Expiry month and year of the debit card (in MM/YY format) + * + * @return self + */ + public function setCardExpiry($card_expiry) + { + if (is_null($card_expiry)) { + throw new \InvalidArgumentException('non-nullable card_expiry cannot be null'); + } + $this->container['card_expiry'] = $card_expiry; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the customer that is registered to the partner channel + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitDebitCard.php b/lib/PaymentRequest/DirectDebitDebitCard.php new file mode 100644 index 0000000..80c343d --- /dev/null +++ b/lib/PaymentRequest/DirectDebitDebitCard.php @@ -0,0 +1,566 @@ + + */ +class DirectDebitDebitCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitDebitCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mobile_number' => 'string', + 'account_number' => 'string', + 'card_last_four' => 'string', + 'card_expiry' => 'string', + 'email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mobile_number' => null, + 'account_number' => null, + 'card_last_four' => null, + 'card_expiry' => null, + 'email' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mobile_number' => true, + 'account_number' => false, + 'card_last_four' => true, + 'card_expiry' => true, + 'email' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mobile_number' => 'mobile_number', + 'account_number' => 'account_number', + 'card_last_four' => 'card_last_four', + 'card_expiry' => 'card_expiry', + 'email' => 'email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mobile_number' => 'setMobileNumber', + 'account_number' => 'setAccountNumber', + 'card_last_four' => 'setCardLastFour', + 'card_expiry' => 'setCardExpiry', + 'email' => 'setEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mobile_number' => 'getMobileNumber', + 'account_number' => 'getAccountNumber', + 'card_last_four' => 'getCardLastFour', + 'card_expiry' => 'getCardExpiry', + 'email' => 'getEmail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('card_last_four', $data ?? [], null); + $this->setIfExists('card_expiry', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mobile_number + * + * @return string|null + */ + public function getMobileNumber() + { + return $this->container['mobile_number']; + } + + /** + * Sets mobile_number + * + * @param string|null $mobile_number Mobile number of the customer registered to the partner channel + * + * @return self + */ + public function setMobileNumber($mobile_number) + { + if (is_null($mobile_number)) { + array_push($this->openAPINullablesSetToNull, 'mobile_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('mobile_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['mobile_number'] = $mobile_number; + + return $this; + } + + /** + * Gets account_number + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['account_number']; + } + + /** + * Sets account_number + * + * @param string|null $account_number account_number + * + * @return self + */ + public function setAccountNumber($account_number) + { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } + $this->container['account_number'] = $account_number; + + return $this; + } + + /** + * Gets card_last_four + * + * @return string|null + */ + public function getCardLastFour() + { + return $this->container['card_last_four']; + } + + /** + * Sets card_last_four + * + * @param string|null $card_last_four Last four digits of the debit card + * + * @return self + */ + public function setCardLastFour($card_last_four) + { + if (is_null($card_last_four)) { + array_push($this->openAPINullablesSetToNull, 'card_last_four'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_last_four', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_last_four'] = $card_last_four; + + return $this; + } + + /** + * Gets card_expiry + * + * @return string|null + */ + public function getCardExpiry() + { + return $this->container['card_expiry']; + } + + /** + * Sets card_expiry + * + * @param string|null $card_expiry Expiry month and year of the debit card (in MM/YY format) + * + * @return self + */ + public function setCardExpiry($card_expiry) + { + if (is_null($card_expiry)) { + array_push($this->openAPINullablesSetToNull, 'card_expiry'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_expiry', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_expiry'] = $card_expiry; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Email address of the customer that is registered to the partner channel + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitParameters.php b/lib/PaymentRequest/DirectDebitParameters.php new file mode 100644 index 0000000..f451441 --- /dev/null +++ b/lib/PaymentRequest/DirectDebitParameters.php @@ -0,0 +1,483 @@ + + */ +class DirectDebitParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DirectDebitParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\DirectDebitChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\DirectDebitChannelProperties', + 'type' => '\Xendit\PaymentRequest\DirectDebitType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => true, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\DirectDebitChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\DirectDebitChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\DirectDebitChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\DirectDebitChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + array_push($this->openAPINullablesSetToNull, 'channel_properties'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_properties', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets type + * + * @return \PaymentRequest\DirectDebitType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentRequest\DirectDebitType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/DirectDebitType.php b/lib/PaymentRequest/DirectDebitType.php new file mode 100644 index 0000000..73fbc05 --- /dev/null +++ b/lib/PaymentRequest/DirectDebitType.php @@ -0,0 +1,81 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum DirectDebitType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::DEBIT_CARD, + self::BANK_ACCOUNT, + self::BANK_REDIRECT + ]; + } +} + + diff --git a/lib/PaymentRequest/EWallet.php b/lib/PaymentRequest/EWallet.php new file mode 100644 index 0000000..3342d3f --- /dev/null +++ b/lib/PaymentRequest/EWallet.php @@ -0,0 +1,471 @@ + + */ +class EWallet implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWallet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\EWalletChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\EWalletChannelProperties', + 'account' => '\Xendit\PaymentRequest\EWalletAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null, + 'account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => false, + 'account' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'account' => 'account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'account' => 'setAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'account' => 'getAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\EWalletChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\EWalletChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\EWalletChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\EWalletChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets account + * + * @return \PaymentRequest\EWalletAccount|null + */ + public function getAccount() + { + return $this->container['account']; + } + + /** + * Sets account + * + * @param \PaymentRequest\EWalletAccount|null $account account + * + * @return self + */ + public function setAccount($account) + { + if (is_null($account)) { + throw new \InvalidArgumentException('non-nullable account cannot be null'); + } + $this->container['account'] = $account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/EWalletAccount.php b/lib/PaymentRequest/EWalletAccount.php new file mode 100644 index 0000000..c733a03 --- /dev/null +++ b/lib/PaymentRequest/EWalletAccount.php @@ -0,0 +1,533 @@ + + */ +class EWalletAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'account_details' => 'string', + 'balance' => 'float', + 'point_balance' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'account_details' => null, + 'balance' => 'double', + 'point_balance' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'account_details' => true, + 'balance' => true, + 'point_balance' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'account_details' => 'account_details', + 'balance' => 'balance', + 'point_balance' => 'point_balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'account_details' => 'setAccountDetails', + 'balance' => 'setBalance', + 'point_balance' => 'setPointBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'account_details' => 'getAccountDetails', + 'balance' => 'getBalance', + 'point_balance' => 'getPointBalance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('account_details', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('point_balance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the eWallet account holder. The value is null if unavailableName of the eWallet account holder. The value is null if unavailable + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets account_details + * + * @return string|null + */ + public function getAccountDetails() + { + return $this->container['account_details']; + } + + /** + * Sets account_details + * + * @param string|null $account_details Identifier from eWallet provider e.g. phone number. The value is null if unavailable + * + * @return self + */ + public function setAccountDetails($account_details) + { + if (is_null($account_details)) { + array_push($this->openAPINullablesSetToNull, 'account_details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('account_details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['account_details'] = $account_details; + + return $this; + } + + /** + * Gets balance + * + * @return float|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param float|null $balance The main balance amount on eWallet account provided from eWallet provider. The value is null if unavailable + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets point_balance + * + * @return float|null + */ + public function getPointBalance() + { + return $this->container['point_balance']; + } + + /** + * Sets point_balance + * + * @param float|null $point_balance The point balance amount on eWallet account. Applicable only on some eWallet provider that has point system. The value is null if unavailabl + * + * @return self + */ + public function setPointBalance($point_balance) + { + if (is_null($point_balance)) { + array_push($this->openAPINullablesSetToNull, 'point_balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('point_balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['point_balance'] = $point_balance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/EWalletAllOf.php b/lib/PaymentRequest/EWalletAllOf.php new file mode 100644 index 0000000..cbde40d --- /dev/null +++ b/lib/PaymentRequest/EWalletAllOf.php @@ -0,0 +1,402 @@ + + */ +class EWalletAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWallet_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'account' => '\Xendit\PaymentRequest\EWalletAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'account' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'account' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'account' => 'account' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'account' => 'setAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'account' => 'getAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('account', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account + * + * @return \PaymentRequest\EWalletAccount|null + */ + public function getAccount() + { + return $this->container['account']; + } + + /** + * Sets account + * + * @param \PaymentRequest\EWalletAccount|null $account account + * + * @return self + */ + public function setAccount($account) + { + if (is_null($account)) { + throw new \InvalidArgumentException('non-nullable account cannot be null'); + } + $this->container['account'] = $account; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/EWalletChannelCode.php b/lib/PaymentRequest/EWalletChannelCode.php new file mode 100644 index 0000000..8bbed99 --- /dev/null +++ b/lib/PaymentRequest/EWalletChannelCode.php @@ -0,0 +1,130 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum EWalletChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::GCASH, + self::GRABPAY, + self::PAYMAYA, + self::DANA, + self::OVO, + self::LINKAJA, + self::SHOPEEPAY, + self::NEXCASH, + self::ASTRAPAY, + self::JENIUSPAY, + self::APPOTA, + self::MOMO, + self::VNPTWALLET, + self::VIETTELPAY, + self::ZALOPAY, + self::WECHATPAY, + self::LINEPAY, + self::TRUEMONEY, + self::ALIPAY + ]; + } +} + + diff --git a/lib/PaymentRequest/EWalletChannelProperties.php b/lib/PaymentRequest/EWalletChannelProperties.php new file mode 100644 index 0000000..4ac336f --- /dev/null +++ b/lib/PaymentRequest/EWalletChannelProperties.php @@ -0,0 +1,600 @@ + + */ +class EWalletChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cancel_return_url' => 'string', + 'redeem_points' => 'string', + 'mobilenumber' => 'string', + 'cashtag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => null, + 'failure_return_url' => null, + 'cancel_return_url' => null, + 'redeem_points' => null, + 'mobilenumber' => null, + 'cashtag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => false, + 'cancel_return_url' => false, + 'redeem_points' => false, + 'mobilenumber' => false, + 'cashtag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cancel_return_url' => 'cancel_return_url', + 'redeem_points' => 'redeem_points', + 'mobilenumber' => 'mobile:number', + 'cashtag' => 'cashtag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cancel_return_url' => 'setCancelReturnUrl', + 'redeem_points' => 'setRedeemPoints', + 'mobilenumber' => 'setMobilenumber', + 'cashtag' => 'setCashtag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cancel_return_url' => 'getCancelReturnUrl', + 'redeem_points' => 'getRedeemPoints', + 'mobilenumber' => 'getMobilenumber', + 'cashtag' => 'getCashtag' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cancel_return_url', $data ?? [], null); + $this->setIfExists('redeem_points', $data ?? [], null); + $this->setIfExists('mobilenumber', $data ?? [], null); + $this->setIfExists('cashtag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['cancel_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['cancel_return_url'])) { + $invalidProperties[] = "invalid value for 'cancel_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cancel_return_url + * + * @return string|null + */ + public function getCancelReturnUrl() + { + return $this->container['cancel_return_url']; + } + + /** + * Sets cancel_return_url + * + * @param string|null $cancel_return_url URL where the end-customer is redirected if the authorization cancelled + * + * @return self + */ + public function setCancelReturnUrl($cancel_return_url) + { + if (is_null($cancel_return_url)) { + throw new \InvalidArgumentException('non-nullable cancel_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $cancel_return_url))) { + throw new \InvalidArgumentException("invalid value for \$cancel_return_url when calling EWalletChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['cancel_return_url'] = $cancel_return_url; + + return $this; + } + + /** + * Gets redeem_points + * + * @return string|null + */ + public function getRedeemPoints() + { + return $this->container['redeem_points']; + } + + /** + * Sets redeem_points + * + * @param string|null $redeem_points REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. + * + * @return self + */ + public function setRedeemPoints($redeem_points) + { + if (is_null($redeem_points)) { + throw new \InvalidArgumentException('non-nullable redeem_points cannot be null'); + } + $this->container['redeem_points'] = $redeem_points; + + return $this; + } + + /** + * Gets mobilenumber + * + * @return string|null + */ + public function getMobilenumber() + { + return $this->container['mobilenumber']; + } + + /** + * Sets mobilenumber + * + * @param string|null $mobilenumber mobilenumber + * + * @return self + */ + public function setMobilenumber($mobilenumber) + { + if (is_null($mobilenumber)) { + throw new \InvalidArgumentException('non-nullable mobilenumber cannot be null'); + } + $this->container['mobilenumber'] = $mobilenumber; + + return $this; + } + + /** + * Gets cashtag + * + * @return string|null + */ + public function getCashtag() + { + return $this->container['cashtag']; + } + + /** + * Sets cashtag + * + * @param string|null $cashtag cashtag + * + * @return self + */ + public function setCashtag($cashtag) + { + if (is_null($cashtag)) { + throw new \InvalidArgumentException('non-nullable cashtag cannot be null'); + } + $this->container['cashtag'] = $cashtag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/EWalletParameters.php b/lib/PaymentRequest/EWalletParameters.php new file mode 100644 index 0000000..44d1288 --- /dev/null +++ b/lib/PaymentRequest/EWalletParameters.php @@ -0,0 +1,436 @@ + + */ +class EWalletParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EWalletParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\EWalletChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\EWalletChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\EWalletChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\EWalletChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\EWalletChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\EWalletChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/Error.php b/lib/PaymentRequest/Error.php new file mode 100644 index 0000000..64042b3 --- /dev/null +++ b/lib/PaymentRequest/Error.php @@ -0,0 +1,590 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => true, + 'message' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_ACCOUNT_ACCESS_BLOCKED = 'ACCOUNT_ACCESS_BLOCKED'; + public const ERROR_CODE_ADDRESS_VALIDATION_FAILED = 'ADDRESS_VALIDATION_FAILED'; + public const ERROR_CODE_AMOUNT_MISMATCHED = 'AMOUNT_MISMATCHED'; + public const ERROR_CODE_API_VALIDATION_ERROR = 'API_VALIDATION_ERROR'; + public const ERROR_CODE_AUTHENTICATION_FAILED = 'AUTHENTICATION_FAILED'; + public const ERROR_CODE_AUTHENTICATION_REQUIRED = 'AUTHENTICATION_REQUIRED'; + public const ERROR_CODE_CARD_DECLINED = 'CARD_DECLINED'; + public const ERROR_CODE_CHANNEL_CODE_NOT_SUPPORTED_ERROR = 'CHANNEL_CODE_NOT_SUPPORTED_ERROR'; + public const ERROR_CODE_CHANNEL_NOT_ACTIVATED = 'CHANNEL_NOT_ACTIVATED'; + public const ERROR_CODE_CHANNEL_UNAVAILABLE = 'CHANNEL_UNAVAILABLE'; + public const ERROR_CODE_COF_COMBINATION_NOT_ALLOWED_ERROR = 'COF_COMBINATION_NOT_ALLOWED_ERROR'; + public const ERROR_CODE_CURRENCY_MISMATCHED = 'CURRENCY_MISMATCHED'; + public const ERROR_CODE_CUSTOMER_NOT_FOUND_ERROR = 'CUSTOMER_NOT_FOUND_ERROR'; + public const ERROR_CODE_CUSTOMER_PAYMENT_METHOD_MISMATCHED = 'CUSTOMER_PAYMENT_METHOD_MISMATCHED'; + public const ERROR_CODE_DATA_NOT_FOUND = 'DATA_NOT_FOUND'; + public const ERROR_CODE_DATA_NOT_FOUND_ERROR = 'DATA_NOT_FOUND_ERROR'; + public const ERROR_CODE_DECLINED_BY_ISSUER = 'DECLINED_BY_ISSUER'; + public const ERROR_CODE_DECLINED_BY_PROCESSOR = 'DECLINED_BY_PROCESSOR'; + public const ERROR_CODE_DENIED_PERSON_LIST_MATCHED = 'DENIED_PERSON_LIST_MATCHED'; + public const ERROR_CODE_DUPLICATE_ERROR = 'DUPLICATE_ERROR'; + public const ERROR_CODE_DUPLICATE_REFERENCE = 'DUPLICATE_REFERENCE'; + public const ERROR_CODE_EXCEEDS_CAPTURABLE_AMOUNT = 'EXCEEDS_CAPTURABLE_AMOUNT'; + public const ERROR_CODE_EXPIRED_CARD = 'EXPIRED_CARD'; + public const ERROR_CODE_EXPIRED_OTP_ERROR = 'EXPIRED_OTP_ERROR'; + public const ERROR_CODE_FEATURE_NOT_ACTIVATED = 'FEATURE_NOT_ACTIVATED'; + public const ERROR_CODE_IDEMPOTENCY_ERROR = 'IDEMPOTENCY_ERROR'; + public const ERROR_CODE_INACTIVE_OR_UNAUTHORIZED_CARD = 'INACTIVE_OR_UNAUTHORIZED_CARD'; + public const ERROR_CODE_INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE'; + public const ERROR_CODE_INVALID_ACCOUNT_DETAILS = 'INVALID_ACCOUNT_DETAILS'; + public const ERROR_CODE_INVALID_CVV = 'INVALID_CVV'; + public const ERROR_CODE_INVALID_OTP_ERROR = 'INVALID_OTP_ERROR'; + public const ERROR_CODE_INVALID_PAYMENT_METHOD = 'INVALID_PAYMENT_METHOD'; + public const ERROR_CODE_ISSUER_UNAVAILABLE = 'ISSUER_UNAVAILABLE'; + public const ERROR_CODE_MANUAL_CAPTURE_NOT_SUPPORTED = 'MANUAL_CAPTURE_NOT_SUPPORTED'; + public const ERROR_CODE_MAX_ACCOUNT_LINKING = 'MAX_ACCOUNT_LINKING'; + public const ERROR_CODE_MAX_AMOUNT_LIMIT_ERROR = 'MAX_AMOUNT_LIMIT_ERROR'; + public const ERROR_CODE_MAX_OTP_ATTEMPTS_ERROR = 'MAX_OTP_ATTEMPTS_ERROR'; + public const ERROR_CODE_OPERATION_NOT_ALLOWED = 'OPERATION_NOT_ALLOWED'; + public const ERROR_CODE_OTP_DELIVERY_ERROR = 'OTP_DELIVERY_ERROR'; + public const ERROR_CODE_PAYMENT_METHOD_NOT_FOUND_ERROR = 'PAYMENT_METHOD_NOT_FOUND_ERROR'; + public const ERROR_CODE_PAYMENT_REQUEST_ALREADY_COMPLETED = 'PAYMENT_REQUEST_ALREADY_COMPLETED'; + public const ERROR_CODE_PAYMENT_REQUEST_ALREADY_FAILED = 'PAYMENT_REQUEST_ALREADY_FAILED'; + public const ERROR_CODE_PAYMENT_REQUEST_ALREADY_FULLY_CAPTURED = 'PAYMENT_REQUEST_ALREADY_FULLY_CAPTURED'; + public const ERROR_CODE_PAYMENT_STATUS_FAILED = 'PAYMENT_STATUS_FAILED'; + public const ERROR_CODE_PROCESSOR_CONFIGURATION_ERROR = 'PROCESSOR_CONFIGURATION_ERROR'; + public const ERROR_CODE_PROCESSOR_ERROR = 'PROCESSOR_ERROR'; + public const ERROR_CODE_PROCESSOR_TEMPORARILY_UNAVAILABLE = 'PROCESSOR_TEMPORARILY_UNAVAILABLE'; + public const ERROR_CODE_PROCESSOR_TIMEOUT = 'PROCESSOR_TIMEOUT'; + public const ERROR_CODE_REJECTED_BY_ACQUIRER = 'REJECTED_BY_ACQUIRER'; + public const ERROR_CODE_SERVER_ERROR = 'SERVER_ERROR'; + public const ERROR_CODE_STOLEN_CARD = 'STOLEN_CARD'; + public const ERROR_CODE_STRONG_CUSTOMER_AUTHENTICATION_REQUIRED = 'STRONG_CUSTOMER_AUTHENTICATION_REQUIRED'; + public const ERROR_CODE_SUSPECTED_FRAUDULENT = 'SUSPECTED_FRAUDULENT'; + public const ERROR_CODE_UNAUTHORIZED = 'UNAUTHORIZED'; + public const ERROR_CODE_DUPLICATED_FIXED_PAYMENT_INSTRUMENT = 'DUPLICATED_FIXED_PAYMENT_INSTRUMENT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_ACCOUNT_ACCESS_BLOCKED, + self::ERROR_CODE_ADDRESS_VALIDATION_FAILED, + self::ERROR_CODE_AMOUNT_MISMATCHED, + self::ERROR_CODE_API_VALIDATION_ERROR, + self::ERROR_CODE_AUTHENTICATION_FAILED, + self::ERROR_CODE_AUTHENTICATION_REQUIRED, + self::ERROR_CODE_CARD_DECLINED, + self::ERROR_CODE_CHANNEL_CODE_NOT_SUPPORTED_ERROR, + self::ERROR_CODE_CHANNEL_NOT_ACTIVATED, + self::ERROR_CODE_CHANNEL_UNAVAILABLE, + self::ERROR_CODE_COF_COMBINATION_NOT_ALLOWED_ERROR, + self::ERROR_CODE_CURRENCY_MISMATCHED, + self::ERROR_CODE_CUSTOMER_NOT_FOUND_ERROR, + self::ERROR_CODE_CUSTOMER_PAYMENT_METHOD_MISMATCHED, + self::ERROR_CODE_DATA_NOT_FOUND, + self::ERROR_CODE_DATA_NOT_FOUND_ERROR, + self::ERROR_CODE_DECLINED_BY_ISSUER, + self::ERROR_CODE_DECLINED_BY_PROCESSOR, + self::ERROR_CODE_DENIED_PERSON_LIST_MATCHED, + self::ERROR_CODE_DUPLICATE_ERROR, + self::ERROR_CODE_DUPLICATE_REFERENCE, + self::ERROR_CODE_EXCEEDS_CAPTURABLE_AMOUNT, + self::ERROR_CODE_EXPIRED_CARD, + self::ERROR_CODE_EXPIRED_OTP_ERROR, + self::ERROR_CODE_FEATURE_NOT_ACTIVATED, + self::ERROR_CODE_IDEMPOTENCY_ERROR, + self::ERROR_CODE_INACTIVE_OR_UNAUTHORIZED_CARD, + self::ERROR_CODE_INSUFFICIENT_BALANCE, + self::ERROR_CODE_INVALID_ACCOUNT_DETAILS, + self::ERROR_CODE_INVALID_CVV, + self::ERROR_CODE_INVALID_OTP_ERROR, + self::ERROR_CODE_INVALID_PAYMENT_METHOD, + self::ERROR_CODE_ISSUER_UNAVAILABLE, + self::ERROR_CODE_MANUAL_CAPTURE_NOT_SUPPORTED, + self::ERROR_CODE_MAX_ACCOUNT_LINKING, + self::ERROR_CODE_MAX_AMOUNT_LIMIT_ERROR, + self::ERROR_CODE_MAX_OTP_ATTEMPTS_ERROR, + self::ERROR_CODE_OPERATION_NOT_ALLOWED, + self::ERROR_CODE_OTP_DELIVERY_ERROR, + self::ERROR_CODE_PAYMENT_METHOD_NOT_FOUND_ERROR, + self::ERROR_CODE_PAYMENT_REQUEST_ALREADY_COMPLETED, + self::ERROR_CODE_PAYMENT_REQUEST_ALREADY_FAILED, + self::ERROR_CODE_PAYMENT_REQUEST_ALREADY_FULLY_CAPTURED, + self::ERROR_CODE_PAYMENT_STATUS_FAILED, + self::ERROR_CODE_PROCESSOR_CONFIGURATION_ERROR, + self::ERROR_CODE_PROCESSOR_ERROR, + self::ERROR_CODE_PROCESSOR_TEMPORARILY_UNAVAILABLE, + self::ERROR_CODE_PROCESSOR_TIMEOUT, + self::ERROR_CODE_REJECTED_BY_ACQUIRER, + self::ERROR_CODE_SERVER_ERROR, + self::ERROR_CODE_STOLEN_CARD, + self::ERROR_CODE_STRONG_CUSTOMER_AUTHENTICATION_REQUIRED, + self::ERROR_CODE_SUSPECTED_FRAUDULENT, + self::ERROR_CODE_UNAUTHORIZED, + self::ERROR_CODE_DUPLICATED_FIXED_PAYMENT_INSTRUMENT, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + array_push($this->openAPINullablesSetToNull, 'error_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($error_code) && !in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/OverTheCounter.php b/lib/PaymentRequest/OverTheCounter.php new file mode 100644 index 0000000..d08049b --- /dev/null +++ b/lib/PaymentRequest/OverTheCounter.php @@ -0,0 +1,518 @@ + + */ +class OverTheCounter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'channel_code' => '\Xendit\PaymentRequest\OverTheCounterChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\OverTheCounterChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentRequest\OverTheCounterChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\OverTheCounterChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\OverTheCounterChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\OverTheCounterChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/OverTheCounterChannelCode.php b/lib/PaymentRequest/OverTheCounterChannelCode.php new file mode 100644 index 0000000..ee8f0f9 --- /dev/null +++ b/lib/PaymentRequest/OverTheCounterChannelCode.php @@ -0,0 +1,121 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum OverTheCounterChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::_7_ELEVEN, + self::_7_ELEVEN_CLIQQ, + self::CEBUANA, + self::ECPAY, + self::PALAWAN, + self::MLHUILLIER, + self::ECPAY_DRAGONLOAN, + self::LBC, + self::ECPAY_SCHOOL, + self::RD_PAWNSHOP, + self::CVM, + self::USSC, + self::SM_BILLS, + self::ROBINSONS_BILLS, + self::ALFAMART, + self::INDOMARET + ]; + } +} + + diff --git a/lib/PaymentRequest/OverTheCounterChannelProperties.php b/lib/PaymentRequest/OverTheCounterChannelProperties.php new file mode 100644 index 0000000..826ef68 --- /dev/null +++ b/lib/PaymentRequest/OverTheCounterChannelProperties.php @@ -0,0 +1,474 @@ + + */ +class OverTheCounterChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payment_code' => 'string', + 'customer_name' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payment_code' => null, + 'customer_name' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payment_code' => false, + 'customer_name' => false, + 'expires_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'payment_code' => 'payment_code', + 'customer_name' => 'customer_name', + 'expires_at' => 'expires_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payment_code' => 'setPaymentCode', + 'customer_name' => 'setCustomerName', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_code' => 'getPaymentCode', + 'customer_name' => 'getCustomerName', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('payment_code', $data ?? [], null); + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customer_name'] === null) { + $invalidProperties[] = "'customer_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets payment_code + * + * @return string|null + */ + public function getPaymentCode() + { + return $this->container['payment_code']; + } + + /** + * Sets payment_code + * + * @param string|null $payment_code The payment code that you want to assign, e.g 12345. If you do not send one, one will be picked at random. + * + * @return self + */ + public function setPaymentCode($payment_code) + { + if (is_null($payment_code)) { + throw new \InvalidArgumentException('non-nullable payment_code cannot be null'); + } + $this->container['payment_code'] = $payment_code; + + return $this; + } + + /** + * Gets customer_name + * + * @return string + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string $customer_name Name of customer. + * + * @return self + */ + public function setCustomerName($customer_name) + { + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The time when the payment code will be expired. The minimum is 2 hours and the maximum is 9 days for 7ELEVEN. Default expired date will be 2 days from payment code generated. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/OverTheCounterParameters.php b/lib/PaymentRequest/OverTheCounterParameters.php new file mode 100644 index 0000000..8ae7472 --- /dev/null +++ b/lib/PaymentRequest/OverTheCounterParameters.php @@ -0,0 +1,517 @@ + + */ +class OverTheCounterParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OverTheCounterParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'channel_code' => '\Xendit\PaymentRequest\OverTheCounterChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\OverTheCounterChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentRequest\OverTheCounterChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\OverTheCounterChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\OverTheCounterChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\OverTheCounterChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentMethod.php b/lib/PaymentRequest/PaymentMethod.php new file mode 100644 index 0000000..299fc6c --- /dev/null +++ b/lib/PaymentRequest/PaymentMethod.php @@ -0,0 +1,946 @@ + + */ +class PaymentMethod implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethod'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => '\Xendit\PaymentRequest\PaymentMethodType', + 'created' => 'string', + 'updated' => 'string', + 'description' => 'string', + 'reference_id' => 'string', + 'card' => '\Xendit\PaymentRequest\Card', + 'direct_debit' => '\Xendit\PaymentRequest\DirectDebit', + 'ewallet' => '\Xendit\PaymentRequest\EWallet', + 'over_the_counter' => '\Xendit\PaymentRequest\OverTheCounter', + 'virtual_account' => '\Xendit\PaymentRequest\VirtualAccount', + 'qr_code' => '\Xendit\PaymentRequest\QRCode', + 'reusability' => '\Xendit\PaymentRequest\PaymentMethodReusability', + 'status' => '\Xendit\PaymentRequest\PaymentMethodStatus', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'created' => null, + 'updated' => null, + 'description' => null, + 'reference_id' => null, + 'card' => null, + 'direct_debit' => null, + 'ewallet' => null, + 'over_the_counter' => null, + 'virtual_account' => null, + 'qr_code' => null, + 'reusability' => null, + 'status' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'created' => false, + 'updated' => false, + 'description' => true, + 'reference_id' => false, + 'card' => true, + 'direct_debit' => true, + 'ewallet' => true, + 'over_the_counter' => true, + 'virtual_account' => true, + 'qr_code' => true, + 'reusability' => false, + 'status' => false, + 'metadata' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'created' => 'created', + 'updated' => 'updated', + 'description' => 'description', + 'reference_id' => 'reference_id', + 'card' => 'card', + 'direct_debit' => 'direct_debit', + 'ewallet' => 'ewallet', + 'over_the_counter' => 'over_the_counter', + 'virtual_account' => 'virtual_account', + 'qr_code' => 'qr_code', + 'reusability' => 'reusability', + 'status' => 'status', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'description' => 'setDescription', + 'reference_id' => 'setReferenceId', + 'card' => 'setCard', + 'direct_debit' => 'setDirectDebit', + 'ewallet' => 'setEwallet', + 'over_the_counter' => 'setOverTheCounter', + 'virtual_account' => 'setVirtualAccount', + 'qr_code' => 'setQrCode', + 'reusability' => 'setReusability', + 'status' => 'setStatus', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'description' => 'getDescription', + 'reference_id' => 'getReferenceId', + 'card' => 'getCard', + 'direct_debit' => 'getDirectDebit', + 'ewallet' => 'getEwallet', + 'over_the_counter' => 'getOverTheCounter', + 'virtual_account' => 'getVirtualAccount', + 'qr_code' => 'getQrCode', + 'reusability' => 'getReusability', + 'status' => 'getStatus', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('card', $data ?? [], null); + $this->setIfExists('direct_debit', $data ?? [], null); + $this->setIfExists('ewallet', $data ?? [], null); + $this->setIfExists('over_the_counter', $data ?? [], null); + $this->setIfExists('virtual_account', $data ?? [], null); + $this->setIfExists('qr_code', $data ?? [], null); + $this->setIfExists('reusability', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['reusability'] === null) { + $invalidProperties[] = "'reusability' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return \PaymentRequest\PaymentMethodType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentRequest\PaymentMethodType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets created + * + * @return string|null + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string|null $created created + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string|null + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string|null $updated updated + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets card + * + * @return \PaymentRequest\Card|null + */ + public function getCard() + { + return $this->container['card']; + } + + /** + * Sets card + * + * @param \PaymentRequest\Card|null $card card + * + * @return self + */ + public function setCard($card) + { + if (is_null($card)) { + array_push($this->openAPINullablesSetToNull, 'card'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card'] = $card; + + return $this; + } + + /** + * Gets direct_debit + * + * @return \PaymentRequest\DirectDebit|null + */ + public function getDirectDebit() + { + return $this->container['direct_debit']; + } + + /** + * Sets direct_debit + * + * @param \PaymentRequest\DirectDebit|null $direct_debit direct_debit + * + * @return self + */ + public function setDirectDebit($direct_debit) + { + if (is_null($direct_debit)) { + array_push($this->openAPINullablesSetToNull, 'direct_debit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('direct_debit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['direct_debit'] = $direct_debit; + + return $this; + } + + /** + * Gets ewallet + * + * @return \PaymentRequest\EWallet|null + */ + public function getEwallet() + { + return $this->container['ewallet']; + } + + /** + * Sets ewallet + * + * @param \PaymentRequest\EWallet|null $ewallet ewallet + * + * @return self + */ + public function setEwallet($ewallet) + { + if (is_null($ewallet)) { + array_push($this->openAPINullablesSetToNull, 'ewallet'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ewallet', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ewallet'] = $ewallet; + + return $this; + } + + /** + * Gets over_the_counter + * + * @return \PaymentRequest\OverTheCounter|null + */ + public function getOverTheCounter() + { + return $this->container['over_the_counter']; + } + + /** + * Sets over_the_counter + * + * @param \PaymentRequest\OverTheCounter|null $over_the_counter over_the_counter + * + * @return self + */ + public function setOverTheCounter($over_the_counter) + { + if (is_null($over_the_counter)) { + array_push($this->openAPINullablesSetToNull, 'over_the_counter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('over_the_counter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['over_the_counter'] = $over_the_counter; + + return $this; + } + + /** + * Gets virtual_account + * + * @return \PaymentRequest\VirtualAccount|null + */ + public function getVirtualAccount() + { + return $this->container['virtual_account']; + } + + /** + * Sets virtual_account + * + * @param \PaymentRequest\VirtualAccount|null $virtual_account virtual_account + * + * @return self + */ + public function setVirtualAccount($virtual_account) + { + if (is_null($virtual_account)) { + array_push($this->openAPINullablesSetToNull, 'virtual_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virtual_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['virtual_account'] = $virtual_account; + + return $this; + } + + /** + * Gets qr_code + * + * @return \PaymentRequest\QRCode|null + */ + public function getQrCode() + { + return $this->container['qr_code']; + } + + /** + * Sets qr_code + * + * @param \PaymentRequest\QRCode|null $qr_code qr_code + * + * @return self + */ + public function setQrCode($qr_code) + { + if (is_null($qr_code)) { + array_push($this->openAPINullablesSetToNull, 'qr_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr_code'] = $qr_code; + + return $this; + } + + /** + * Gets reusability + * + * @return \PaymentRequest\PaymentMethodReusability + */ + public function getReusability() + { + return $this->container['reusability']; + } + + /** + * Sets reusability + * + * @param \PaymentRequest\PaymentMethodReusability $reusability reusability + * + * @return self + */ + public function setReusability($reusability) + { + if (is_null($reusability)) { + throw new \InvalidArgumentException('non-nullable reusability cannot be null'); + } + $this->container['reusability'] = $reusability; + + return $this; + } + + /** + * Gets status + * + * @return \PaymentRequest\PaymentMethodStatus + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \PaymentRequest\PaymentMethodStatus $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentMethodParameters.php b/lib/PaymentRequest/PaymentMethodParameters.php new file mode 100644 index 0000000..22ada49 --- /dev/null +++ b/lib/PaymentRequest/PaymentMethodParameters.php @@ -0,0 +1,722 @@ + + */ +class PaymentMethodParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Xendit\PaymentRequest\PaymentMethodType', + 'reusability' => '\Xendit\PaymentRequest\PaymentMethodReusability', + 'description' => 'string', + 'reference_id' => 'string', + 'direct_debit' => '\Xendit\PaymentRequest\DirectDebitParameters', + 'ewallet' => '\Xendit\PaymentRequest\EWalletParameters', + 'over_the_counter' => '\Xendit\PaymentRequest\OverTheCounterParameters', + 'virtual_account' => '\Xendit\PaymentRequest\VirtualAccountParameters', + 'qr_code' => '\Xendit\PaymentRequest\QRCodeParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'reusability' => null, + 'description' => null, + 'reference_id' => null, + 'direct_debit' => null, + 'ewallet' => null, + 'over_the_counter' => null, + 'virtual_account' => null, + 'qr_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'reusability' => false, + 'description' => true, + 'reference_id' => false, + 'direct_debit' => true, + 'ewallet' => true, + 'over_the_counter' => true, + 'virtual_account' => true, + 'qr_code' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'reusability' => 'reusability', + 'description' => 'description', + 'reference_id' => 'reference_id', + 'direct_debit' => 'direct_debit', + 'ewallet' => 'ewallet', + 'over_the_counter' => 'over_the_counter', + 'virtual_account' => 'virtual_account', + 'qr_code' => 'qr_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'reusability' => 'setReusability', + 'description' => 'setDescription', + 'reference_id' => 'setReferenceId', + 'direct_debit' => 'setDirectDebit', + 'ewallet' => 'setEwallet', + 'over_the_counter' => 'setOverTheCounter', + 'virtual_account' => 'setVirtualAccount', + 'qr_code' => 'setQrCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'reusability' => 'getReusability', + 'description' => 'getDescription', + 'reference_id' => 'getReferenceId', + 'direct_debit' => 'getDirectDebit', + 'ewallet' => 'getEwallet', + 'over_the_counter' => 'getOverTheCounter', + 'virtual_account' => 'getVirtualAccount', + 'qr_code' => 'getQrCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('reusability', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('direct_debit', $data ?? [], null); + $this->setIfExists('ewallet', $data ?? [], null); + $this->setIfExists('over_the_counter', $data ?? [], null); + $this->setIfExists('virtual_account', $data ?? [], null); + $this->setIfExists('qr_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['reusability'] === null) { + $invalidProperties[] = "'reusability' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \PaymentRequest\PaymentMethodType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \PaymentRequest\PaymentMethodType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets reusability + * + * @return \PaymentRequest\PaymentMethodReusability + */ + public function getReusability() + { + return $this->container['reusability']; + } + + /** + * Sets reusability + * + * @param \PaymentRequest\PaymentMethodReusability $reusability reusability + * + * @return self + */ + public function setReusability($reusability) + { + if (is_null($reusability)) { + throw new \InvalidArgumentException('non-nullable reusability cannot be null'); + } + $this->container['reusability'] = $reusability; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets direct_debit + * + * @return \PaymentRequest\DirectDebitParameters|null + */ + public function getDirectDebit() + { + return $this->container['direct_debit']; + } + + /** + * Sets direct_debit + * + * @param \PaymentRequest\DirectDebitParameters|null $direct_debit direct_debit + * + * @return self + */ + public function setDirectDebit($direct_debit) + { + if (is_null($direct_debit)) { + array_push($this->openAPINullablesSetToNull, 'direct_debit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('direct_debit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['direct_debit'] = $direct_debit; + + return $this; + } + + /** + * Gets ewallet + * + * @return \PaymentRequest\EWalletParameters|null + */ + public function getEwallet() + { + return $this->container['ewallet']; + } + + /** + * Sets ewallet + * + * @param \PaymentRequest\EWalletParameters|null $ewallet ewallet + * + * @return self + */ + public function setEwallet($ewallet) + { + if (is_null($ewallet)) { + array_push($this->openAPINullablesSetToNull, 'ewallet'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ewallet', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ewallet'] = $ewallet; + + return $this; + } + + /** + * Gets over_the_counter + * + * @return \PaymentRequest\OverTheCounterParameters|null + */ + public function getOverTheCounter() + { + return $this->container['over_the_counter']; + } + + /** + * Sets over_the_counter + * + * @param \PaymentRequest\OverTheCounterParameters|null $over_the_counter over_the_counter + * + * @return self + */ + public function setOverTheCounter($over_the_counter) + { + if (is_null($over_the_counter)) { + array_push($this->openAPINullablesSetToNull, 'over_the_counter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('over_the_counter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['over_the_counter'] = $over_the_counter; + + return $this; + } + + /** + * Gets virtual_account + * + * @return \PaymentRequest\VirtualAccountParameters|null + */ + public function getVirtualAccount() + { + return $this->container['virtual_account']; + } + + /** + * Sets virtual_account + * + * @param \PaymentRequest\VirtualAccountParameters|null $virtual_account virtual_account + * + * @return self + */ + public function setVirtualAccount($virtual_account) + { + if (is_null($virtual_account)) { + array_push($this->openAPINullablesSetToNull, 'virtual_account'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('virtual_account', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['virtual_account'] = $virtual_account; + + return $this; + } + + /** + * Gets qr_code + * + * @return \PaymentRequest\QRCodeParameters|null + */ + public function getQrCode() + { + return $this->container['qr_code']; + } + + /** + * Sets qr_code + * + * @param \PaymentRequest\QRCodeParameters|null $qr_code qr_code + * + * @return self + */ + public function setQrCode($qr_code) + { + if (is_null($qr_code)) { + array_push($this->openAPINullablesSetToNull, 'qr_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr_code'] = $qr_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentMethodReusability.php b/lib/PaymentRequest/PaymentMethodReusability.php new file mode 100644 index 0000000..8ce81d0 --- /dev/null +++ b/lib/PaymentRequest/PaymentMethodReusability.php @@ -0,0 +1,78 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodReusability: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::MULTIPLE_USE, + self::ONE_TIME_USE + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentMethodStatus.php b/lib/PaymentRequest/PaymentMethodStatus.php new file mode 100644 index 0000000..63cb655 --- /dev/null +++ b/lib/PaymentRequest/PaymentMethodStatus.php @@ -0,0 +1,87 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodStatus: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::ACTIVE, + self::INACTIVE, + self::PENDING, + self::EXPIRED, + self::FAILED + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentMethodType.php b/lib/PaymentRequest/PaymentMethodType.php new file mode 100644 index 0000000..a182bd0 --- /dev/null +++ b/lib/PaymentRequest/PaymentMethodType.php @@ -0,0 +1,90 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentMethodType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::CARD, + self::DIRECT_DEBIT, + self::EWALLET, + self::OVER_THE_COUNTER, + self::QR_CODE, + self::VIRTUAL_ACCOUNT + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentRequest.php b/lib/PaymentRequest/PaymentRequest.php new file mode 100644 index 0000000..5c92d7c --- /dev/null +++ b/lib/PaymentRequest/PaymentRequest.php @@ -0,0 +1,1258 @@ + + */ +class PaymentRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'created' => 'string', + 'updated' => 'string', + 'reference_id' => 'string', + 'business_id' => 'string', + 'customer_id' => 'string', + 'customer' => 'object', + 'amount' => 'float', + 'min_amount' => 'float', + 'max_amount' => 'float', + 'country' => '\Xendit\PaymentRequest\PaymentRequestCountry', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'payment_method' => '\Xendit\PaymentRequest\PaymentMethod', + 'description' => 'string', + 'failure_code' => 'string', + 'capture_method' => '\Xendit\PaymentRequest\PaymentRequestCaptureMethod', + 'initiator' => '\Xendit\PaymentRequest\PaymentRequestInitiator', + 'card_verification_results' => '\Xendit\PaymentRequest\PaymentRequestCardVerificationResults', + 'status' => '\Xendit\PaymentRequest\PaymentRequestStatus', + 'actions' => '\Xendit\PaymentRequest\PaymentRequestAction[]', + 'metadata' => 'object', + 'shipping_information' => '\Xendit\PaymentRequest\PaymentRequestShippingInformation', + 'items' => '\Xendit\PaymentRequest\PaymentRequestBasketItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'created' => null, + 'updated' => null, + 'reference_id' => null, + 'business_id' => null, + 'customer_id' => null, + 'customer' => null, + 'amount' => 'double', + 'min_amount' => 'double', + 'max_amount' => 'double', + 'country' => null, + 'currency' => null, + 'payment_method' => null, + 'description' => null, + 'failure_code' => null, + 'capture_method' => null, + 'initiator' => null, + 'card_verification_results' => null, + 'status' => null, + 'actions' => null, + 'metadata' => null, + 'shipping_information' => null, + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'created' => false, + 'updated' => false, + 'reference_id' => false, + 'business_id' => false, + 'customer_id' => true, + 'customer' => true, + 'amount' => false, + 'min_amount' => true, + 'max_amount' => true, + 'country' => false, + 'currency' => false, + 'payment_method' => false, + 'description' => true, + 'failure_code' => true, + 'capture_method' => true, + 'initiator' => true, + 'card_verification_results' => true, + 'status' => false, + 'actions' => false, + 'metadata' => true, + 'shipping_information' => true, + 'items' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'created' => 'created', + 'updated' => 'updated', + 'reference_id' => 'reference_id', + 'business_id' => 'business_id', + 'customer_id' => 'customer_id', + 'customer' => 'customer', + 'amount' => 'amount', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'country' => 'country', + 'currency' => 'currency', + 'payment_method' => 'payment_method', + 'description' => 'description', + 'failure_code' => 'failure_code', + 'capture_method' => 'capture_method', + 'initiator' => 'initiator', + 'card_verification_results' => 'card_verification_results', + 'status' => 'status', + 'actions' => 'actions', + 'metadata' => 'metadata', + 'shipping_information' => 'shipping_information', + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'reference_id' => 'setReferenceId', + 'business_id' => 'setBusinessId', + 'customer_id' => 'setCustomerId', + 'customer' => 'setCustomer', + 'amount' => 'setAmount', + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'country' => 'setCountry', + 'currency' => 'setCurrency', + 'payment_method' => 'setPaymentMethod', + 'description' => 'setDescription', + 'failure_code' => 'setFailureCode', + 'capture_method' => 'setCaptureMethod', + 'initiator' => 'setInitiator', + 'card_verification_results' => 'setCardVerificationResults', + 'status' => 'setStatus', + 'actions' => 'setActions', + 'metadata' => 'setMetadata', + 'shipping_information' => 'setShippingInformation', + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'reference_id' => 'getReferenceId', + 'business_id' => 'getBusinessId', + 'customer_id' => 'getCustomerId', + 'customer' => 'getCustomer', + 'amount' => 'getAmount', + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'country' => 'getCountry', + 'currency' => 'getCurrency', + 'payment_method' => 'getPaymentMethod', + 'description' => 'getDescription', + 'failure_code' => 'getFailureCode', + 'capture_method' => 'getCaptureMethod', + 'initiator' => 'getInitiator', + 'card_verification_results' => 'getCardVerificationResults', + 'status' => 'getStatus', + 'actions' => 'getActions', + 'metadata' => 'getMetadata', + 'shipping_information' => 'getShippingInformation', + 'items' => 'getItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('capture_method', $data ?? [], null); + $this->setIfExists('initiator', $data ?? [], null); + $this->setIfExists('card_verification_results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('actions', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('shipping_information', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ($this->container['business_id'] === null) { + $invalidProperties[] = "'business_id' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['payment_method'] === null) { + $invalidProperties[] = "'payment_method' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created + * + * @return string + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string $created created + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string $updated updated + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets business_id + * + * @return string + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string $business_id business_id + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets customer_id + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string|null $customer_id customer_id + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets customer + * + * @return object|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param object|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets country + * + * @return \PaymentRequest\PaymentRequestCountry|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param \PaymentRequest\PaymentRequestCountry|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets payment_method + * + * @return \PaymentRequest\PaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['payment_method']; + } + + /** + * Sets payment_method + * + * @param \PaymentRequest\PaymentMethod $payment_method payment_method + * + * @return self + */ + public function setPaymentMethod($payment_method) + { + if (is_null($payment_method)) { + throw new \InvalidArgumentException('non-nullable payment_method cannot be null'); + } + $this->container['payment_method'] = $payment_method; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code failure_code + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + array_push($this->openAPINullablesSetToNull, 'failure_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets capture_method + * + * @return \PaymentRequest\PaymentRequestCaptureMethod|null + */ + public function getCaptureMethod() + { + return $this->container['capture_method']; + } + + /** + * Sets capture_method + * + * @param \PaymentRequest\PaymentRequestCaptureMethod|null $capture_method capture_method + * + * @return self + */ + public function setCaptureMethod($capture_method) + { + if (is_null($capture_method)) { + array_push($this->openAPINullablesSetToNull, 'capture_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('capture_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['capture_method'] = $capture_method; + + return $this; + } + + /** + * Gets initiator + * + * @return \PaymentRequest\PaymentRequestInitiator|null + */ + public function getInitiator() + { + return $this->container['initiator']; + } + + /** + * Sets initiator + * + * @param \PaymentRequest\PaymentRequestInitiator|null $initiator initiator + * + * @return self + */ + public function setInitiator($initiator) + { + if (is_null($initiator)) { + array_push($this->openAPINullablesSetToNull, 'initiator'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initiator', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initiator'] = $initiator; + + return $this; + } + + /** + * Gets card_verification_results + * + * @return \PaymentRequest\PaymentRequestCardVerificationResults|null + */ + public function getCardVerificationResults() + { + return $this->container['card_verification_results']; + } + + /** + * Sets card_verification_results + * + * @param \PaymentRequest\PaymentRequestCardVerificationResults|null $card_verification_results card_verification_results + * + * @return self + */ + public function setCardVerificationResults($card_verification_results) + { + if (is_null($card_verification_results)) { + array_push($this->openAPINullablesSetToNull, 'card_verification_results'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('card_verification_results', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['card_verification_results'] = $card_verification_results; + + return $this; + } + + /** + * Gets status + * + * @return \PaymentRequest\PaymentRequestStatus + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \PaymentRequest\PaymentRequestStatus $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets actions + * + * @return \PaymentRequest\PaymentRequestAction[]|null + */ + public function getActions() + { + return $this->container['actions']; + } + + /** + * Sets actions + * + * @param \PaymentRequest\PaymentRequestAction[]|null $actions actions + * + * @return self + */ + public function setActions($actions) + { + if (is_null($actions)) { + throw new \InvalidArgumentException('non-nullable actions cannot be null'); + } + $this->container['actions'] = $actions; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets shipping_information + * + * @return \PaymentRequest\PaymentRequestShippingInformation|null + */ + public function getShippingInformation() + { + return $this->container['shipping_information']; + } + + /** + * Sets shipping_information + * + * @param \PaymentRequest\PaymentRequestShippingInformation|null $shipping_information shipping_information + * + * @return self + */ + public function setShippingInformation($shipping_information) + { + if (is_null($shipping_information)) { + array_push($this->openAPINullablesSetToNull, 'shipping_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('shipping_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['shipping_information'] = $shipping_information; + + return $this; + } + + /** + * Gets items + * + * @return \PaymentRequest\PaymentRequestBasketItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \PaymentRequest\PaymentRequestBasketItem[]|null $items items + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestAction.php b/lib/PaymentRequest/PaymentRequestAction.php new file mode 100644 index 0000000..b19df8b --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestAction.php @@ -0,0 +1,652 @@ + + */ +class PaymentRequestAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'action' => 'string', + 'url_type' => 'string', + 'method' => 'string', + 'url' => 'string', + 'qr_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'action' => null, + 'url_type' => null, + 'method' => null, + 'url' => null, + 'qr_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'action' => false, + 'url_type' => false, + 'method' => true, + 'url' => true, + 'qr_code' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'action' => 'action', + 'url_type' => 'url_type', + 'method' => 'method', + 'url' => 'url', + 'qr_code' => 'qr_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction', + 'url_type' => 'setUrlType', + 'method' => 'setMethod', + 'url' => 'setUrl', + 'qr_code' => 'setQrCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction', + 'url_type' => 'getUrlType', + 'method' => 'getMethod', + 'url' => 'getUrl', + 'qr_code' => 'getQrCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ACTION_AUTH = 'AUTH'; + public const ACTION_RESEND_AUTH = 'RESEND_AUTH'; + public const ACTION_CAPTURE = 'CAPTURE'; + public const ACTION_CANCEL = 'CANCEL'; + public const ACTION_PRESENT_TO_CUSTOMER = 'PRESENT_TO_CUSTOMER'; + public const URL_TYPE_API = 'API'; + public const URL_TYPE_WEB = 'WEB'; + public const URL_TYPE_MOBILE = 'MOBILE'; + public const URL_TYPE_DEEPLINK = 'DEEPLINK'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getActionAllowableValues() + { + return [ + self::ACTION_AUTH, + self::ACTION_RESEND_AUTH, + self::ACTION_CAPTURE, + self::ACTION_CANCEL, + self::ACTION_PRESENT_TO_CUSTOMER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUrlTypeAllowableValues() + { + return [ + self::URL_TYPE_API, + self::URL_TYPE_WEB, + self::URL_TYPE_MOBILE, + self::URL_TYPE_DEEPLINK, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('url_type', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('qr_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['action'] === null) { + $invalidProperties[] = "'action' can't be null"; + } + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'action', must be one of '%s'", + $this->container['action'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['url_type'] === null) { + $invalidProperties[] = "'url_type' can't be null"; + } + $allowedValues = $this->getUrlTypeAllowableValues(); + if (!is_null($this->container['url_type']) && !in_array($this->container['url_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'url_type', must be one of '%s'", + $this->container['url_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['method'] === null) { + $invalidProperties[] = "'method' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['qr_code'] === null) { + $invalidProperties[] = "'qr_code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets action + * + * @return string + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + $allowedValues = $this->getActionAllowableValues(); + if (!in_array($action, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'action', must be one of '%s'", + $action, + implode("', '", $allowedValues) + ) + ); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets url_type + * + * @return string + */ + public function getUrlType() + { + return $this->container['url_type']; + } + + /** + * Sets url_type + * + * @param string $url_type url_type + * + * @return self + */ + public function setUrlType($url_type) + { + if (is_null($url_type)) { + throw new \InvalidArgumentException('non-nullable url_type cannot be null'); + } + $allowedValues = $this->getUrlTypeAllowableValues(); + if (!in_array($url_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'url_type', must be one of '%s'", + $url_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['url_type'] = $url_type; + + return $this; + } + + /** + * Gets method + * + * @return string + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string $method method + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + array_push($this->openAPINullablesSetToNull, 'method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets qr_code + * + * @return string + */ + public function getQrCode() + { + return $this->container['qr_code']; + } + + /** + * Sets qr_code + * + * @param string $qr_code qr_code + * + * @return self + */ + public function setQrCode($qr_code) + { + if (is_null($qr_code)) { + array_push($this->openAPINullablesSetToNull, 'qr_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr_code'] = $qr_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestApi.php b/lib/PaymentRequest/PaymentRequestApi.php new file mode 100644 index 0000000..f6643c1 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestApi.php @@ -0,0 +1,2809 @@ + [ + 'application/json', + ], + 'capturePaymentRequest' => [ + 'application/json', + ], + 'createPaymentRequest' => [ + 'application/json', + ], + 'getAllPaymentRequests' => [ + 'application/json', + ], + 'getPaymentRequestByID' => [ + 'application/json', + ], + 'getPaymentRequestCaptures' => [ + 'application/json', + ], + 'resendPaymentRequestAuth' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation authorizePaymentRequest + * + * Payment Request Authorize + * + * @param string $payment_request_id payment_request_id (required) + * @param \Xendit\PaymentRequest\PaymentRequestAuthParameters $payment_request_auth_parameters payment_request_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authorizePaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function authorizePaymentRequest($payment_request_id, $payment_request_auth_parameters = null, string $contentType = self::contentTypes['authorizePaymentRequest'][0]) + { + list($response) = $this->authorizePaymentRequestWithHttpInfo($payment_request_id, $payment_request_auth_parameters, $contentType); + return $response; + } + + /** + * Operation authorizePaymentRequestWithHttpInfo + * + * Payment Request Authorize + * + * @param string $payment_request_id (required) + * @param \Xendit\PaymentRequest\PaymentRequestAuthParameters $payment_request_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authorizePaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function authorizePaymentRequestWithHttpInfo($payment_request_id, $payment_request_auth_parameters = null, string $contentType = self::contentTypes['authorizePaymentRequest'][0]) + { + $request = $this->authorizePaymentRequestRequest($payment_request_id, $payment_request_auth_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\PaymentRequest' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\PaymentRequest' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\PaymentRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\PaymentRequest'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\PaymentRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation authorizePaymentRequestAsync + * + * Payment Request Authorize + * + * @param Xenditstring $payment_request_id (required) + * @param Xendit\Xendit\PaymentRequest\PaymentRequestAuthParameters $payment_request_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authorizePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function authorizePaymentRequestAsync($payment_request_id, $payment_request_auth_parameters = null, string $contentType = self::contentTypes['authorizePaymentRequest'][0]) + { + return $this->authorizePaymentRequestAsyncWithHttpInfo($payment_request_id, $payment_request_auth_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation authorizePaymentRequestAsyncWithHttpInfo + * + * Payment Request Authorize + * + * @param Xenditstring $payment_request_id (required) + * @param Xendit\Xendit\PaymentRequest\PaymentRequestAuthParameters $payment_request_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authorizePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function authorizePaymentRequestAsyncWithHttpInfo($payment_request_id, $payment_request_auth_parameters = null, string $contentType = self::contentTypes['authorizePaymentRequest'][0]) + { + $returnType = '\PaymentRequest\PaymentRequest'; + $request = $this->authorizePaymentRequestRequest($payment_request_id, $payment_request_auth_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'authorizePaymentRequest' + * + * @param string $payment_request_id (required) + * @param \Xendit\PaymentRequest\PaymentRequestAuthParameters $payment_request_auth_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['authorizePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function authorizePaymentRequestRequest($payment_request_id, $payment_request_auth_parameters = null, string $contentType = self::contentTypes['authorizePaymentRequest'][0]) + { + + // verify the required parameter 'payment_request_id' is set + if ($payment_request_id === null || (is_array($payment_request_id) && count($payment_request_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_request_id when calling authorizePaymentRequest' + ); + } + + + + $resourcePath = '/payment_requests/{paymentRequestId}/auth'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_request_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentRequestId' . '}', + ObjectSerializer::toPathValue($payment_request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_request_auth_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_request_auth_parameters)); + } else { + $httpBody = $payment_request_auth_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation capturePaymentRequest + * + * Payment Request Capture + * + * @param string $payment_request_id payment_request_id (required) + * @param \Xendit\PaymentRequest\CaptureParameters $capture_parameters capture_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['capturePaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\Capture|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function capturePaymentRequest($payment_request_id, $capture_parameters = null, string $contentType = self::contentTypes['capturePaymentRequest'][0]) + { + list($response) = $this->capturePaymentRequestWithHttpInfo($payment_request_id, $capture_parameters, $contentType); + return $response; + } + + /** + * Operation capturePaymentRequestWithHttpInfo + * + * Payment Request Capture + * + * @param string $payment_request_id (required) + * @param \Xendit\PaymentRequest\CaptureParameters $capture_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['capturePaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\Capture|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function capturePaymentRequestWithHttpInfo($payment_request_id, $capture_parameters = null, string $contentType = self::contentTypes['capturePaymentRequest'][0]) + { + $request = $this->capturePaymentRequestRequest($payment_request_id, $capture_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('Xendit\PaymentRequest\Capture' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Capture' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Capture', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\Capture'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Capture', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation capturePaymentRequestAsync + * + * Payment Request Capture + * + * @param Xenditstring $payment_request_id (required) + * @param Xendit\Xendit\PaymentRequest\CaptureParameters $capture_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['capturePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function capturePaymentRequestAsync($payment_request_id, $capture_parameters = null, string $contentType = self::contentTypes['capturePaymentRequest'][0]) + { + return $this->capturePaymentRequestAsyncWithHttpInfo($payment_request_id, $capture_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation capturePaymentRequestAsyncWithHttpInfo + * + * Payment Request Capture + * + * @param Xenditstring $payment_request_id (required) + * @param Xendit\Xendit\PaymentRequest\CaptureParameters $capture_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['capturePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function capturePaymentRequestAsyncWithHttpInfo($payment_request_id, $capture_parameters = null, string $contentType = self::contentTypes['capturePaymentRequest'][0]) + { + $returnType = '\PaymentRequest\Capture'; + $request = $this->capturePaymentRequestRequest($payment_request_id, $capture_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'capturePaymentRequest' + * + * @param string $payment_request_id (required) + * @param \Xendit\PaymentRequest\CaptureParameters $capture_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['capturePaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function capturePaymentRequestRequest($payment_request_id, $capture_parameters = null, string $contentType = self::contentTypes['capturePaymentRequest'][0]) + { + + // verify the required parameter 'payment_request_id' is set + if ($payment_request_id === null || (is_array($payment_request_id) && count($payment_request_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_request_id when calling capturePaymentRequest' + ); + } + + + + $resourcePath = '/payment_requests/{paymentRequestId}/captures'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_request_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentRequestId' . '}', + ObjectSerializer::toPathValue($payment_request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($capture_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($capture_parameters)); + } else { + $httpBody = $capture_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createPaymentRequest + * + * Create Payment Request + * + * @param string $idempotency_key idempotency_key (optional) + * @param \Xendit\PaymentRequest\PaymentRequestParameters $payment_request_parameters payment_request_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function createPaymentRequest($idempotency_key = null, $payment_request_parameters = null, string $contentType = self::contentTypes['createPaymentRequest'][0]) + { + list($response) = $this->createPaymentRequestWithHttpInfo($idempotency_key, $payment_request_parameters, $contentType); + return $response; + } + + /** + * Operation createPaymentRequestWithHttpInfo + * + * Create Payment Request + * + * @param string $idempotency_key (optional) + * @param \Xendit\PaymentRequest\PaymentRequestParameters $payment_request_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createPaymentRequestWithHttpInfo($idempotency_key = null, $payment_request_parameters = null, string $contentType = self::contentTypes['createPaymentRequest'][0]) + { + $request = $this->createPaymentRequestRequest($idempotency_key, $payment_request_parameters, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\PaymentRequest' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\PaymentRequest' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\PaymentRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\PaymentRequest'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\PaymentRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPaymentRequestAsync + * + * Create Payment Request + * + * @param Xenditstring $idempotency_key (optional) + * @param Xendit\Xendit\PaymentRequest\PaymentRequestParameters $payment_request_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPaymentRequestAsync($idempotency_key = null, $payment_request_parameters = null, string $contentType = self::contentTypes['createPaymentRequest'][0]) + { + return $this->createPaymentRequestAsyncWithHttpInfo($idempotency_key, $payment_request_parameters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPaymentRequestAsyncWithHttpInfo + * + * Create Payment Request + * + * @param Xenditstring $idempotency_key (optional) + * @param Xendit\Xendit\PaymentRequest\PaymentRequestParameters $payment_request_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPaymentRequestAsyncWithHttpInfo($idempotency_key = null, $payment_request_parameters = null, string $contentType = self::contentTypes['createPaymentRequest'][0]) + { + $returnType = '\PaymentRequest\PaymentRequest'; + $request = $this->createPaymentRequestRequest($idempotency_key, $payment_request_parameters, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createPaymentRequest' + * + * @param string $idempotency_key (optional) + * @param \Xendit\PaymentRequest\PaymentRequestParameters $payment_request_parameters (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPaymentRequest'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPaymentRequestRequest($idempotency_key = null, $payment_request_parameters = null, string $contentType = self::contentTypes['createPaymentRequest'][0]) + { + + + + + $resourcePath = '/payment_requests'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: idempotency-key + if ($idempotency_key !== null) { + $headerParams['idempotency-key'] = ObjectSerializer::toHeaderValue($idempotency_key); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($payment_request_parameters)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($payment_request_parameters)); + } else { + $httpBody = $payment_request_parameters; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllPaymentRequests + * + * Get all payment requests by filter + * + * @param string[] $reference_id reference_id (optional) + * @param string[] $id id (optional) + * @param string[] $customer_id customer_id (optional) + * @param int $limit limit (optional) + * @param string $before_id before_id (optional) + * @param string $after_id after_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentRequests'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\PaymentRequestListResponse|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function getAllPaymentRequests($reference_id = null, $id = null, $customer_id = null, $limit = null, $before_id = null, $after_id = null, string $contentType = self::contentTypes['getAllPaymentRequests'][0]) + { + list($response) = $this->getAllPaymentRequestsWithHttpInfo($reference_id, $id, $customer_id, $limit, $before_id, $after_id, $contentType); + return $response; + } + + /** + * Operation getAllPaymentRequestsWithHttpInfo + * + * Get all payment requests by filter + * + * @param string[] $reference_id (optional) + * @param string[] $id (optional) + * @param string[] $customer_id (optional) + * @param int $limit (optional) + * @param string $before_id (optional) + * @param string $after_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentRequests'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\PaymentRequestListResponse|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllPaymentRequestsWithHttpInfo($reference_id = null, $id = null, $customer_id = null, $limit = null, $before_id = null, $after_id = null, string $contentType = self::contentTypes['getAllPaymentRequests'][0]) + { + $request = $this->getAllPaymentRequestsRequest($reference_id, $id, $customer_id, $limit, $before_id, $after_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\PaymentRequestListResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\PaymentRequestListResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\PaymentRequestListResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\PaymentRequestListResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\PaymentRequestListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllPaymentRequestsAsync + * + * Get all payment requests by filter + * + * @param Xenditstring[] $reference_id (optional) + * @param Xenditstring[] $id (optional) + * @param Xenditstring[] $customer_id (optional) + * @param Xenditint $limit (optional) + * @param Xenditstring $before_id (optional) + * @param Xenditstring $after_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentRequestsAsync($reference_id = null, $id = null, $customer_id = null, $limit = null, $before_id = null, $after_id = null, string $contentType = self::contentTypes['getAllPaymentRequests'][0]) + { + return $this->getAllPaymentRequestsAsyncWithHttpInfo($reference_id, $id, $customer_id, $limit, $before_id, $after_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllPaymentRequestsAsyncWithHttpInfo + * + * Get all payment requests by filter + * + * @param Xenditstring[] $reference_id (optional) + * @param Xenditstring[] $id (optional) + * @param Xenditstring[] $customer_id (optional) + * @param Xenditint $limit (optional) + * @param Xenditstring $before_id (optional) + * @param Xenditstring $after_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentRequestsAsyncWithHttpInfo($reference_id = null, $id = null, $customer_id = null, $limit = null, $before_id = null, $after_id = null, string $contentType = self::contentTypes['getAllPaymentRequests'][0]) + { + $returnType = '\PaymentRequest\PaymentRequestListResponse'; + $request = $this->getAllPaymentRequestsRequest($reference_id, $id, $customer_id, $limit, $before_id, $after_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllPaymentRequests' + * + * @param string[] $reference_id (optional) + * @param string[] $id (optional) + * @param string[] $customer_id (optional) + * @param int $limit (optional) + * @param string $before_id (optional) + * @param string $after_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllPaymentRequests'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllPaymentRequestsRequest($reference_id = null, $id = null, $customer_id = null, $limit = null, $before_id = null, $after_id = null, string $contentType = self::contentTypes['getAllPaymentRequests'][0]) + { + + + + + + + + + $resourcePath = '/payment_requests'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reference_id, + 'reference_id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer_id, + 'customer_id', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentRequestByID + * + * Get payment request by ID + * + * @param string $payment_request_id payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function getPaymentRequestByID($payment_request_id, string $contentType = self::contentTypes['getPaymentRequestByID'][0]) + { + list($response) = $this->getPaymentRequestByIDWithHttpInfo($payment_request_id, $contentType); + return $response; + } + + /** + * Operation getPaymentRequestByIDWithHttpInfo + * + * Get payment request by ID + * + * @param string $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestByID'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentRequestByIDWithHttpInfo($payment_request_id, string $contentType = self::contentTypes['getPaymentRequestByID'][0]) + { + $request = $this->getPaymentRequestByIDRequest($payment_request_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\PaymentRequest' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\PaymentRequest' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\PaymentRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\PaymentRequest'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\PaymentRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentRequestByIDAsync + * + * Get payment request by ID + * + * @param Xenditstring $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentRequestByIDAsync($payment_request_id, string $contentType = self::contentTypes['getPaymentRequestByID'][0]) + { + return $this->getPaymentRequestByIDAsyncWithHttpInfo($payment_request_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentRequestByIDAsyncWithHttpInfo + * + * Get payment request by ID + * + * @param Xenditstring $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentRequestByIDAsyncWithHttpInfo($payment_request_id, string $contentType = self::contentTypes['getPaymentRequestByID'][0]) + { + $returnType = '\PaymentRequest\PaymentRequest'; + $request = $this->getPaymentRequestByIDRequest($payment_request_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPaymentRequestByID' + * + * @param string $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestByID'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentRequestByIDRequest($payment_request_id, string $contentType = self::contentTypes['getPaymentRequestByID'][0]) + { + + // verify the required parameter 'payment_request_id' is set + if ($payment_request_id === null || (is_array($payment_request_id) && count($payment_request_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_request_id when calling getPaymentRequestByID' + ); + } + + + $resourcePath = '/payment_requests/{paymentRequestId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_request_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentRequestId' . '}', + ObjectSerializer::toPathValue($payment_request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentRequestCaptures + * + * Get Payment Request Capture + * + * @param string $payment_request_id payment_request_id (required) + * @param int $limit limit (optional) + * @param string $after_id after_id (optional) + * @param string $before_id before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestCaptures'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\CaptureListResponse|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function getPaymentRequestCaptures($payment_request_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentRequestCaptures'][0]) + { + list($response) = $this->getPaymentRequestCapturesWithHttpInfo($payment_request_id, $limit, $after_id, $before_id, $contentType); + return $response; + } + + /** + * Operation getPaymentRequestCapturesWithHttpInfo + * + * Get Payment Request Capture + * + * @param string $payment_request_id (required) + * @param int $limit (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestCaptures'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\CaptureListResponse|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentRequestCapturesWithHttpInfo($payment_request_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentRequestCaptures'][0]) + { + $request = $this->getPaymentRequestCapturesRequest($payment_request_id, $limit, $after_id, $before_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\CaptureListResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\CaptureListResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\CaptureListResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\CaptureListResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\CaptureListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentRequestCapturesAsync + * + * Get Payment Request Capture + * + * @param Xenditstring $payment_request_id (required) + * @param Xenditint $limit (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestCaptures'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentRequestCapturesAsync($payment_request_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentRequestCaptures'][0]) + { + return $this->getPaymentRequestCapturesAsyncWithHttpInfo($payment_request_id, $limit, $after_id, $before_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentRequestCapturesAsyncWithHttpInfo + * + * Get Payment Request Capture + * + * @param Xenditstring $payment_request_id (required) + * @param Xenditint $limit (optional) + * @param Xenditstring $after_id (optional) + * @param Xenditstring $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestCaptures'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentRequestCapturesAsyncWithHttpInfo($payment_request_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentRequestCaptures'][0]) + { + $returnType = '\PaymentRequest\CaptureListResponse'; + $request = $this->getPaymentRequestCapturesRequest($payment_request_id, $limit, $after_id, $before_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPaymentRequestCaptures' + * + * @param string $payment_request_id (required) + * @param int $limit (optional) + * @param string $after_id (optional) + * @param string $before_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPaymentRequestCaptures'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentRequestCapturesRequest($payment_request_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPaymentRequestCaptures'][0]) + { + + // verify the required parameter 'payment_request_id' is set + if ($payment_request_id === null || (is_array($payment_request_id) && count($payment_request_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_request_id when calling getPaymentRequestCaptures' + ); + } + + + + + + $resourcePath = '/payment_requests/{paymentRequestId}/captures'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // path params + if ($payment_request_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentRequestId' . '}', + ObjectSerializer::toPathValue($payment_request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation resendPaymentRequestAuth + * + * Payment Request Resend Auth + * + * @param string $payment_request_id payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendPaymentRequestAuth'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error + */ + public function resendPaymentRequestAuth($payment_request_id, string $contentType = self::contentTypes['resendPaymentRequestAuth'][0]) + { + list($response) = $this->resendPaymentRequestAuthWithHttpInfo($payment_request_id, $contentType); + return $response; + } + + /** + * Operation resendPaymentRequestAuthWithHttpInfo + * + * Payment Request Resend Auth + * + * @param string $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendPaymentRequestAuth'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\PaymentRequest\PaymentRequest|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error|Xendit\PaymentRequest\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function resendPaymentRequestAuthWithHttpInfo($payment_request_id, string $contentType = self::contentTypes['resendPaymentRequestAuth'][0]) + { + $request = $this->resendPaymentRequestAuthRequest($payment_request_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\PaymentRequest\PaymentRequest' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\PaymentRequest' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\PaymentRequest', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\PaymentRequest\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\PaymentRequest\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\PaymentRequest\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\PaymentRequest\PaymentRequest'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\PaymentRequest', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\PaymentRequest\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation resendPaymentRequestAuthAsync + * + * Payment Request Resend Auth + * + * @param Xenditstring $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendPaymentRequestAuth'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendPaymentRequestAuthAsync($payment_request_id, string $contentType = self::contentTypes['resendPaymentRequestAuth'][0]) + { + return $this->resendPaymentRequestAuthAsyncWithHttpInfo($payment_request_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation resendPaymentRequestAuthAsyncWithHttpInfo + * + * Payment Request Resend Auth + * + * @param Xenditstring $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendPaymentRequestAuth'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function resendPaymentRequestAuthAsyncWithHttpInfo($payment_request_id, string $contentType = self::contentTypes['resendPaymentRequestAuth'][0]) + { + $returnType = '\PaymentRequest\PaymentRequest'; + $request = $this->resendPaymentRequestAuthRequest($payment_request_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'resendPaymentRequestAuth' + * + * @param string $payment_request_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resendPaymentRequestAuth'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function resendPaymentRequestAuthRequest($payment_request_id, string $contentType = self::contentTypes['resendPaymentRequestAuth'][0]) + { + + // verify the required parameter 'payment_request_id' is set + if ($payment_request_id === null || (is_array($payment_request_id) && count($payment_request_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $payment_request_id when calling resendPaymentRequestAuth' + ); + } + + + $resourcePath = '/payment_requests/{paymentRequestId}/auth/resend'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($payment_request_id !== null) { + $resourcePath = str_replace( + '{' . 'paymentRequestId' . '}', + ObjectSerializer::toPathValue($payment_request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/PaymentRequest/PaymentRequestAuthParameters.php b/lib/PaymentRequest/PaymentRequestAuthParameters.php new file mode 100644 index 0000000..0f31a89 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestAuthParameters.php @@ -0,0 +1,405 @@ + + */ +class PaymentRequestAuthParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestAuthParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'auth_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'auth_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'auth_code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'auth_code' => 'auth_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'auth_code' => 'setAuthCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'auth_code' => 'getAuthCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('auth_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['auth_code'] === null) { + $invalidProperties[] = "'auth_code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets auth_code + * + * @return string + */ + public function getAuthCode() + { + return $this->container['auth_code']; + } + + /** + * Sets auth_code + * + * @param string $auth_code auth_code + * + * @return self + */ + public function setAuthCode($auth_code) + { + if (is_null($auth_code)) { + throw new \InvalidArgumentException('non-nullable auth_code cannot be null'); + } + $this->container['auth_code'] = $auth_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestBasketItem.php b/lib/PaymentRequest/PaymentRequestBasketItem.php new file mode 100644 index 0000000..6962663 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestBasketItem.php @@ -0,0 +1,825 @@ + + */ +class PaymentRequestBasketItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestBasketItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'type' => 'string', + 'category' => 'string', + 'sub_category' => 'string', + 'currency' => 'string', + 'quantity' => 'float', + 'price' => 'float', + 'payer_charged_currency' => 'string', + 'payer_charged_price' => 'float', + 'url' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'name' => null, + 'description' => null, + 'type' => null, + 'category' => null, + 'sub_category' => null, + 'currency' => null, + 'quantity' => 'double', + 'price' => 'double', + 'payer_charged_currency' => null, + 'payer_charged_price' => 'double', + 'url' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false, + 'name' => false, + 'description' => false, + 'type' => false, + 'category' => false, + 'sub_category' => false, + 'currency' => false, + 'quantity' => false, + 'price' => false, + 'payer_charged_currency' => false, + 'payer_charged_price' => false, + 'url' => false, + 'metadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'name' => 'name', + 'description' => 'description', + 'type' => 'type', + 'category' => 'category', + 'sub_category' => 'sub_category', + 'currency' => 'currency', + 'quantity' => 'quantity', + 'price' => 'price', + 'payer_charged_currency' => 'payer_charged_currency', + 'payer_charged_price' => 'payer_charged_price', + 'url' => 'url', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'type' => 'setType', + 'category' => 'setCategory', + 'sub_category' => 'setSubCategory', + 'currency' => 'setCurrency', + 'quantity' => 'setQuantity', + 'price' => 'setPrice', + 'payer_charged_currency' => 'setPayerChargedCurrency', + 'payer_charged_price' => 'setPayerChargedPrice', + 'url' => 'setUrl', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'type' => 'getType', + 'category' => 'getCategory', + 'sub_category' => 'getSubCategory', + 'currency' => 'getCurrency', + 'quantity' => 'getQuantity', + 'price' => 'getPrice', + 'payer_charged_currency' => 'getPayerChargedCurrency', + 'payer_charged_price' => 'getPayerChargedPrice', + 'url' => 'getUrl', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('payer_charged_currency', $data ?? [], null); + $this->setIfExists('payer_charged_price', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + if ($this->container['price'] === null) { + $invalidProperties[] = "'price' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets sub_category + * + * @return string|null + */ + public function getSubCategory() + { + return $this->container['sub_category']; + } + + /** + * Sets sub_category + * + * @param string|null $sub_category sub_category + * + * @return self + */ + public function setSubCategory($sub_category) + { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } + $this->container['sub_category'] = $sub_category; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets price + * + * @return float + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets payer_charged_currency + * + * @return string|null + */ + public function getPayerChargedCurrency() + { + return $this->container['payer_charged_currency']; + } + + /** + * Sets payer_charged_currency + * + * @param string|null $payer_charged_currency payer_charged_currency + * + * @return self + */ + public function setPayerChargedCurrency($payer_charged_currency) + { + if (is_null($payer_charged_currency)) { + throw new \InvalidArgumentException('non-nullable payer_charged_currency cannot be null'); + } + $this->container['payer_charged_currency'] = $payer_charged_currency; + + return $this; + } + + /** + * Gets payer_charged_price + * + * @return float|null + */ + public function getPayerChargedPrice() + { + return $this->container['payer_charged_price']; + } + + /** + * Sets payer_charged_price + * + * @param float|null $payer_charged_price payer_charged_price + * + * @return self + */ + public function setPayerChargedPrice($payer_charged_price) + { + if (is_null($payer_charged_price)) { + throw new \InvalidArgumentException('non-nullable payer_charged_price cannot be null'); + } + $this->container['payer_charged_price'] = $payer_charged_price; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestCaptureMethod.php b/lib/PaymentRequest/PaymentRequestCaptureMethod.php new file mode 100644 index 0000000..2fc750a --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestCaptureMethod.php @@ -0,0 +1,78 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentRequestCaptureMethod: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::AUTOMATIC, + self::MANUAL + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestCardVerificationResults.php b/lib/PaymentRequest/PaymentRequestCardVerificationResults.php new file mode 100644 index 0000000..6d0bd2a --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestCardVerificationResults.php @@ -0,0 +1,494 @@ + + */ +class PaymentRequestCardVerificationResults implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestCardVerificationResults'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure' => '\Xendit\PaymentRequest\PaymentRequestCardVerificationResultsThreeDeeSecure', + 'cvv_result' => 'string', + 'address_verification_result' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure' => null, + 'cvv_result' => null, + 'address_verification_result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure' => true, + 'cvv_result' => true, + 'address_verification_result' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure' => 'three_d_secure', + 'cvv_result' => 'cvv_result', + 'address_verification_result' => 'address_verification_result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure' => 'setThreeDSecure', + 'cvv_result' => 'setCvvResult', + 'address_verification_result' => 'setAddressVerificationResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure' => 'getThreeDSecure', + 'cvv_result' => 'getCvvResult', + 'address_verification_result' => 'getAddressVerificationResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure', $data ?? [], null); + $this->setIfExists('cvv_result', $data ?? [], null); + $this->setIfExists('address_verification_result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['three_d_secure'] === null) { + $invalidProperties[] = "'three_d_secure' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure + * + * @return \PaymentRequest\PaymentRequestCardVerificationResultsThreeDeeSecure + */ + public function getThreeDSecure() + { + return $this->container['three_d_secure']; + } + + /** + * Sets three_d_secure + * + * @param \PaymentRequest\PaymentRequestCardVerificationResultsThreeDeeSecure $three_d_secure three_d_secure + * + * @return self + */ + public function setThreeDSecure($three_d_secure) + { + if (is_null($three_d_secure)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure'] = $three_d_secure; + + return $this; + } + + /** + * Gets cvv_result + * + * @return string|null + */ + public function getCvvResult() + { + return $this->container['cvv_result']; + } + + /** + * Sets cvv_result + * + * @param string|null $cvv_result cvv_result + * + * @return self + */ + public function setCvvResult($cvv_result) + { + if (is_null($cvv_result)) { + array_push($this->openAPINullablesSetToNull, 'cvv_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cvv_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cvv_result'] = $cvv_result; + + return $this; + } + + /** + * Gets address_verification_result + * + * @return string|null + */ + public function getAddressVerificationResult() + { + return $this->container['address_verification_result']; + } + + /** + * Sets address_verification_result + * + * @param string|null $address_verification_result address_verification_result + * + * @return self + */ + public function setAddressVerificationResult($address_verification_result) + { + if (is_null($address_verification_result)) { + array_push($this->openAPINullablesSetToNull, 'address_verification_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address_verification_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address_verification_result'] = $address_verification_result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.php b/lib/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.php new file mode 100644 index 0000000..40a727c --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestCardVerificationResultsThreeDeeSecure.php @@ -0,0 +1,545 @@ + + */ +class PaymentRequestCardVerificationResultsThreeDeeSecure implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestCardVerificationResultsThreeDeeSecure'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'three_d_secure_flow' => 'string', + 'eci_code' => 'string', + 'three_d_secure_result' => 'string', + 'three_d_secure_result_reason' => 'string', + 'three_d_secure_version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'three_d_secure_flow' => null, + 'eci_code' => null, + 'three_d_secure_result' => null, + 'three_d_secure_result_reason' => null, + 'three_d_secure_version' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'three_d_secure_flow' => false, + 'eci_code' => false, + 'three_d_secure_result' => false, + 'three_d_secure_result_reason' => true, + 'three_d_secure_version' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'three_d_secure_flow' => 'three_d_secure_flow', + 'eci_code' => 'eci_code', + 'three_d_secure_result' => 'three_d_secure_result', + 'three_d_secure_result_reason' => 'three_d_secure_result_reason', + 'three_d_secure_version' => 'three_d_secure_version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'three_d_secure_flow' => 'setThreeDSecureFlow', + 'eci_code' => 'setEciCode', + 'three_d_secure_result' => 'setThreeDSecureResult', + 'three_d_secure_result_reason' => 'setThreeDSecureResultReason', + 'three_d_secure_version' => 'setThreeDSecureVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'three_d_secure_flow' => 'getThreeDSecureFlow', + 'eci_code' => 'getEciCode', + 'three_d_secure_result' => 'getThreeDSecureResult', + 'three_d_secure_result_reason' => 'getThreeDSecureResultReason', + 'three_d_secure_version' => 'getThreeDSecureVersion' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('three_d_secure_flow', $data ?? [], null); + $this->setIfExists('eci_code', $data ?? [], null); + $this->setIfExists('three_d_secure_result', $data ?? [], null); + $this->setIfExists('three_d_secure_result_reason', $data ?? [], null); + $this->setIfExists('three_d_secure_version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets three_d_secure_flow + * + * @return string|null + */ + public function getThreeDSecureFlow() + { + return $this->container['three_d_secure_flow']; + } + + /** + * Sets three_d_secure_flow + * + * @param string|null $three_d_secure_flow three_d_secure_flow + * + * @return self + */ + public function setThreeDSecureFlow($three_d_secure_flow) + { + if (is_null($three_d_secure_flow)) { + throw new \InvalidArgumentException('non-nullable three_d_secure_flow cannot be null'); + } + $this->container['three_d_secure_flow'] = $three_d_secure_flow; + + return $this; + } + + /** + * Gets eci_code + * + * @return string|null + */ + public function getEciCode() + { + return $this->container['eci_code']; + } + + /** + * Sets eci_code + * + * @param string|null $eci_code eci_code + * + * @return self + */ + public function setEciCode($eci_code) + { + if (is_null($eci_code)) { + throw new \InvalidArgumentException('non-nullable eci_code cannot be null'); + } + $this->container['eci_code'] = $eci_code; + + return $this; + } + + /** + * Gets three_d_secure_result + * + * @return string|null + */ + public function getThreeDSecureResult() + { + return $this->container['three_d_secure_result']; + } + + /** + * Sets three_d_secure_result + * + * @param string|null $three_d_secure_result three_d_secure_result + * + * @return self + */ + public function setThreeDSecureResult($three_d_secure_result) + { + if (is_null($three_d_secure_result)) { + throw new \InvalidArgumentException('non-nullable three_d_secure_result cannot be null'); + } + $this->container['three_d_secure_result'] = $three_d_secure_result; + + return $this; + } + + /** + * Gets three_d_secure_result_reason + * + * @return string|null + */ + public function getThreeDSecureResultReason() + { + return $this->container['three_d_secure_result_reason']; + } + + /** + * Sets three_d_secure_result_reason + * + * @param string|null $three_d_secure_result_reason three_d_secure_result_reason + * + * @return self + */ + public function setThreeDSecureResultReason($three_d_secure_result_reason) + { + if (is_null($three_d_secure_result_reason)) { + array_push($this->openAPINullablesSetToNull, 'three_d_secure_result_reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('three_d_secure_result_reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['three_d_secure_result_reason'] = $three_d_secure_result_reason; + + return $this; + } + + /** + * Gets three_d_secure_version + * + * @return string|null + */ + public function getThreeDSecureVersion() + { + return $this->container['three_d_secure_version']; + } + + /** + * Sets three_d_secure_version + * + * @param string|null $three_d_secure_version three_d_secure_version + * + * @return self + */ + public function setThreeDSecureVersion($three_d_secure_version) + { + if (is_null($three_d_secure_version)) { + throw new \InvalidArgumentException('non-nullable three_d_secure_version cannot be null'); + } + $this->container['three_d_secure_version'] = $three_d_secure_version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestChannelProperties.php b/lib/PaymentRequest/PaymentRequestChannelProperties.php new file mode 100644 index 0000000..c90def3 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestChannelProperties.php @@ -0,0 +1,640 @@ + + */ +class PaymentRequestChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cancel_return_url' => 'string', + 'redeem_points' => 'string', + 'require_auth' => 'bool', + 'merchant_id_tag' => 'string', + 'cardonfile_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => null, + 'failure_return_url' => null, + 'cancel_return_url' => null, + 'redeem_points' => null, + 'require_auth' => null, + 'merchant_id_tag' => null, + 'cardonfile_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => false, + 'cancel_return_url' => false, + 'redeem_points' => false, + 'require_auth' => false, + 'merchant_id_tag' => false, + 'cardonfile_type' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cancel_return_url' => 'cancel_return_url', + 'redeem_points' => 'redeem_points', + 'require_auth' => 'require_auth', + 'merchant_id_tag' => 'merchant_id_tag', + 'cardonfile_type' => 'cardonfile_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cancel_return_url' => 'setCancelReturnUrl', + 'redeem_points' => 'setRedeemPoints', + 'require_auth' => 'setRequireAuth', + 'merchant_id_tag' => 'setMerchantIdTag', + 'cardonfile_type' => 'setCardonfileType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cancel_return_url' => 'getCancelReturnUrl', + 'redeem_points' => 'getRedeemPoints', + 'require_auth' => 'getRequireAuth', + 'merchant_id_tag' => 'getMerchantIdTag', + 'cardonfile_type' => 'getCardonfileType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cancel_return_url', $data ?? [], null); + $this->setIfExists('redeem_points', $data ?? [], null); + $this->setIfExists('require_auth', $data ?? [], null); + $this->setIfExists('merchant_id_tag', $data ?? [], null); + $this->setIfExists('cardonfile_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['cancel_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['cancel_return_url'])) { + $invalidProperties[] = "invalid value for 'cancel_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling PaymentRequestChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling PaymentRequestChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cancel_return_url + * + * @return string|null + */ + public function getCancelReturnUrl() + { + return $this->container['cancel_return_url']; + } + + /** + * Sets cancel_return_url + * + * @param string|null $cancel_return_url URL where the end-customer is redirected if the authorization cancelled + * + * @return self + */ + public function setCancelReturnUrl($cancel_return_url) + { + if (is_null($cancel_return_url)) { + throw new \InvalidArgumentException('non-nullable cancel_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $cancel_return_url))) { + throw new \InvalidArgumentException("invalid value for \$cancel_return_url when calling PaymentRequestChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['cancel_return_url'] = $cancel_return_url; + + return $this; + } + + /** + * Gets redeem_points + * + * @return string|null + */ + public function getRedeemPoints() + { + return $this->container['redeem_points']; + } + + /** + * Sets redeem_points + * + * @param string|null $redeem_points REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. + * + * @return self + */ + public function setRedeemPoints($redeem_points) + { + if (is_null($redeem_points)) { + throw new \InvalidArgumentException('non-nullable redeem_points cannot be null'); + } + $this->container['redeem_points'] = $redeem_points; + + return $this; + } + + /** + * Gets require_auth + * + * @return bool|null + */ + public function getRequireAuth() + { + return $this->container['require_auth']; + } + + /** + * Sets require_auth + * + * @param bool|null $require_auth Toggle used to require end-customer to input undergo OTP validation before completing a payment. OTP will always be required for transactions greater than 1,000,000 IDR. For BRI tokenized payment use only. + * + * @return self + */ + public function setRequireAuth($require_auth) + { + if (is_null($require_auth)) { + throw new \InvalidArgumentException('non-nullable require_auth cannot be null'); + } + $this->container['require_auth'] = $require_auth; + + return $this; + } + + /** + * Gets merchant_id_tag + * + * @return string|null + */ + public function getMerchantIdTag() + { + return $this->container['merchant_id_tag']; + } + + /** + * Sets merchant_id_tag + * + * @param string|null $merchant_id_tag Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use + * + * @return self + */ + public function setMerchantIdTag($merchant_id_tag) + { + if (is_null($merchant_id_tag)) { + throw new \InvalidArgumentException('non-nullable merchant_id_tag cannot be null'); + } + $this->container['merchant_id_tag'] = $merchant_id_tag; + + return $this; + } + + /** + * Gets cardonfile_type + * + * @return string|null + */ + public function getCardonfileType() + { + return $this->container['cardonfile_type']; + } + + /** + * Sets cardonfile_type + * + * @param string|null $cardonfile_type Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. + * + * @return self + */ + public function setCardonfileType($cardonfile_type) + { + if (is_null($cardonfile_type)) { + array_push($this->openAPINullablesSetToNull, 'cardonfile_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardonfile_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardonfile_type'] = $cardonfile_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestCountry.php b/lib/PaymentRequest/PaymentRequestCountry.php new file mode 100644 index 0000000..39284e0 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestCountry.php @@ -0,0 +1,87 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentRequestCountry: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::ID, + self::PH, + self::VN, + self::TH, + self::MY + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestCurrency.php b/lib/PaymentRequest/PaymentRequestCurrency.php new file mode 100644 index 0000000..9a5dbef --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestCurrency.php @@ -0,0 +1,87 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentRequestCurrency: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::IDR, + self::PHP, + self::VND, + self::THB, + self::MYR + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestInitiator.php b/lib/PaymentRequest/PaymentRequestInitiator.php new file mode 100644 index 0000000..4f43449 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestInitiator.php @@ -0,0 +1,78 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentRequestInitiator: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::CUSTOMER, + self::MERCHANT + ]; + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestListResponse.php b/lib/PaymentRequest/PaymentRequestListResponse.php new file mode 100644 index 0000000..8a2ef94 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestListResponse.php @@ -0,0 +1,442 @@ + + */ +class PaymentRequestListResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\PaymentRequest\PaymentRequest[]', + 'has_more' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'has_more' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'has_more' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'has_more' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'has_more' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'has_more' => 'getHasMore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['has_more'] === null) { + $invalidProperties[] = "'has_more' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \PaymentRequest\PaymentRequest[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \PaymentRequest\PaymentRequest[] $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets has_more + * + * @return bool + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool $has_more has_more + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestParameters.php b/lib/PaymentRequest/PaymentRequestParameters.php new file mode 100644 index 0000000..4aa4c23 --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestParameters.php @@ -0,0 +1,903 @@ + + */ +class PaymentRequestParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'amount' => 'float', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'payment_method' => '\Xendit\PaymentRequest\PaymentMethodParameters', + 'description' => 'string', + 'capture_method' => '\Xendit\PaymentRequest\PaymentRequestCaptureMethod', + 'initiator' => '\Xendit\PaymentRequest\PaymentRequestInitiator', + 'payment_method_id' => 'string', + 'channel_properties' => '\Xendit\PaymentRequest\PaymentRequestParametersChannelProperties', + 'shipping_information' => '\Xendit\PaymentRequest\PaymentRequestShippingInformation', + 'items' => '\Xendit\PaymentRequest\PaymentRequestBasketItem[]', + 'customer_id' => 'string', + 'customer' => 'object', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'amount' => 'double', + 'currency' => null, + 'payment_method' => null, + 'description' => null, + 'capture_method' => null, + 'initiator' => null, + 'payment_method_id' => null, + 'channel_properties' => null, + 'shipping_information' => null, + 'items' => null, + 'customer_id' => null, + 'customer' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false, + 'amount' => false, + 'currency' => false, + 'payment_method' => false, + 'description' => true, + 'capture_method' => true, + 'initiator' => true, + 'payment_method_id' => false, + 'channel_properties' => false, + 'shipping_information' => true, + 'items' => true, + 'customer_id' => true, + 'customer' => true, + 'metadata' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'amount' => 'amount', + 'currency' => 'currency', + 'payment_method' => 'payment_method', + 'description' => 'description', + 'capture_method' => 'capture_method', + 'initiator' => 'initiator', + 'payment_method_id' => 'payment_method_id', + 'channel_properties' => 'channel_properties', + 'shipping_information' => 'shipping_information', + 'items' => 'items', + 'customer_id' => 'customer_id', + 'customer' => 'customer', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'payment_method' => 'setPaymentMethod', + 'description' => 'setDescription', + 'capture_method' => 'setCaptureMethod', + 'initiator' => 'setInitiator', + 'payment_method_id' => 'setPaymentMethodId', + 'channel_properties' => 'setChannelProperties', + 'shipping_information' => 'setShippingInformation', + 'items' => 'setItems', + 'customer_id' => 'setCustomerId', + 'customer' => 'setCustomer', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'payment_method' => 'getPaymentMethod', + 'description' => 'getDescription', + 'capture_method' => 'getCaptureMethod', + 'initiator' => 'getInitiator', + 'payment_method_id' => 'getPaymentMethodId', + 'channel_properties' => 'getChannelProperties', + 'shipping_information' => 'getShippingInformation', + 'items' => 'getItems', + 'customer_id' => 'getCustomerId', + 'customer' => 'getCustomer', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('capture_method', $data ?? [], null); + $this->setIfExists('initiator', $data ?? [], null); + $this->setIfExists('payment_method_id', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('shipping_information', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('customer_id', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets payment_method + * + * @return \PaymentRequest\PaymentMethodParameters|null + */ + public function getPaymentMethod() + { + return $this->container['payment_method']; + } + + /** + * Sets payment_method + * + * @param \PaymentRequest\PaymentMethodParameters|null $payment_method payment_method + * + * @return self + */ + public function setPaymentMethod($payment_method) + { + if (is_null($payment_method)) { + throw new \InvalidArgumentException('non-nullable payment_method cannot be null'); + } + $this->container['payment_method'] = $payment_method; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets capture_method + * + * @return \PaymentRequest\PaymentRequestCaptureMethod|null + */ + public function getCaptureMethod() + { + return $this->container['capture_method']; + } + + /** + * Sets capture_method + * + * @param \PaymentRequest\PaymentRequestCaptureMethod|null $capture_method capture_method + * + * @return self + */ + public function setCaptureMethod($capture_method) + { + if (is_null($capture_method)) { + array_push($this->openAPINullablesSetToNull, 'capture_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('capture_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['capture_method'] = $capture_method; + + return $this; + } + + /** + * Gets initiator + * + * @return \PaymentRequest\PaymentRequestInitiator|null + */ + public function getInitiator() + { + return $this->container['initiator']; + } + + /** + * Sets initiator + * + * @param \PaymentRequest\PaymentRequestInitiator|null $initiator initiator + * + * @return self + */ + public function setInitiator($initiator) + { + if (is_null($initiator)) { + array_push($this->openAPINullablesSetToNull, 'initiator'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initiator', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initiator'] = $initiator; + + return $this; + } + + /** + * Gets payment_method_id + * + * @return string|null + */ + public function getPaymentMethodId() + { + return $this->container['payment_method_id']; + } + + /** + * Sets payment_method_id + * + * @param string|null $payment_method_id payment_method_id + * + * @return self + */ + public function setPaymentMethodId($payment_method_id) + { + if (is_null($payment_method_id)) { + throw new \InvalidArgumentException('non-nullable payment_method_id cannot be null'); + } + $this->container['payment_method_id'] = $payment_method_id; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\PaymentRequestParametersChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\PaymentRequestParametersChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets shipping_information + * + * @return \PaymentRequest\PaymentRequestShippingInformation|null + */ + public function getShippingInformation() + { + return $this->container['shipping_information']; + } + + /** + * Sets shipping_information + * + * @param \PaymentRequest\PaymentRequestShippingInformation|null $shipping_information shipping_information + * + * @return self + */ + public function setShippingInformation($shipping_information) + { + if (is_null($shipping_information)) { + array_push($this->openAPINullablesSetToNull, 'shipping_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('shipping_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['shipping_information'] = $shipping_information; + + return $this; + } + + /** + * Gets items + * + * @return \PaymentRequest\PaymentRequestBasketItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \PaymentRequest\PaymentRequestBasketItem[]|null $items items + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets customer_id + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customer_id']; + } + + /** + * Sets customer_id + * + * @param string|null $customer_id customer_id + * + * @return self + */ + public function setCustomerId($customer_id) + { + if (is_null($customer_id)) { + array_push($this->openAPINullablesSetToNull, 'customer_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer_id'] = $customer_id; + + return $this; + } + + /** + * Gets customer + * + * @return object|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param object|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestParametersChannelProperties.php b/lib/PaymentRequest/PaymentRequestParametersChannelProperties.php new file mode 100644 index 0000000..22b7e8f --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestParametersChannelProperties.php @@ -0,0 +1,674 @@ + + */ +class PaymentRequestParametersChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestParameters_channel_properties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'success_return_url' => 'string', + 'failure_return_url' => 'string', + 'cancel_return_url' => 'string', + 'redeem_points' => 'string', + 'require_auth' => 'bool', + 'merchant_id_tag' => 'string', + 'cardonfile_type' => 'string', + 'cvv' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success_return_url' => null, + 'failure_return_url' => null, + 'cancel_return_url' => null, + 'redeem_points' => null, + 'require_auth' => null, + 'merchant_id_tag' => null, + 'cardonfile_type' => null, + 'cvv' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'success_return_url' => false, + 'failure_return_url' => false, + 'cancel_return_url' => false, + 'redeem_points' => false, + 'require_auth' => false, + 'merchant_id_tag' => false, + 'cardonfile_type' => true, + 'cvv' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success_return_url' => 'success_return_url', + 'failure_return_url' => 'failure_return_url', + 'cancel_return_url' => 'cancel_return_url', + 'redeem_points' => 'redeem_points', + 'require_auth' => 'require_auth', + 'merchant_id_tag' => 'merchant_id_tag', + 'cardonfile_type' => 'cardonfile_type', + 'cvv' => 'cvv' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success_return_url' => 'setSuccessReturnUrl', + 'failure_return_url' => 'setFailureReturnUrl', + 'cancel_return_url' => 'setCancelReturnUrl', + 'redeem_points' => 'setRedeemPoints', + 'require_auth' => 'setRequireAuth', + 'merchant_id_tag' => 'setMerchantIdTag', + 'cardonfile_type' => 'setCardonfileType', + 'cvv' => 'setCvv' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success_return_url' => 'getSuccessReturnUrl', + 'failure_return_url' => 'getFailureReturnUrl', + 'cancel_return_url' => 'getCancelReturnUrl', + 'redeem_points' => 'getRedeemPoints', + 'require_auth' => 'getRequireAuth', + 'merchant_id_tag' => 'getMerchantIdTag', + 'cardonfile_type' => 'getCardonfileType', + 'cvv' => 'getCvv' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('success_return_url', $data ?? [], null); + $this->setIfExists('failure_return_url', $data ?? [], null); + $this->setIfExists('cancel_return_url', $data ?? [], null); + $this->setIfExists('redeem_points', $data ?? [], null); + $this->setIfExists('require_auth', $data ?? [], null); + $this->setIfExists('merchant_id_tag', $data ?? [], null); + $this->setIfExists('cardonfile_type', $data ?? [], null); + $this->setIfExists('cvv', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['success_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['success_return_url'])) { + $invalidProperties[] = "invalid value for 'success_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['failure_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['failure_return_url'])) { + $invalidProperties[] = "invalid value for 'failure_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + if (!is_null($this->container['cancel_return_url']) && !preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $this->container['cancel_return_url'])) { + $invalidProperties[] = "invalid value for 'cancel_return_url', must be conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success_return_url + * + * @return string|null + */ + public function getSuccessReturnUrl() + { + return $this->container['success_return_url']; + } + + /** + * Sets success_return_url + * + * @param string|null $success_return_url URL where the end-customer is redirected if the authorization is successful + * + * @return self + */ + public function setSuccessReturnUrl($success_return_url) + { + if (is_null($success_return_url)) { + throw new \InvalidArgumentException('non-nullable success_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $success_return_url))) { + throw new \InvalidArgumentException("invalid value for \$success_return_url when calling PaymentRequestParametersChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['success_return_url'] = $success_return_url; + + return $this; + } + + /** + * Gets failure_return_url + * + * @return string|null + */ + public function getFailureReturnUrl() + { + return $this->container['failure_return_url']; + } + + /** + * Sets failure_return_url + * + * @param string|null $failure_return_url URL where the end-customer is redirected if the authorization failed + * + * @return self + */ + public function setFailureReturnUrl($failure_return_url) + { + if (is_null($failure_return_url)) { + throw new \InvalidArgumentException('non-nullable failure_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $failure_return_url))) { + throw new \InvalidArgumentException("invalid value for \$failure_return_url when calling PaymentRequestParametersChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['failure_return_url'] = $failure_return_url; + + return $this; + } + + /** + * Gets cancel_return_url + * + * @return string|null + */ + public function getCancelReturnUrl() + { + return $this->container['cancel_return_url']; + } + + /** + * Sets cancel_return_url + * + * @param string|null $cancel_return_url URL where the end-customer is redirected if the authorization cancelled + * + * @return self + */ + public function setCancelReturnUrl($cancel_return_url) + { + if (is_null($cancel_return_url)) { + throw new \InvalidArgumentException('non-nullable cancel_return_url cannot be null'); + } + + if ((!preg_match("/^\\S{1,255}:\/\/\\S{0,1000}$/", $cancel_return_url))) { + throw new \InvalidArgumentException("invalid value for \$cancel_return_url when calling PaymentRequestParametersChannelProperties., must conform to the pattern /^\\S{1,255}:\/\/\\S{0,1000}$/."); + } + + $this->container['cancel_return_url'] = $cancel_return_url; + + return $this; + } + + /** + * Gets redeem_points + * + * @return string|null + */ + public function getRedeemPoints() + { + return $this->container['redeem_points']; + } + + /** + * Sets redeem_points + * + * @param string|null $redeem_points REDEEM_NONE will not use any point, REDEEM_ALL will use all available points before cash balance is used. For OVO and ShopeePay tokenized payment use only. + * + * @return self + */ + public function setRedeemPoints($redeem_points) + { + if (is_null($redeem_points)) { + throw new \InvalidArgumentException('non-nullable redeem_points cannot be null'); + } + $this->container['redeem_points'] = $redeem_points; + + return $this; + } + + /** + * Gets require_auth + * + * @return bool|null + */ + public function getRequireAuth() + { + return $this->container['require_auth']; + } + + /** + * Sets require_auth + * + * @param bool|null $require_auth Toggle used to require end-customer to input undergo OTP validation before completing a payment. OTP will always be required for transactions greater than 1,000,000 IDR. For BRI tokenized payment use only. + * + * @return self + */ + public function setRequireAuth($require_auth) + { + if (is_null($require_auth)) { + throw new \InvalidArgumentException('non-nullable require_auth cannot be null'); + } + $this->container['require_auth'] = $require_auth; + + return $this; + } + + /** + * Gets merchant_id_tag + * + * @return string|null + */ + public function getMerchantIdTag() + { + return $this->container['merchant_id_tag']; + } + + /** + * Sets merchant_id_tag + * + * @param string|null $merchant_id_tag Tag for a Merchant ID that you want to associate this payment with. For merchants using their own MIDs to specify which MID they want to use + * + * @return self + */ + public function setMerchantIdTag($merchant_id_tag) + { + if (is_null($merchant_id_tag)) { + throw new \InvalidArgumentException('non-nullable merchant_id_tag cannot be null'); + } + $this->container['merchant_id_tag'] = $merchant_id_tag; + + return $this; + } + + /** + * Gets cardonfile_type + * + * @return string|null + */ + public function getCardonfileType() + { + return $this->container['cardonfile_type']; + } + + /** + * Sets cardonfile_type + * + * @param string|null $cardonfile_type Type of “credential-on-file” / “card-on-file” payment being made. Indicate that this payment uses a previously linked Payment Method for charging. + * + * @return self + */ + public function setCardonfileType($cardonfile_type) + { + if (is_null($cardonfile_type)) { + array_push($this->openAPINullablesSetToNull, 'cardonfile_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cardonfile_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cardonfile_type'] = $cardonfile_type; + + return $this; + } + + /** + * Gets cvv + * + * @return string|null + */ + public function getCvv() + { + return $this->container['cvv']; + } + + /** + * Sets cvv + * + * @param string|null $cvv Three digit code written on the back of the card (usually called CVV/CVN). + * + * @return self + */ + public function setCvv($cvv) + { + if (is_null($cvv)) { + throw new \InvalidArgumentException('non-nullable cvv cannot be null'); + } + $this->container['cvv'] = $cvv; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.php b/lib/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.php new file mode 100644 index 0000000..e27d5ca --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestParametersChannelPropertiesAllOf.php @@ -0,0 +1,402 @@ + + */ +class PaymentRequestParametersChannelPropertiesAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestParameters_channel_properties_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cvv' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cvv' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cvv' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'cvv' => 'cvv' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cvv' => 'setCvv' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cvv' => 'getCvv' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('cvv', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets cvv + * + * @return string|null + */ + public function getCvv() + { + return $this->container['cvv']; + } + + /** + * Sets cvv + * + * @param string|null $cvv Three digit code written on the back of the card (usually called CVV/CVN). + * + * @return self + */ + public function setCvv($cvv) + { + if (is_null($cvv)) { + throw new \InvalidArgumentException('non-nullable cvv cannot be null'); + } + $this->container['cvv'] = $cvv; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestShippingInformation.php b/lib/PaymentRequest/PaymentRequestShippingInformation.php new file mode 100644 index 0000000..4ee77fe --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestShippingInformation.php @@ -0,0 +1,575 @@ + + */ +class PaymentRequestShippingInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentRequestShippingInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'country' => 'string', + 'street_line1' => 'string', + 'street_line2' => 'string', + 'city' => 'string', + 'province_state' => 'string', + 'postal_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'country' => null, + 'street_line1' => null, + 'street_line2' => null, + 'city' => null, + 'province_state' => null, + 'postal_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'country' => false, + 'street_line1' => false, + 'street_line2' => false, + 'city' => false, + 'province_state' => false, + 'postal_code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'street_line1' => 'street_line1', + 'street_line2' => 'street_line2', + 'city' => 'city', + 'province_state' => 'province_state', + 'postal_code' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'street_line1' => 'setStreetLine1', + 'street_line2' => 'setStreetLine2', + 'city' => 'setCity', + 'province_state' => 'setProvinceState', + 'postal_code' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'street_line1' => 'getStreetLine1', + 'street_line2' => 'getStreetLine2', + 'city' => 'getCity', + 'province_state' => 'getProvinceState', + 'postal_code' => 'getPostalCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('street_line1', $data ?? [], null); + $this->setIfExists('street_line2', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('province_state', $data ?? [], null); + $this->setIfExists('postal_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets street_line1 + * + * @return string|null + */ + public function getStreetLine1() + { + return $this->container['street_line1']; + } + + /** + * Sets street_line1 + * + * @param string|null $street_line1 street_line1 + * + * @return self + */ + public function setStreetLine1($street_line1) + { + if (is_null($street_line1)) { + throw new \InvalidArgumentException('non-nullable street_line1 cannot be null'); + } + $this->container['street_line1'] = $street_line1; + + return $this; + } + + /** + * Gets street_line2 + * + * @return string|null + */ + public function getStreetLine2() + { + return $this->container['street_line2']; + } + + /** + * Sets street_line2 + * + * @param string|null $street_line2 street_line2 + * + * @return self + */ + public function setStreetLine2($street_line2) + { + if (is_null($street_line2)) { + throw new \InvalidArgumentException('non-nullable street_line2 cannot be null'); + } + $this->container['street_line2'] = $street_line2; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets province_state + * + * @return string|null + */ + public function getProvinceState() + { + return $this->container['province_state']; + } + + /** + * Sets province_state + * + * @param string|null $province_state province_state + * + * @return self + */ + public function setProvinceState($province_state) + { + if (is_null($province_state)) { + throw new \InvalidArgumentException('non-nullable province_state cannot be null'); + } + $this->container['province_state'] = $province_state; + + return $this; + } + + /** + * Gets postal_code + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string|null $postal_code postal_code + * + * @return self + */ + public function setPostalCode($postal_code) + { + if (is_null($postal_code)) { + throw new \InvalidArgumentException('non-nullable postal_code cannot be null'); + } + $this->container['postal_code'] = $postal_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/PaymentRequestStatus.php b/lib/PaymentRequest/PaymentRequestStatus.php new file mode 100644 index 0000000..fada6cc --- /dev/null +++ b/lib/PaymentRequest/PaymentRequestStatus.php @@ -0,0 +1,96 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum PaymentRequestStatus: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::PENDING, + self::REQUIRES_ACTION, + self::CANCELED, + self::SUCCEEDED, + self::FAILED, + self::VOIDED, + self::UNKNOWN, + self::AWAITING_CAPTURE + ]; + } +} + + diff --git a/lib/PaymentRequest/QRCode.php b/lib/PaymentRequest/QRCode.php new file mode 100644 index 0000000..77d500c --- /dev/null +++ b/lib/PaymentRequest/QRCode.php @@ -0,0 +1,444 @@ + + */ +class QRCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\QRCodeChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\QRCodeChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => true, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\QRCodeChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\QRCodeChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + array_push($this->openAPINullablesSetToNull, 'channel_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\QRCodeChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\QRCodeChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/QRCodeChannelCode.php b/lib/PaymentRequest/QRCodeChannelCode.php new file mode 100644 index 0000000..ae83a09 --- /dev/null +++ b/lib/PaymentRequest/QRCodeChannelCode.php @@ -0,0 +1,85 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum QRCodeChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::DANA, + self::RCBC, + self::LINKAJA, + self::PROMPTPAY + ]; + } +} + + diff --git a/lib/PaymentRequest/QRCodeChannelProperties.php b/lib/PaymentRequest/QRCodeChannelProperties.php new file mode 100644 index 0000000..727f4bf --- /dev/null +++ b/lib/PaymentRequest/QRCodeChannelProperties.php @@ -0,0 +1,437 @@ + + */ +class QRCodeChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCodeChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qr_string' => 'string', + 'expires_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qr_string' => null, + 'expires_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qr_string' => false, + 'expires_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'qr_string' => 'qr_string', + 'expires_at' => 'expires_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qr_string' => 'setQrString', + 'expires_at' => 'setExpiresAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qr_string' => 'getQrString', + 'expires_at' => 'getExpiresAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('qr_string', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets qr_string + * + * @return string|null + */ + public function getQrString() + { + return $this->container['qr_string']; + } + + /** + * Sets qr_string + * + * @param string|null $qr_string qr_string + * + * @return self + */ + public function setQrString($qr_string) + { + if (is_null($qr_string)) { + throw new \InvalidArgumentException('non-nullable qr_string cannot be null'); + } + $this->container['qr_string'] = $qr_string; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/QRCodeParameters.php b/lib/PaymentRequest/QRCodeParameters.php new file mode 100644 index 0000000..8ae4f45 --- /dev/null +++ b/lib/PaymentRequest/QRCodeParameters.php @@ -0,0 +1,443 @@ + + */ +class QRCodeParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QRCodeParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => '\Xendit\PaymentRequest\QRCodeChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\QRCodeChannelProperties' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => true, + 'channel_properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return \PaymentRequest\QRCodeChannelCode|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\QRCodeChannelCode|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + array_push($this->openAPINullablesSetToNull, 'channel_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\QRCodeChannelProperties|null + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\QRCodeChannelProperties|null $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/VirtualAccount.php b/lib/PaymentRequest/VirtualAccount.php new file mode 100644 index 0000000..ed6c466 --- /dev/null +++ b/lib/PaymentRequest/VirtualAccount.php @@ -0,0 +1,690 @@ + + */ +class VirtualAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'min_amount' => 'float', + 'max_amount' => 'float', + 'amount' => 'float', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'channel_code' => '\Xendit\PaymentRequest\VirtualAccountChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\VirtualAccountChannelProperties', + 'alternative_display_types' => 'string[]', + 'alternative_displays' => '\Xendit\PaymentRequest\VirtualAccountAlternativeDisplay[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'min_amount' => 'double', + 'max_amount' => 'double', + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'alternative_display_types' => null, + 'alternative_displays' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'min_amount' => true, + 'max_amount' => true, + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'alternative_display_types' => false, + 'alternative_displays' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'alternative_display_types' => 'alternative_display_types', + 'alternative_displays' => 'alternative_displays' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'alternative_display_types' => 'setAlternativeDisplayTypes', + 'alternative_displays' => 'setAlternativeDisplays' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'alternative_display_types' => 'getAlternativeDisplayTypes', + 'alternative_displays' => 'getAlternativeDisplays' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ALTERNATIVE_DISPLAY_TYPES_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativeDisplayTypesAllowableValues() + { + return [ + self::ALTERNATIVE_DISPLAY_TYPES_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('alternative_display_types', $data ?? [], null); + $this->setIfExists('alternative_displays', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentRequest\VirtualAccountChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\VirtualAccountChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\VirtualAccountChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\VirtualAccountChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets alternative_display_types + * + * @return string[]|null + */ + public function getAlternativeDisplayTypes() + { + return $this->container['alternative_display_types']; + } + + /** + * Sets alternative_display_types + * + * @param string[]|null $alternative_display_types Alternative display requested for the virtual account + * + * @return self + */ + public function setAlternativeDisplayTypes($alternative_display_types) + { + if (is_null($alternative_display_types)) { + throw new \InvalidArgumentException('non-nullable alternative_display_types cannot be null'); + } + $allowedValues = $this->getAlternativeDisplayTypesAllowableValues(); + if (array_diff($alternative_display_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternative_display_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternative_display_types'] = $alternative_display_types; + + return $this; + } + + /** + * Gets alternative_displays + * + * @return \PaymentRequest\VirtualAccountAlternativeDisplay[]|null + */ + public function getAlternativeDisplays() + { + return $this->container['alternative_displays']; + } + + /** + * Sets alternative_displays + * + * @param \PaymentRequest\VirtualAccountAlternativeDisplay[]|null $alternative_displays alternative_displays + * + * @return self + */ + public function setAlternativeDisplays($alternative_displays) + { + if (is_null($alternative_displays)) { + throw new \InvalidArgumentException('non-nullable alternative_displays cannot be null'); + } + $this->container['alternative_displays'] = $alternative_displays; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/VirtualAccountAllOf.php b/lib/PaymentRequest/VirtualAccountAllOf.php new file mode 100644 index 0000000..308bce4 --- /dev/null +++ b/lib/PaymentRequest/VirtualAccountAllOf.php @@ -0,0 +1,402 @@ + + */ +class VirtualAccountAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccount_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alternative_displays' => '\Xendit\PaymentRequest\VirtualAccountAlternativeDisplay[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alternative_displays' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alternative_displays' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alternative_displays' => 'alternative_displays' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alternative_displays' => 'setAlternativeDisplays' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alternative_displays' => 'getAlternativeDisplays' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('alternative_displays', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alternative_displays + * + * @return \PaymentRequest\VirtualAccountAlternativeDisplay[]|null + */ + public function getAlternativeDisplays() + { + return $this->container['alternative_displays']; + } + + /** + * Sets alternative_displays + * + * @param \PaymentRequest\VirtualAccountAlternativeDisplay[]|null $alternative_displays alternative_displays + * + * @return self + */ + public function setAlternativeDisplays($alternative_displays) + { + if (is_null($alternative_displays)) { + throw new \InvalidArgumentException('non-nullable alternative_displays cannot be null'); + } + $this->container['alternative_displays'] = $alternative_displays; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/VirtualAccountAlternativeDisplay.php b/lib/PaymentRequest/VirtualAccountAlternativeDisplay.php new file mode 100644 index 0000000..95d02fd --- /dev/null +++ b/lib/PaymentRequest/VirtualAccountAlternativeDisplay.php @@ -0,0 +1,469 @@ + + */ +class VirtualAccountAlternativeDisplay implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountAlternativeDisplay'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const TYPE_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the alternative display + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets data + * + * @return string|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string|null $data Data payload of the given alternative display + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/VirtualAccountChannelCode.php b/lib/PaymentRequest/VirtualAccountChannelCode.php new file mode 100644 index 0000000..1c8d55d --- /dev/null +++ b/lib/PaymentRequest/VirtualAccountChannelCode.php @@ -0,0 +1,115 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum VirtualAccountChannelCode: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BCA, + self::BJB, + self::BNI, + self::BRI, + self::MANDIRI, + self::PERMATA, + self::BSI, + self::CIMB, + self::SAHABAT_SAMPOERNA, + self::ARTAJASA, + self::PV, + self::VIETCAPITAL, + self::WOORI, + self::MSB + ]; + } +} + + diff --git a/lib/PaymentRequest/VirtualAccountChannelProperties.php b/lib/PaymentRequest/VirtualAccountChannelProperties.php new file mode 100644 index 0000000..682364c --- /dev/null +++ b/lib/PaymentRequest/VirtualAccountChannelProperties.php @@ -0,0 +1,508 @@ + + */ +class VirtualAccountChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer_name' => 'string', + 'virtual_account_number' => 'string', + 'expires_at' => '\DateTime', + 'suggested_amount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer_name' => null, + 'virtual_account_number' => null, + 'expires_at' => 'date-time', + 'suggested_amount' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer_name' => false, + 'virtual_account_number' => false, + 'expires_at' => false, + 'suggested_amount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customer_name' => 'customer_name', + 'virtual_account_number' => 'virtual_account_number', + 'expires_at' => 'expires_at', + 'suggested_amount' => 'suggested_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer_name' => 'setCustomerName', + 'virtual_account_number' => 'setVirtualAccountNumber', + 'expires_at' => 'setExpiresAt', + 'suggested_amount' => 'setSuggestedAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer_name' => 'getCustomerName', + 'virtual_account_number' => 'getVirtualAccountNumber', + 'expires_at' => 'getExpiresAt', + 'suggested_amount' => 'getSuggestedAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('customer_name', $data ?? [], null); + $this->setIfExists('virtual_account_number', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('suggested_amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customer_name'] === null) { + $invalidProperties[] = "'customer_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customer_name + * + * @return string + */ + public function getCustomerName() + { + return $this->container['customer_name']; + } + + /** + * Sets customer_name + * + * @param string $customer_name Name of customer. + * + * @return self + */ + public function setCustomerName($customer_name) + { + if (is_null($customer_name)) { + throw new \InvalidArgumentException('non-nullable customer_name cannot be null'); + } + $this->container['customer_name'] = $customer_name; + + return $this; + } + + /** + * Gets virtual_account_number + * + * @return string|null + */ + public function getVirtualAccountNumber() + { + return $this->container['virtual_account_number']; + } + + /** + * Sets virtual_account_number + * + * @param string|null $virtual_account_number You can assign specific Virtual Account number using this parameter. If you do not send one, one will be picked at random. Make sure the number you specify is within your Virtual Account range. + * + * @return self + */ + public function setVirtualAccountNumber($virtual_account_number) + { + if (is_null($virtual_account_number)) { + throw new \InvalidArgumentException('non-nullable virtual_account_number cannot be null'); + } + $this->container['virtual_account_number'] = $virtual_account_number; + + return $this; + } + + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at The date and time in ISO 8601 UTC+0 when the virtual account number will be expired. Default: The default expiration date will be 31 years from creation date. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets suggested_amount + * + * @return float|null + */ + public function getSuggestedAmount() + { + return $this->container['suggested_amount']; + } + + /** + * Sets suggested_amount + * + * @param float|null $suggested_amount The suggested amount you want to assign. Note: Suggested amounts is the amounts that can see as a suggestion, but user can still put any numbers (only supported for Mandiri and BRI) + * + * @return self + */ + public function setSuggestedAmount($suggested_amount) + { + if (is_null($suggested_amount)) { + throw new \InvalidArgumentException('non-nullable suggested_amount cannot be null'); + } + $this->container['suggested_amount'] = $suggested_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/PaymentRequest/VirtualAccountParameters.php b/lib/PaymentRequest/VirtualAccountParameters.php new file mode 100644 index 0000000..0a38af0 --- /dev/null +++ b/lib/PaymentRequest/VirtualAccountParameters.php @@ -0,0 +1,655 @@ + + */ +class VirtualAccountParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VirtualAccountParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'min_amount' => 'float', + 'max_amount' => 'float', + 'amount' => 'float', + 'currency' => '\Xendit\PaymentRequest\PaymentRequestCurrency', + 'channel_code' => '\Xendit\PaymentRequest\VirtualAccountChannelCode', + 'channel_properties' => '\Xendit\PaymentRequest\VirtualAccountChannelProperties', + 'alternative_display_types' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'min_amount' => 'double', + 'max_amount' => 'double', + 'amount' => 'double', + 'currency' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'alternative_display_types' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'min_amount' => true, + 'max_amount' => true, + 'amount' => true, + 'currency' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'alternative_display_types' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'amount' => 'amount', + 'currency' => 'currency', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'alternative_display_types' => 'alternative_display_types' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'alternative_display_types' => 'setAlternativeDisplayTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'alternative_display_types' => 'getAlternativeDisplayTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ALTERNATIVE_DISPLAY_TYPES_QR_STRING = 'QR_STRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativeDisplayTypesAllowableValues() + { + return [ + self::ALTERNATIVE_DISPLAY_TYPES_QR_STRING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('alternative_display_types', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets min_amount + * + * @return float|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param float|null $min_amount min_amount + * + * @return self + */ + public function setMinAmount($min_amount) + { + if (is_null($min_amount)) { + array_push($this->openAPINullablesSetToNull, 'min_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('min_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return float|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param float|null $max_amount max_amount + * + * @return self + */ + public function setMaxAmount($max_amount) + { + if (is_null($max_amount)) { + array_push($this->openAPINullablesSetToNull, 'max_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('max_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PaymentRequest\PaymentRequestCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PaymentRequest\PaymentRequestCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_code + * + * @return \PaymentRequest\VirtualAccountChannelCode + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param \PaymentRequest\VirtualAccountChannelCode $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \PaymentRequest\VirtualAccountChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \PaymentRequest\VirtualAccountChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets alternative_display_types + * + * @return string[]|null + */ + public function getAlternativeDisplayTypes() + { + return $this->container['alternative_display_types']; + } + + /** + * Sets alternative_display_types + * + * @param string[]|null $alternative_display_types Alternative display requested for the virtual account + * + * @return self + */ + public function setAlternativeDisplayTypes($alternative_display_types) + { + if (is_null($alternative_display_types)) { + throw new \InvalidArgumentException('non-nullable alternative_display_types cannot be null'); + } + $allowedValues = $this->getAlternativeDisplayTypesAllowableValues(); + if (array_diff($alternative_display_types, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternative_display_types', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternative_display_types'] = $alternative_display_types; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/Channel.php b/lib/Payout/Channel.php new file mode 100644 index 0000000..eb5052d --- /dev/null +++ b/lib/Payout/Channel.php @@ -0,0 +1,554 @@ + + */ +class Channel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Channel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channel_code' => 'string', + 'channel_category' => '\Xendit\Payout\ChannelCategory', + 'currency' => 'string', + 'channel_name' => 'string', + 'amount_limits' => '\Xendit\Payout\ChannelAmountLimits' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channel_code' => null, + 'channel_category' => null, + 'currency' => null, + 'channel_name' => null, + 'amount_limits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channel_code' => false, + 'channel_category' => false, + 'currency' => false, + 'channel_name' => false, + 'amount_limits' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channel_code' => 'channel_code', + 'channel_category' => 'channel_category', + 'currency' => 'currency', + 'channel_name' => 'channel_name', + 'amount_limits' => 'amount_limits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channel_code' => 'setChannelCode', + 'channel_category' => 'setChannelCategory', + 'currency' => 'setCurrency', + 'channel_name' => 'setChannelName', + 'amount_limits' => 'setAmountLimits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channel_code' => 'getChannelCode', + 'channel_category' => 'getChannelCategory', + 'currency' => 'getCurrency', + 'channel_name' => 'getChannelName', + 'amount_limits' => 'getAmountLimits' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_category', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('channel_name', $data ?? [], null); + $this->setIfExists('amount_limits', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_category'] === null) { + $invalidProperties[] = "'channel_category' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['channel_name'] === null) { + $invalidProperties[] = "'channel_name' can't be null"; + } + if ($this->container['amount_limits'] === null) { + $invalidProperties[] = "'amount_limits' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channel_code + * + * @return string + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string $channel_code Destination channel to send the money to, prefixed by ISO-3166 country code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_category + * + * @return \Payout\ChannelCategory + */ + public function getChannelCategory() + { + return $this->container['channel_category']; + } + + /** + * Sets channel_category + * + * @param \Payout\ChannelCategory $channel_category channel_category + * + * @return self + */ + public function setChannelCategory($channel_category) + { + if (is_null($channel_category)) { + throw new \InvalidArgumentException('non-nullable channel_category cannot be null'); + } + $this->container['channel_category'] = $channel_category; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Currency of the destination channel using ISO-4217 currency code + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets channel_name + * + * @return string + */ + public function getChannelName() + { + return $this->container['channel_name']; + } + + /** + * Sets channel_name + * + * @param string $channel_name Name of the destination channel + * + * @return self + */ + public function setChannelName($channel_name) + { + if (is_null($channel_name)) { + throw new \InvalidArgumentException('non-nullable channel_name cannot be null'); + } + $this->container['channel_name'] = $channel_name; + + return $this; + } + + /** + * Gets amount_limits + * + * @return \Payout\ChannelAmountLimits + */ + public function getAmountLimits() + { + return $this->container['amount_limits']; + } + + /** + * Sets amount_limits + * + * @param \Payout\ChannelAmountLimits $amount_limits amount_limits + * + * @return self + */ + public function setAmountLimits($amount_limits) + { + if (is_null($amount_limits)) { + throw new \InvalidArgumentException('non-nullable amount_limits cannot be null'); + } + $this->container['amount_limits'] = $amount_limits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/ChannelAccountType.php b/lib/Payout/ChannelAccountType.php new file mode 100644 index 0000000..1b496e7 --- /dev/null +++ b/lib/Payout/ChannelAccountType.php @@ -0,0 +1,88 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum ChannelAccountType: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::NATIONAL_ID, + self::MOBILE_NO, + self::PASSPORT, + self::BUSINESS_REGISTRATION, + self::BANK_ACCOUNT + ]; + } +} + + diff --git a/lib/Payout/ChannelAmountLimits.php b/lib/Payout/ChannelAmountLimits.php new file mode 100644 index 0000000..e0798e1 --- /dev/null +++ b/lib/Payout/ChannelAmountLimits.php @@ -0,0 +1,480 @@ + + */ +class ChannelAmountLimits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Channel_amount_limits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'minimum' => 'float', + 'maximum' => 'float', + 'minimum_increment' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'minimum' => null, + 'maximum' => null, + 'minimum_increment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'minimum' => false, + 'maximum' => false, + 'minimum_increment' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'minimum' => 'minimum', + 'maximum' => 'maximum', + 'minimum_increment' => 'minimum_increment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'minimum' => 'setMinimum', + 'maximum' => 'setMaximum', + 'minimum_increment' => 'setMinimumIncrement' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'minimum' => 'getMinimum', + 'maximum' => 'getMaximum', + 'minimum_increment' => 'getMinimumIncrement' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('minimum', $data ?? [], null); + $this->setIfExists('maximum', $data ?? [], null); + $this->setIfExists('minimum_increment', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['minimum'] === null) { + $invalidProperties[] = "'minimum' can't be null"; + } + if ($this->container['maximum'] === null) { + $invalidProperties[] = "'maximum' can't be null"; + } + if ($this->container['minimum_increment'] === null) { + $invalidProperties[] = "'minimum_increment' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets minimum + * + * @return float + */ + public function getMinimum() + { + return $this->container['minimum']; + } + + /** + * Sets minimum + * + * @param float $minimum Lowest amount supported for a payout to this channel + * + * @return self + */ + public function setMinimum($minimum) + { + if (is_null($minimum)) { + throw new \InvalidArgumentException('non-nullable minimum cannot be null'); + } + $this->container['minimum'] = $minimum; + + return $this; + } + + /** + * Gets maximum + * + * @return float + */ + public function getMaximum() + { + return $this->container['maximum']; + } + + /** + * Sets maximum + * + * @param float $maximum Highest amount supported for a payout to this channel + * + * @return self + */ + public function setMaximum($maximum) + { + if (is_null($maximum)) { + throw new \InvalidArgumentException('non-nullable maximum cannot be null'); + } + $this->container['maximum'] = $maximum; + + return $this; + } + + /** + * Gets minimum_increment + * + * @return float + */ + public function getMinimumIncrement() + { + return $this->container['minimum_increment']; + } + + /** + * Sets minimum_increment + * + * @param float $minimum_increment Supported increments + * + * @return self + */ + public function setMinimumIncrement($minimum_increment) + { + if (is_null($minimum_increment)) { + throw new \InvalidArgumentException('non-nullable minimum_increment cannot be null'); + } + $this->container['minimum_increment'] = $minimum_increment; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/ChannelCategory.php b/lib/Payout/ChannelCategory.php new file mode 100644 index 0000000..5e3ed36 --- /dev/null +++ b/lib/Payout/ChannelCategory.php @@ -0,0 +1,79 @@ +value = $value; + } + + public function getValue() { + return $this->value; + } + + public function setValue($value) { + if (!self::isValid($value)) { + throw new \InvalidArgumentException(sprintf('Invalid value for enum ChannelCategory: %s', $value)); + } + $this->value = $value; + } + + public function __toString() { + return (string)$this->value; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + self::BANK, + self::EWALLET + ]; + } +} + + diff --git a/lib/Payout/CreatePayoutRequest.php b/lib/Payout/CreatePayoutRequest.php new file mode 100644 index 0000000..211dcc0 --- /dev/null +++ b/lib/Payout/CreatePayoutRequest.php @@ -0,0 +1,665 @@ + + */ +class CreatePayoutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreatePayoutRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'channel_code' => 'string', + 'channel_properties' => '\Xendit\Payout\DigitalPayoutChannelProperties', + 'amount' => 'float', + 'description' => 'string', + 'currency' => 'string', + 'receipt_notification' => '\Xendit\Payout\ReceiptNotification', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'amount' => null, + 'description' => null, + 'currency' => null, + 'receipt_notification' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'amount' => false, + 'description' => false, + 'currency' => false, + 'receipt_notification' => false, + 'metadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'amount' => 'amount', + 'description' => 'description', + 'currency' => 'currency', + 'receipt_notification' => 'receipt_notification', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'amount' => 'setAmount', + 'description' => 'setDescription', + 'currency' => 'setCurrency', + 'receipt_notification' => 'setReceiptNotification', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'amount' => 'getAmount', + 'description' => 'getDescription', + 'currency' => 'getCurrency', + 'receipt_notification' => 'getReceiptNotification', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('receipt_notification', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ((mb_strlen($this->container['reference_id']) < 1)) { + $invalidProperties[] = "invalid value for 'reference_id', the character length must be bigger than or equal to 1."; + } + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id A client defined payout identifier + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + + if ((mb_strlen($reference_id) < 1)) { + throw new \InvalidArgumentException('invalid length for $reference_id when calling CreatePayoutRequest., must be bigger than or equal to 1.'); + } + + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets channel_code + * + * @return string + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string $channel_code Channel code of selected destination bank or e-wallet + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \Payout\DigitalPayoutChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \Payout\DigitalPayoutChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Currency of the destination channel using ISO-4217 currency code + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets receipt_notification + * + * @return \Payout\ReceiptNotification|null + */ + public function getReceiptNotification() + { + return $this->container['receipt_notification']; + } + + /** + * Sets receipt_notification + * + * @param \Payout\ReceiptNotification|null $receipt_notification receipt_notification + * + * @return self + */ + public function setReceiptNotification($receipt_notification) + { + if (is_null($receipt_notification)) { + throw new \InvalidArgumentException('non-nullable receipt_notification cannot be null'); + } + $this->container['receipt_notification'] = $receipt_notification; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata Object of additional information you may use + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/DigitalPayoutChannelProperties.php b/lib/Payout/DigitalPayoutChannelProperties.php new file mode 100644 index 0000000..2522354 --- /dev/null +++ b/lib/Payout/DigitalPayoutChannelProperties.php @@ -0,0 +1,481 @@ + + */ +class DigitalPayoutChannelProperties implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DigitalPayoutChannelProperties'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'account_holder_name' => 'string', + 'account_number' => 'string', + 'account_type' => '\Xendit\Payout\ChannelAccountType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'account_holder_name' => null, + 'account_number' => null, + 'account_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'account_holder_name' => true, + 'account_number' => false, + 'account_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'account_holder_name' => 'account_holder_name', + 'account_number' => 'account_number', + 'account_type' => 'account_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'account_holder_name' => 'setAccountHolderName', + 'account_number' => 'setAccountNumber', + 'account_type' => 'setAccountType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'account_holder_name' => 'getAccountHolderName', + 'account_number' => 'getAccountNumber', + 'account_type' => 'getAccountType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('account_holder_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['account_number'] === null) { + $invalidProperties[] = "'account_number' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_holder_name + * + * @return string|null + */ + public function getAccountHolderName() + { + return $this->container['account_holder_name']; + } + + /** + * Sets account_holder_name + * + * @param string|null $account_holder_name Registered account name + * + * @return self + */ + public function setAccountHolderName($account_holder_name) + { + if (is_null($account_holder_name)) { + array_push($this->openAPINullablesSetToNull, 'account_holder_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('account_holder_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['account_holder_name'] = $account_holder_name; + + return $this; + } + + /** + * Gets account_number + * + * @return string + */ + public function getAccountNumber() + { + return $this->container['account_number']; + } + + /** + * Sets account_number + * + * @param string $account_number Registered account number + * + * @return self + */ + public function setAccountNumber($account_number) + { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } + $this->container['account_number'] = $account_number; + + return $this; + } + + /** + * Gets account_type + * + * @return \Payout\ChannelAccountType|null + */ + public function getAccountType() + { + return $this->container['account_type']; + } + + /** + * Sets account_type + * + * @param \Payout\ChannelAccountType|null $account_type account_type + * + * @return self + */ + public function setAccountType($account_type) + { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } + $this->container['account_type'] = $account_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/Error.php b/lib/Payout/Error.php new file mode 100644 index 0000000..419925d --- /dev/null +++ b/lib/Payout/Error.php @@ -0,0 +1,476 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string', + 'errors' => '\Xendit\Payout\ErrorErrorsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage', + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code Specific error encountered when processing the request, can refer to the API documentation on proper handling of each available error code https://developers.xendit.co/api-reference/#payouts + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Human readable error message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \Payout\ErrorErrorsInner[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Payout\ErrorErrorsInner[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/ErrorErrorsInner.php b/lib/Payout/ErrorErrorsInner.php new file mode 100644 index 0000000..dfd8aeb --- /dev/null +++ b/lib/Payout/ErrorErrorsInner.php @@ -0,0 +1,442 @@ + + */ +class ErrorErrorsInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error_errors_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'path' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'path' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'path' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'path' => 'path', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'path' => 'setPath', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'path' => 'getPath', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['path'] === null) { + $invalidProperties[] = "'path' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets path + * + * @return string + */ + public function getPath() + { + return $this->container['path']; + } + + /** + * Sets path + * + * @param string $path Precise location of the error + * + * @return self + */ + public function setPath($path) + { + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); + } + $this->container['path'] = $path; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Specific description of the error + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/GetPayouts200Response.php b/lib/Payout/GetPayouts200Response.php new file mode 100644 index 0000000..8696950 --- /dev/null +++ b/lib/Payout/GetPayouts200Response.php @@ -0,0 +1,470 @@ + + */ +class GetPayouts200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getPayouts_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\Payout\GetPayouts200ResponseDataInner[]', + 'has_more' => 'bool', + 'links' => '\Xendit\Payout\GetPayouts200ResponseLinks' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'has_more' => null, + 'links' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'has_more' => false, + 'links' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'has_more' => 'has_more', + 'links' => 'links' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'has_more' => 'setHasMore', + 'links' => 'setLinks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'has_more' => 'getHasMore', + 'links' => 'getLinks' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Payout\GetPayouts200ResponseDataInner[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Payout\GetPayouts200ResponseDataInner[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets has_more + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool|null $has_more has_more + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + + /** + * Gets links + * + * @return \Payout\GetPayouts200ResponseLinks|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Payout\GetPayouts200ResponseLinks|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/GetPayouts200ResponseDataInner.php b/lib/Payout/GetPayouts200ResponseDataInner.php new file mode 100644 index 0000000..48f06e3 --- /dev/null +++ b/lib/Payout/GetPayouts200ResponseDataInner.php @@ -0,0 +1,1001 @@ + + */ +class GetPayouts200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getPayouts_200_response_data_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'channel_code' => 'string', + 'channel_properties' => '\Xendit\Payout\DigitalPayoutChannelProperties', + 'amount' => 'float', + 'description' => 'string', + 'currency' => 'string', + 'receipt_notification' => '\Xendit\Payout\ReceiptNotification', + 'metadata' => 'object', + 'id' => 'string', + 'created' => '\DateTime', + 'updated' => '\DateTime', + 'business_id' => 'string', + 'status' => 'string', + 'failure_code' => 'string', + 'estimated_arrival_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'amount' => null, + 'description' => null, + 'currency' => null, + 'receipt_notification' => null, + 'metadata' => null, + 'id' => null, + 'created' => 'date-time', + 'updated' => 'date-time', + 'business_id' => null, + 'status' => null, + 'failure_code' => null, + 'estimated_arrival_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'amount' => false, + 'description' => false, + 'currency' => false, + 'receipt_notification' => false, + 'metadata' => false, + 'id' => false, + 'created' => false, + 'updated' => false, + 'business_id' => false, + 'status' => false, + 'failure_code' => false, + 'estimated_arrival_time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'amount' => 'amount', + 'description' => 'description', + 'currency' => 'currency', + 'receipt_notification' => 'receipt_notification', + 'metadata' => 'metadata', + 'id' => 'id', + 'created' => 'created', + 'updated' => 'updated', + 'business_id' => 'business_id', + 'status' => 'status', + 'failure_code' => 'failure_code', + 'estimated_arrival_time' => 'estimated_arrival_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'amount' => 'setAmount', + 'description' => 'setDescription', + 'currency' => 'setCurrency', + 'receipt_notification' => 'setReceiptNotification', + 'metadata' => 'setMetadata', + 'id' => 'setId', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'business_id' => 'setBusinessId', + 'status' => 'setStatus', + 'failure_code' => 'setFailureCode', + 'estimated_arrival_time' => 'setEstimatedArrivalTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'amount' => 'getAmount', + 'description' => 'getDescription', + 'currency' => 'getCurrency', + 'receipt_notification' => 'getReceiptNotification', + 'metadata' => 'getMetadata', + 'id' => 'getId', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'business_id' => 'getBusinessId', + 'status' => 'getStatus', + 'failure_code' => 'getFailureCode', + 'estimated_arrival_time' => 'getEstimatedArrivalTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ACCEPTED = 'ACCEPTED'; + public const STATUS_REQUESTED = 'REQUESTED'; + public const STATUS_LOCKED = 'LOCKED'; + public const STATUS_CANCELLED = 'CANCELLED'; + public const STATUS_REVERSED = 'REVERSED'; + public const FAILURE_CODE_INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE'; + public const FAILURE_CODE_REJECTED_BY_CHANNEL = 'REJECTED_BY_CHANNEL'; + public const FAILURE_CODE_TEMPORARY_TRANSFER_ERROR = 'TEMPORARY_TRANSFER_ERROR'; + public const FAILURE_CODE_INVALID_DESTINATION = 'INVALID_DESTINATION'; + public const FAILURE_CODE_TRANSFER_ERROR = 'TRANSFER_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ACCEPTED, + self::STATUS_REQUESTED, + self::STATUS_LOCKED, + self::STATUS_CANCELLED, + self::STATUS_REVERSED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFailureCodeAllowableValues() + { + return [ + self::FAILURE_CODE_INSUFFICIENT_BALANCE, + self::FAILURE_CODE_REJECTED_BY_CHANNEL, + self::FAILURE_CODE_TEMPORARY_TRANSFER_ERROR, + self::FAILURE_CODE_INVALID_DESTINATION, + self::FAILURE_CODE_TRANSFER_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('receipt_notification', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('estimated_arrival_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ((mb_strlen($this->container['reference_id']) < 1)) { + $invalidProperties[] = "invalid value for 'reference_id', the character length must be bigger than or equal to 1."; + } + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + if ($this->container['business_id'] === null) { + $invalidProperties[] = "'business_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!is_null($this->container['failure_code']) && !in_array($this->container['failure_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'failure_code', must be one of '%s'", + $this->container['failure_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id A client defined payout identifier + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + + if ((mb_strlen($reference_id) < 1)) { + throw new \InvalidArgumentException('invalid length for $reference_id when calling GetPayouts200ResponseDataInner., must be bigger than or equal to 1.'); + } + + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets channel_code + * + * @return string + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string $channel_code Channel code of selected destination bank or e-wallet + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \Payout\DigitalPayoutChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \Payout\DigitalPayoutChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Currency of the destination channel using ISO-4217 currency code + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets receipt_notification + * + * @return \Payout\ReceiptNotification|null + */ + public function getReceiptNotification() + { + return $this->container['receipt_notification']; + } + + /** + * Sets receipt_notification + * + * @param \Payout\ReceiptNotification|null $receipt_notification receipt_notification + * + * @return self + */ + public function setReceiptNotification($receipt_notification) + { + if (is_null($receipt_notification)) { + throw new \InvalidArgumentException('non-nullable receipt_notification cannot be null'); + } + $this->container['receipt_notification'] = $receipt_notification; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata Object of additional information you may use + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Xendit-generated unique identifier for each payout + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime $created The time payout was created on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime $updated The time payout was last updated on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets business_id + * + * @return string + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string $business_id Xendit Business ID + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of payout + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code If the Payout failed, we include a failure code for more details on the failure. + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + throw new \InvalidArgumentException('non-nullable failure_code cannot be null'); + } + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!in_array($failure_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'failure_code', must be one of '%s'", + $failure_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets estimated_arrival_time + * + * @return \DateTime|null + */ + public function getEstimatedArrivalTime() + { + return $this->container['estimated_arrival_time']; + } + + /** + * Sets estimated_arrival_time + * + * @param \DateTime|null $estimated_arrival_time Our estimated time on to when your payout is reflected to the destination account + * + * @return self + */ + public function setEstimatedArrivalTime($estimated_arrival_time) + { + if (is_null($estimated_arrival_time)) { + throw new \InvalidArgumentException('non-nullable estimated_arrival_time cannot be null'); + } + $this->container['estimated_arrival_time'] = $estimated_arrival_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/GetPayouts200ResponseLinks.php b/lib/Payout/GetPayouts200ResponseLinks.php new file mode 100644 index 0000000..e581719 --- /dev/null +++ b/lib/Payout/GetPayouts200ResponseLinks.php @@ -0,0 +1,470 @@ + + */ +class GetPayouts200ResponseLinks implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getPayouts_200_response_links'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string|null + */ + public function getHref() + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href href + * + * @return self + */ + public function setHref($href) + { + if (is_null($href)) { + throw new \InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string|null + */ + public function getRel() + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel rel + * + * @return self + */ + public function setRel($rel) + { + if (is_null($rel)) { + throw new \InvalidArgumentException('non-nullable rel cannot be null'); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method method + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/Payout.php b/lib/Payout/Payout.php new file mode 100644 index 0000000..f546603 --- /dev/null +++ b/lib/Payout/Payout.php @@ -0,0 +1,1001 @@ + + */ +class Payout implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Payout'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reference_id' => 'string', + 'channel_code' => 'string', + 'channel_properties' => '\Xendit\Payout\DigitalPayoutChannelProperties', + 'amount' => 'float', + 'description' => 'string', + 'currency' => 'string', + 'receipt_notification' => '\Xendit\Payout\ReceiptNotification', + 'metadata' => 'object', + 'id' => 'string', + 'created' => '\DateTime', + 'updated' => '\DateTime', + 'business_id' => 'string', + 'status' => 'string', + 'failure_code' => 'string', + 'estimated_arrival_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reference_id' => null, + 'channel_code' => null, + 'channel_properties' => null, + 'amount' => null, + 'description' => null, + 'currency' => null, + 'receipt_notification' => null, + 'metadata' => null, + 'id' => null, + 'created' => 'date-time', + 'updated' => 'date-time', + 'business_id' => null, + 'status' => null, + 'failure_code' => null, + 'estimated_arrival_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reference_id' => false, + 'channel_code' => false, + 'channel_properties' => false, + 'amount' => false, + 'description' => false, + 'currency' => false, + 'receipt_notification' => false, + 'metadata' => false, + 'id' => false, + 'created' => false, + 'updated' => false, + 'business_id' => false, + 'status' => false, + 'failure_code' => false, + 'estimated_arrival_time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reference_id' => 'reference_id', + 'channel_code' => 'channel_code', + 'channel_properties' => 'channel_properties', + 'amount' => 'amount', + 'description' => 'description', + 'currency' => 'currency', + 'receipt_notification' => 'receipt_notification', + 'metadata' => 'metadata', + 'id' => 'id', + 'created' => 'created', + 'updated' => 'updated', + 'business_id' => 'business_id', + 'status' => 'status', + 'failure_code' => 'failure_code', + 'estimated_arrival_time' => 'estimated_arrival_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reference_id' => 'setReferenceId', + 'channel_code' => 'setChannelCode', + 'channel_properties' => 'setChannelProperties', + 'amount' => 'setAmount', + 'description' => 'setDescription', + 'currency' => 'setCurrency', + 'receipt_notification' => 'setReceiptNotification', + 'metadata' => 'setMetadata', + 'id' => 'setId', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'business_id' => 'setBusinessId', + 'status' => 'setStatus', + 'failure_code' => 'setFailureCode', + 'estimated_arrival_time' => 'setEstimatedArrivalTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reference_id' => 'getReferenceId', + 'channel_code' => 'getChannelCode', + 'channel_properties' => 'getChannelProperties', + 'amount' => 'getAmount', + 'description' => 'getDescription', + 'currency' => 'getCurrency', + 'receipt_notification' => 'getReceiptNotification', + 'metadata' => 'getMetadata', + 'id' => 'getId', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'business_id' => 'getBusinessId', + 'status' => 'getStatus', + 'failure_code' => 'getFailureCode', + 'estimated_arrival_time' => 'getEstimatedArrivalTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ACCEPTED = 'ACCEPTED'; + public const STATUS_REQUESTED = 'REQUESTED'; + public const STATUS_LOCKED = 'LOCKED'; + public const STATUS_CANCELLED = 'CANCELLED'; + public const STATUS_REVERSED = 'REVERSED'; + public const FAILURE_CODE_INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE'; + public const FAILURE_CODE_REJECTED_BY_CHANNEL = 'REJECTED_BY_CHANNEL'; + public const FAILURE_CODE_TEMPORARY_TRANSFER_ERROR = 'TEMPORARY_TRANSFER_ERROR'; + public const FAILURE_CODE_INVALID_DESTINATION = 'INVALID_DESTINATION'; + public const FAILURE_CODE_TRANSFER_ERROR = 'TRANSFER_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ACCEPTED, + self::STATUS_REQUESTED, + self::STATUS_LOCKED, + self::STATUS_CANCELLED, + self::STATUS_REVERSED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFailureCodeAllowableValues() + { + return [ + self::FAILURE_CODE_INSUFFICIENT_BALANCE, + self::FAILURE_CODE_REJECTED_BY_CHANNEL, + self::FAILURE_CODE_TEMPORARY_TRANSFER_ERROR, + self::FAILURE_CODE_INVALID_DESTINATION, + self::FAILURE_CODE_TRANSFER_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('channel_properties', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('receipt_notification', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('estimated_arrival_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['reference_id'] === null) { + $invalidProperties[] = "'reference_id' can't be null"; + } + if ((mb_strlen($this->container['reference_id']) < 1)) { + $invalidProperties[] = "invalid value for 'reference_id', the character length must be bigger than or equal to 1."; + } + + if ($this->container['channel_code'] === null) { + $invalidProperties[] = "'channel_code' can't be null"; + } + if ($this->container['channel_properties'] === null) { + $invalidProperties[] = "'channel_properties' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + if ($this->container['business_id'] === null) { + $invalidProperties[] = "'business_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!is_null($this->container['failure_code']) && !in_array($this->container['failure_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'failure_code', must be one of '%s'", + $this->container['failure_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reference_id + * + * @return string + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string $reference_id A client defined payout identifier + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + + if ((mb_strlen($reference_id) < 1)) { + throw new \InvalidArgumentException('invalid length for $reference_id when calling Payout., must be bigger than or equal to 1.'); + } + + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets channel_code + * + * @return string + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string $channel_code Channel code of selected destination bank or e-wallet + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets channel_properties + * + * @return \Payout\DigitalPayoutChannelProperties + */ + public function getChannelProperties() + { + return $this->container['channel_properties']; + } + + /** + * Sets channel_properties + * + * @param \Payout\DigitalPayoutChannelProperties $channel_properties channel_properties + * + * @return self + */ + public function setChannelProperties($channel_properties) + { + if (is_null($channel_properties)) { + throw new \InvalidArgumentException('non-nullable channel_properties cannot be null'); + } + $this->container['channel_properties'] = $channel_properties; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount Amount to be sent to the destination account and should be a multiple of the minimum increment for the selected channel + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description to send with the payout, the recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Currency of the destination channel using ISO-4217 currency code + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets receipt_notification + * + * @return \Payout\ReceiptNotification|null + */ + public function getReceiptNotification() + { + return $this->container['receipt_notification']; + } + + /** + * Sets receipt_notification + * + * @param \Payout\ReceiptNotification|null $receipt_notification receipt_notification + * + * @return self + */ + public function setReceiptNotification($receipt_notification) + { + if (is_null($receipt_notification)) { + throw new \InvalidArgumentException('non-nullable receipt_notification cannot be null'); + } + $this->container['receipt_notification'] = $receipt_notification; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata Object of additional information you may use + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Xendit-generated unique identifier for each payout + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime $created The time payout was created on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime $updated The time payout was last updated on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets business_id + * + * @return string + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string $business_id Xendit Business ID + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of payout + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code If the Payout failed, we include a failure code for more details on the failure. + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + throw new \InvalidArgumentException('non-nullable failure_code cannot be null'); + } + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!in_array($failure_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'failure_code', must be one of '%s'", + $failure_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets estimated_arrival_time + * + * @return \DateTime|null + */ + public function getEstimatedArrivalTime() + { + return $this->container['estimated_arrival_time']; + } + + /** + * Sets estimated_arrival_time + * + * @param \DateTime|null $estimated_arrival_time Our estimated time on to when your payout is reflected to the destination account + * + * @return self + */ + public function setEstimatedArrivalTime($estimated_arrival_time) + { + if (is_null($estimated_arrival_time)) { + throw new \InvalidArgumentException('non-nullable estimated_arrival_time cannot be null'); + } + $this->container['estimated_arrival_time'] = $estimated_arrival_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/PayoutAllOf.php b/lib/Payout/PayoutAllOf.php new file mode 100644 index 0000000..9f58bfc --- /dev/null +++ b/lib/Payout/PayoutAllOf.php @@ -0,0 +1,705 @@ + + */ +class PayoutAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Payout_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'created' => '\DateTime', + 'updated' => '\DateTime', + 'business_id' => 'string', + 'status' => 'string', + 'failure_code' => 'string', + 'estimated_arrival_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'created' => 'date-time', + 'updated' => 'date-time', + 'business_id' => null, + 'status' => null, + 'failure_code' => null, + 'estimated_arrival_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'created' => false, + 'updated' => false, + 'business_id' => false, + 'status' => false, + 'failure_code' => false, + 'estimated_arrival_time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'created' => 'created', + 'updated' => 'updated', + 'business_id' => 'business_id', + 'status' => 'status', + 'failure_code' => 'failure_code', + 'estimated_arrival_time' => 'estimated_arrival_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'business_id' => 'setBusinessId', + 'status' => 'setStatus', + 'failure_code' => 'setFailureCode', + 'estimated_arrival_time' => 'setEstimatedArrivalTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'business_id' => 'getBusinessId', + 'status' => 'getStatus', + 'failure_code' => 'getFailureCode', + 'estimated_arrival_time' => 'getEstimatedArrivalTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ACCEPTED = 'ACCEPTED'; + public const STATUS_REQUESTED = 'REQUESTED'; + public const STATUS_LOCKED = 'LOCKED'; + public const STATUS_CANCELLED = 'CANCELLED'; + public const STATUS_REVERSED = 'REVERSED'; + public const FAILURE_CODE_INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE'; + public const FAILURE_CODE_REJECTED_BY_CHANNEL = 'REJECTED_BY_CHANNEL'; + public const FAILURE_CODE_TEMPORARY_TRANSFER_ERROR = 'TEMPORARY_TRANSFER_ERROR'; + public const FAILURE_CODE_INVALID_DESTINATION = 'INVALID_DESTINATION'; + public const FAILURE_CODE_TRANSFER_ERROR = 'TRANSFER_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ACCEPTED, + self::STATUS_REQUESTED, + self::STATUS_LOCKED, + self::STATUS_CANCELLED, + self::STATUS_REVERSED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFailureCodeAllowableValues() + { + return [ + self::FAILURE_CODE_INSUFFICIENT_BALANCE, + self::FAILURE_CODE_REJECTED_BY_CHANNEL, + self::FAILURE_CODE_TEMPORARY_TRANSFER_ERROR, + self::FAILURE_CODE_INVALID_DESTINATION, + self::FAILURE_CODE_TRANSFER_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('estimated_arrival_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['created'] === null) { + $invalidProperties[] = "'created' can't be null"; + } + if ($this->container['updated'] === null) { + $invalidProperties[] = "'updated' can't be null"; + } + if ($this->container['business_id'] === null) { + $invalidProperties[] = "'business_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!is_null($this->container['failure_code']) && !in_array($this->container['failure_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'failure_code', must be one of '%s'", + $this->container['failure_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Xendit-generated unique identifier for each payout + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets created + * + * @return \DateTime + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param \DateTime $created The time payout was created on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime $updated The time payout was last updated on Xendit's system, in ISO 8601 format + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets business_id + * + * @return string + */ + public function getBusinessId() + { + return $this->container['business_id']; + } + + /** + * Sets business_id + * + * @param string $business_id Xendit Business ID + * + * @return self + */ + public function setBusinessId($business_id) + { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } + $this->container['business_id'] = $business_id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Status of payout + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code If the Payout failed, we include a failure code for more details on the failure. + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + throw new \InvalidArgumentException('non-nullable failure_code cannot be null'); + } + $allowedValues = $this->getFailureCodeAllowableValues(); + if (!in_array($failure_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'failure_code', must be one of '%s'", + $failure_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets estimated_arrival_time + * + * @return \DateTime|null + */ + public function getEstimatedArrivalTime() + { + return $this->container['estimated_arrival_time']; + } + + /** + * Sets estimated_arrival_time + * + * @param \DateTime|null $estimated_arrival_time Our estimated time on to when your payout is reflected to the destination account + * + * @return self + */ + public function setEstimatedArrivalTime($estimated_arrival_time) + { + if (is_null($estimated_arrival_time)) { + throw new \InvalidArgumentException('non-nullable estimated_arrival_time cannot be null'); + } + $this->container['estimated_arrival_time'] = $estimated_arrival_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Payout/PayoutApi.php b/lib/Payout/PayoutApi.php new file mode 100644 index 0000000..d0aa480 --- /dev/null +++ b/lib/Payout/PayoutApi.php @@ -0,0 +1,2033 @@ + [ + 'application/json', + ], + 'createPayout' => [ + 'application/json', + ], + 'getPayoutById' => [ + 'application/json', + ], + 'getPayoutChannels' => [ + 'application/json', + ], + 'getPayouts' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation cancelPayout + * + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPayout'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error + */ + public function cancelPayout($id, string $contentType = self::contentTypes['cancelPayout'][0]) + { + list($response) = $this->cancelPayoutWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation cancelPayoutWithHttpInfo + * + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPayout'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelPayoutWithHttpInfo($id, string $contentType = self::contentTypes['cancelPayout'][0]) + { + $request = $this->cancelPayoutRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Payout\GetPayouts200ResponseDataInner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\GetPayouts200ResponseDataInner' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\GetPayouts200ResponseDataInner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\GetPayouts200ResponseDataInner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelPayoutAsync + * + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + * + * @param Xenditstring $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelPayoutAsync($id, string $contentType = self::contentTypes['cancelPayout'][0]) + { + return $this->cancelPayoutAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelPayoutAsyncWithHttpInfo + * + * API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + * + * @param Xenditstring $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelPayoutAsyncWithHttpInfo($id, string $contentType = self::contentTypes['cancelPayout'][0]) + { + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + $request = $this->cancelPayoutRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelPayout' + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelPayoutRequest($id, string $contentType = self::contentTypes['cancelPayout'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling cancelPayout' + ); + } + + + $resourcePath = '/v2/payouts/{id}/cancel'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createPayout + * + * API to send money at scale to bank accounts & eWallets + * + * @param string $idempotency_key A unique key to prevent duplicate requests from pushing through our system. No expiration. (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. (optional) + * @param \Xendit\Payout\CreatePayoutRequest $create_payout_request create_payout_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPayout'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error + */ + public function createPayout($idempotency_key, $for_user_id = null, $create_payout_request = null, string $contentType = self::contentTypes['createPayout'][0]) + { + list($response) = $this->createPayoutWithHttpInfo($idempotency_key, $for_user_id, $create_payout_request, $contentType); + return $response; + } + + /** + * Operation createPayoutWithHttpInfo + * + * API to send money at scale to bank accounts & eWallets + * + * @param string $idempotency_key A unique key to prevent duplicate requests from pushing through our system. No expiration. (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. (optional) + * @param \Xendit\Payout\CreatePayoutRequest $create_payout_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPayout'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createPayoutWithHttpInfo($idempotency_key, $for_user_id = null, $create_payout_request = null, string $contentType = self::contentTypes['createPayout'][0]) + { + $request = $this->createPayoutRequest($idempotency_key, $for_user_id, $create_payout_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Payout\GetPayouts200ResponseDataInner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\GetPayouts200ResponseDataInner' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\GetPayouts200ResponseDataInner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\GetPayouts200ResponseDataInner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPayoutAsync + * + * API to send money at scale to bank accounts & eWallets + * + * @param Xenditstring $idempotency_key A unique key to prevent duplicate requests from pushing through our system. No expiration. (required) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. (optional) + * @param Xendit\Xendit\Payout\CreatePayoutRequest $create_payout_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPayoutAsync($idempotency_key, $for_user_id = null, $create_payout_request = null, string $contentType = self::contentTypes['createPayout'][0]) + { + return $this->createPayoutAsyncWithHttpInfo($idempotency_key, $for_user_id, $create_payout_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPayoutAsyncWithHttpInfo + * + * API to send money at scale to bank accounts & eWallets + * + * @param Xenditstring $idempotency_key A unique key to prevent duplicate requests from pushing through our system. No expiration. (required) + * @param Xenditstring $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. (optional) + * @param Xendit\Xendit\Payout\CreatePayoutRequest $create_payout_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPayoutAsyncWithHttpInfo($idempotency_key, $for_user_id = null, $create_payout_request = null, string $contentType = self::contentTypes['createPayout'][0]) + { + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + $request = $this->createPayoutRequest($idempotency_key, $for_user_id, $create_payout_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createPayout' + * + * @param string $idempotency_key A unique key to prevent duplicate requests from pushing through our system. No expiration. (required) + * @param string $for_user_id The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. (optional) + * @param \Xendit\Payout\CreatePayoutRequest $create_payout_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPayout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPayoutRequest($idempotency_key, $for_user_id = null, $create_payout_request = null, string $contentType = self::contentTypes['createPayout'][0]) + { + + // verify the required parameter 'idempotency_key' is set + if ($idempotency_key === null || (is_array($idempotency_key) && count($idempotency_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $idempotency_key when calling createPayout' + ); + } + + + + + $resourcePath = '/v2/payouts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: idempotency-key + if ($idempotency_key !== null) { + $headerParams['idempotency-key'] = ObjectSerializer::toHeaderValue($idempotency_key); + } + // header param: for-user-id + if ($for_user_id !== null) { + $headerParams['for-user-id'] = ObjectSerializer::toHeaderValue($for_user_id); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_payout_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_payout_request)); + } else { + $httpBody = $create_payout_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPayoutById + * + * API to fetch the current status, or details of the payout + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutById'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error + */ + public function getPayoutById($id, string $contentType = self::contentTypes['getPayoutById'][0]) + { + list($response) = $this->getPayoutByIdWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getPayoutByIdWithHttpInfo + * + * API to fetch the current status, or details of the payout + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutById'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Payout\GetPayouts200ResponseDataInner|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error|Xendit\Payout\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPayoutByIdWithHttpInfo($id, string $contentType = self::contentTypes['getPayoutById'][0]) + { + $request = $this->getPayoutByIdRequest($id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Payout\GetPayouts200ResponseDataInner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\GetPayouts200ResponseDataInner' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\GetPayouts200ResponseDataInner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\GetPayouts200ResponseDataInner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPayoutByIdAsync + * + * API to fetch the current status, or details of the payout + * + * @param Xenditstring $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutByIdAsync($id, string $contentType = self::contentTypes['getPayoutById'][0]) + { + return $this->getPayoutByIdAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPayoutByIdAsyncWithHttpInfo + * + * API to fetch the current status, or details of the payout + * + * @param Xenditstring $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutByIdAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getPayoutById'][0]) + { + $returnType = '\Payout\GetPayouts200ResponseDataInner'; + $request = $this->getPayoutByIdRequest($id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPayoutById' + * + * @param string $id Payout id returned from the response of /v2/payouts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPayoutByIdRequest($id, string $contentType = self::contentTypes['getPayoutById'][0]) + { + + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getPayoutById' + ); + } + + + $resourcePath = '/v2/payouts/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPayoutChannels + * + * API providing the current list of banks and e-wallets we support for payouts for both regions + * + * @param string $currency Filter channels by currency from ISO-4217 values (optional) + * @param \Payout\ChannelCategory[] $channel_category Filter channels by category (optional) + * @param string $channel_code Filter channels by channel code, prefixed by ISO-3166 country code (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutChannels'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Payout\Channel[]|Xendit\Payout\Error + */ + public function getPayoutChannels($currency = null, $channel_category = null, $channel_code = null, string $contentType = self::contentTypes['getPayoutChannels'][0]) + { + list($response) = $this->getPayoutChannelsWithHttpInfo($currency, $channel_category, $channel_code, $contentType); + return $response; + } + + /** + * Operation getPayoutChannelsWithHttpInfo + * + * API providing the current list of banks and e-wallets we support for payouts for both regions + * + * @param string $currency Filter channels by currency from ISO-4217 values (optional) + * @param \Payout\ChannelCategory[] $channel_category Filter channels by category (optional) + * @param string $channel_code Filter channels by channel code, prefixed by ISO-3166 country code (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutChannels'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Payout\Channel[]|Xendit\Payout\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPayoutChannelsWithHttpInfo($currency = null, $channel_category = null, $channel_code = null, string $contentType = self::contentTypes['getPayoutChannels'][0]) + { + $request = $this->getPayoutChannelsRequest($currency, $channel_category, $channel_code, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Payout\Channel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Channel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Channel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Payout\Channel[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Channel[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPayoutChannelsAsync + * + * API providing the current list of banks and e-wallets we support for payouts for both regions + * + * @param Xenditstring $currency Filter channels by currency from ISO-4217 values (optional) + * @param Xendit\Payout\ChannelCategory[] $channel_category Filter channels by category (optional) + * @param Xenditstring $channel_code Filter channels by channel code, prefixed by ISO-3166 country code (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutChannelsAsync($currency = null, $channel_category = null, $channel_code = null, string $contentType = self::contentTypes['getPayoutChannels'][0]) + { + return $this->getPayoutChannelsAsyncWithHttpInfo($currency, $channel_category, $channel_code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPayoutChannelsAsyncWithHttpInfo + * + * API providing the current list of banks and e-wallets we support for payouts for both regions + * + * @param Xenditstring $currency Filter channels by currency from ISO-4217 values (optional) + * @param Xendit\Payout\ChannelCategory[] $channel_category Filter channels by category (optional) + * @param Xenditstring $channel_code Filter channels by channel code, prefixed by ISO-3166 country code (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutChannelsAsyncWithHttpInfo($currency = null, $channel_category = null, $channel_code = null, string $contentType = self::contentTypes['getPayoutChannels'][0]) + { + $returnType = '\Payout\Channel[]'; + $request = $this->getPayoutChannelsRequest($currency, $channel_category, $channel_code, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPayoutChannels' + * + * @param string $currency Filter channels by currency from ISO-4217 values (optional) + * @param \Payout\ChannelCategory[] $channel_category Filter channels by category (optional) + * @param string $channel_code Filter channels by channel code, prefixed by ISO-3166 country code (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayoutChannels'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPayoutChannelsRequest($currency = null, $channel_category = null, $channel_code = null, string $contentType = self::contentTypes['getPayoutChannels'][0]) + { + + + + + + $resourcePath = '/payouts_channels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $currency, + 'currency', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $channel_category, + 'channel_category', // param base name + 'array', // openApiType + 'form', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $channel_code, + 'channel_code', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPayouts + * + * API to retrieve all matching payouts with reference ID + * + * @param string $reference_id Reference_id provided when creating the payout (required) + * @param float $limit Number of records to fetch per API call (optional) + * @param string $after_id Used to fetch record after this payout unique id (optional) + * @param string $before_id Used to fetch record before this payout unique id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayouts'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Payout\GetPayouts200Response|Xendit\Payout\Error|Xendit\Payout\Error + */ + public function getPayouts($reference_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPayouts'][0]) + { + list($response) = $this->getPayoutsWithHttpInfo($reference_id, $limit, $after_id, $before_id, $contentType); + return $response; + } + + /** + * Operation getPayoutsWithHttpInfo + * + * API to retrieve all matching payouts with reference ID + * + * @param string $reference_id Reference_id provided when creating the payout (required) + * @param float $limit Number of records to fetch per API call (optional) + * @param string $after_id Used to fetch record after this payout unique id (optional) + * @param string $before_id Used to fetch record before this payout unique id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayouts'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Payout\GetPayouts200Response|Xendit\Payout\Error|Xendit\Payout\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getPayoutsWithHttpInfo($reference_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPayouts'][0]) + { + $request = $this->getPayoutsRequest($reference_id, $limit, $after_id, $before_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Payout\GetPayouts200Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\GetPayouts200Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\GetPayouts200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Payout\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Payout\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Payout\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Payout\GetPayouts200Response'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\GetPayouts200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Payout\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPayoutsAsync + * + * API to retrieve all matching payouts with reference ID + * + * @param Xenditstring $reference_id Reference_id provided when creating the payout (required) + * @param Xenditfloat $limit Number of records to fetch per API call (optional) + * @param Xenditstring $after_id Used to fetch record after this payout unique id (optional) + * @param Xenditstring $before_id Used to fetch record before this payout unique id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayouts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutsAsync($reference_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPayouts'][0]) + { + return $this->getPayoutsAsyncWithHttpInfo($reference_id, $limit, $after_id, $before_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPayoutsAsyncWithHttpInfo + * + * API to retrieve all matching payouts with reference ID + * + * @param Xenditstring $reference_id Reference_id provided when creating the payout (required) + * @param Xenditfloat $limit Number of records to fetch per API call (optional) + * @param Xenditstring $after_id Used to fetch record after this payout unique id (optional) + * @param Xenditstring $before_id Used to fetch record before this payout unique id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayouts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPayoutsAsyncWithHttpInfo($reference_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPayouts'][0]) + { + $returnType = '\Payout\GetPayouts200Response'; + $request = $this->getPayoutsRequest($reference_id, $limit, $after_id, $before_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPayouts' + * + * @param string $reference_id Reference_id provided when creating the payout (required) + * @param float $limit Number of records to fetch per API call (optional) + * @param string $after_id Used to fetch record after this payout unique id (optional) + * @param string $before_id Used to fetch record before this payout unique id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayouts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPayoutsRequest($reference_id, $limit = null, $after_id = null, $before_id = null, string $contentType = self::contentTypes['getPayouts'][0]) + { + + // verify the required parameter 'reference_id' is set + if ($reference_id === null || (is_array($reference_id) && count($reference_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $reference_id when calling getPayouts' + ); + } + + + + + + $resourcePath = '/v2/payouts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reference_id, + 'reference_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'number', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_id, + 'after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before_id, + 'before_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Payout/ReceiptNotification.php b/lib/Payout/ReceiptNotification.php new file mode 100644 index 0000000..7bd0f3f --- /dev/null +++ b/lib/Payout/ReceiptNotification.php @@ -0,0 +1,492 @@ + + */ +class ReceiptNotification implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReceiptNotification'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email_to' => 'string[]', + 'email_cc' => 'string[]', + 'email_bcc' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email_to' => 'email', + 'email_cc' => 'email', + 'email_bcc' => 'email' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_to' => true, + 'email_cc' => true, + 'email_bcc' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email_to' => 'email_to', + 'email_cc' => 'email_cc', + 'email_bcc' => 'email_bcc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email_to' => 'setEmailTo', + 'email_cc' => 'setEmailCc', + 'email_bcc' => 'setEmailBcc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email_to' => 'getEmailTo', + 'email_cc' => 'getEmailCc', + 'email_bcc' => 'getEmailBcc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email_to', $data ?? [], null); + $this->setIfExists('email_cc', $data ?? [], null); + $this->setIfExists('email_bcc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email_to + * + * @return string[]|null + */ + public function getEmailTo() + { + return $this->container['email_to']; + } + + /** + * Sets email_to + * + * @param string[]|null $email_to Valid email address to send the payout receipt + * + * @return self + */ + public function setEmailTo($email_to) + { + if (is_null($email_to)) { + array_push($this->openAPINullablesSetToNull, 'email_to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email_to'] = $email_to; + + return $this; + } + + /** + * Gets email_cc + * + * @return string[]|null + */ + public function getEmailCc() + { + return $this->container['email_cc']; + } + + /** + * Sets email_cc + * + * @param string[]|null $email_cc Valid email address to cc the payout receipt + * + * @return self + */ + public function setEmailCc($email_cc) + { + if (is_null($email_cc)) { + array_push($this->openAPINullablesSetToNull, 'email_cc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_cc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email_cc'] = $email_cc; + + return $this; + } + + /** + * Gets email_bcc + * + * @return string[]|null + */ + public function getEmailBcc() + { + return $this->container['email_bcc']; + } + + /** + * Sets email_bcc + * + * @param string[]|null $email_bcc Valid email address to bcc the payout receipt + * + * @return self + */ + public function setEmailBcc($email_bcc) + { + if (is_null($email_bcc)) { + array_push($this->openAPINullablesSetToNull, 'email_bcc'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email_bcc', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email_bcc'] = $email_bcc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund.php b/lib/Refund/CreateRefund.php new file mode 100644 index 0000000..464094a --- /dev/null +++ b/lib/Refund/CreateRefund.php @@ -0,0 +1,653 @@ + + */ +class CreateRefund implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateRefund'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payment_request_id' => 'string', + 'invoice_id' => 'string', + 'reference_id' => 'string', + 'amount' => 'float', + 'currency' => 'string', + 'reason' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payment_request_id' => null, + 'invoice_id' => null, + 'reference_id' => null, + 'amount' => 'double', + 'currency' => null, + 'reason' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payment_request_id' => false, + 'invoice_id' => false, + 'reference_id' => false, + 'amount' => false, + 'currency' => false, + 'reason' => false, + 'metadata' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'payment_request_id' => 'payment_request_id', + 'invoice_id' => 'invoice_id', + 'reference_id' => 'reference_id', + 'amount' => 'amount', + 'currency' => 'currency', + 'reason' => 'reason', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payment_request_id' => 'setPaymentRequestId', + 'invoice_id' => 'setInvoiceId', + 'reference_id' => 'setReferenceId', + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'reason' => 'setReason', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_request_id' => 'getPaymentRequestId', + 'invoice_id' => 'getInvoiceId', + 'reference_id' => 'getReferenceId', + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'reason' => 'getReason', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const REASON_FRAUDULENT = 'FRAUDULENT'; + public const REASON_DUPLICATE = 'DUPLICATE'; + public const REASON_REQUESTED_BY_CUSTOMER = 'REQUESTED_BY_CUSTOMER'; + public const REASON_CANCELLATION = 'CANCELLATION'; + public const REASON_OTHERS = 'OTHERS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getReasonAllowableValues() + { + return [ + self::REASON_FRAUDULENT, + self::REASON_DUPLICATE, + self::REASON_REQUESTED_BY_CUSTOMER, + self::REASON_CANCELLATION, + self::REASON_OTHERS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('payment_request_id', $data ?? [], null); + $this->setIfExists('invoice_id', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getReasonAllowableValues(); + if (!is_null($this->container['reason']) && !in_array($this->container['reason'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'reason', must be one of '%s'", + $this->container['reason'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets payment_request_id + * + * @return string|null + */ + public function getPaymentRequestId() + { + return $this->container['payment_request_id']; + } + + /** + * Sets payment_request_id + * + * @param string|null $payment_request_id payment_request_id + * + * @return self + */ + public function setPaymentRequestId($payment_request_id) + { + if (is_null($payment_request_id)) { + throw new \InvalidArgumentException('non-nullable payment_request_id cannot be null'); + } + $this->container['payment_request_id'] = $payment_request_id; + + return $this; + } + + /** + * Gets invoice_id + * + * @return string|null + */ + public function getInvoiceId() + { + return $this->container['invoice_id']; + } + + /** + * Sets invoice_id + * + * @param string|null $invoice_id invoice_id + * + * @return self + */ + public function setInvoiceId($invoice_id) + { + if (is_null($invoice_id)) { + throw new \InvalidArgumentException('non-nullable invoice_id cannot be null'); + } + $this->container['invoice_id'] = $invoice_id; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + throw new \InvalidArgumentException('non-nullable reference_id cannot be null'); + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason reason + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } + $allowedValues = $this->getReasonAllowableValues(); + if (!in_array($reason, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'reason', must be one of '%s'", + $reason, + implode("', '", $allowedValues) + ) + ); + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund400Response.php b/lib/Refund/CreateRefund400Response.php new file mode 100644 index 0000000..6fbd4a3 --- /dev/null +++ b/lib/Refund/CreateRefund400Response.php @@ -0,0 +1,480 @@ + + */ +class CreateRefund400Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_400_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_API_VALIDATION_ERROR = 'API_VALIDATION_ERROR'; + public const ERROR_CODE_INELIGIBLE_TRANSACTION = 'INELIGIBLE_TRANSACTION'; + public const ERROR_CODE_INSUFFICIENT_BALANCE = 'INSUFFICIENT_BALANCE'; + public const ERROR_CODE_MAXIMUM_REFUND_AMOUNT_REACHED = 'MAXIMUM_REFUND_AMOUNT_REACHED'; + public const ERROR_CODE_PARTIAL_REFUND_NOT_SUPPORTED = 'PARTIAL_REFUND_NOT_SUPPORTED'; + public const ERROR_CODE_REFUND_NOT_SUPPORTED = 'REFUND_NOT_SUPPORTED'; + public const ERROR_CODE_TRANSACTION_NOT_FOUND = 'TRANSACTION_NOT_FOUND'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_API_VALIDATION_ERROR, + self::ERROR_CODE_INELIGIBLE_TRANSACTION, + self::ERROR_CODE_INSUFFICIENT_BALANCE, + self::ERROR_CODE_MAXIMUM_REFUND_AMOUNT_REACHED, + self::ERROR_CODE_PARTIAL_REFUND_NOT_SUPPORTED, + self::ERROR_CODE_REFUND_NOT_SUPPORTED, + self::ERROR_CODE_TRANSACTION_NOT_FOUND, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund403Response.php b/lib/Refund/CreateRefund403Response.php new file mode 100644 index 0000000..97dc760 --- /dev/null +++ b/lib/Refund/CreateRefund403Response.php @@ -0,0 +1,468 @@ + + */ +class CreateRefund403Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_403_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_UNAUTHORIZED = 'UNAUTHORIZED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_UNAUTHORIZED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund404Response.php b/lib/Refund/CreateRefund404Response.php new file mode 100644 index 0000000..a14ac8f --- /dev/null +++ b/lib/Refund/CreateRefund404Response.php @@ -0,0 +1,468 @@ + + */ +class CreateRefund404Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_404_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_DATA_NOT_FOUND = 'DATA_NOT_FOUND'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_DATA_NOT_FOUND, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund409Response.php b/lib/Refund/CreateRefund409Response.php new file mode 100644 index 0000000..7cc7dfa --- /dev/null +++ b/lib/Refund/CreateRefund409Response.php @@ -0,0 +1,470 @@ + + */ +class CreateRefund409Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_409_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_DUPLICATE_ERROR = 'DUPLICATE_ERROR'; + public const ERROR_CODE_IDEMPOTENCY_ERROR = 'IDEMPOTENCY_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_DUPLICATE_ERROR, + self::ERROR_CODE_IDEMPOTENCY_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefund503Response.php b/lib/Refund/CreateRefund503Response.php new file mode 100644 index 0000000..abd3443 --- /dev/null +++ b/lib/Refund/CreateRefund503Response.php @@ -0,0 +1,470 @@ + + */ +class CreateRefund503Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_503_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ERROR_CODE_CHANNEL_UNAVAILABLE = 'CHANNEL_UNAVAILABLE'; + public const ERROR_CODE_OTP_DELIVERY_ERROR = 'OTP_DELIVERY_ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_CHANNEL_UNAVAILABLE, + self::ERROR_CODE_OTP_DELIVERY_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/CreateRefundDefaultResponse.php b/lib/Refund/CreateRefundDefaultResponse.php new file mode 100644 index 0000000..0aab7f9 --- /dev/null +++ b/lib/Refund/CreateRefundDefaultResponse.php @@ -0,0 +1,436 @@ + + */ +class CreateRefundDefaultResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createRefund_default_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'error_code', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/Refund.php b/lib/Refund/Refund.php new file mode 100644 index 0000000..2e238ee --- /dev/null +++ b/lib/Refund/Refund.php @@ -0,0 +1,804 @@ + + */ +class Refund implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Refund'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'payment_request_id' => 'string', + 'amount' => 'float', + 'channel_code' => 'string', + 'country' => 'string', + 'currency' => 'string', + 'reference_id' => 'string', + 'failure_code' => 'string', + 'refund_fee_amount' => 'float', + 'created' => 'string', + 'updated' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'payment_request_id' => null, + 'amount' => 'double', + 'channel_code' => null, + 'country' => null, + 'currency' => null, + 'reference_id' => null, + 'failure_code' => null, + 'refund_fee_amount' => 'double', + 'created' => null, + 'updated' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'payment_request_id' => false, + 'amount' => false, + 'channel_code' => false, + 'country' => false, + 'currency' => false, + 'reference_id' => true, + 'failure_code' => true, + 'refund_fee_amount' => true, + 'created' => false, + 'updated' => false, + 'metadata' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'payment_request_id' => 'payment_request_id', + 'amount' => 'amount', + 'channel_code' => 'channel_code', + 'country' => 'country', + 'currency' => 'currency', + 'reference_id' => 'reference_id', + 'failure_code' => 'failure_code', + 'refund_fee_amount' => 'refund_fee_amount', + 'created' => 'created', + 'updated' => 'updated', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'payment_request_id' => 'setPaymentRequestId', + 'amount' => 'setAmount', + 'channel_code' => 'setChannelCode', + 'country' => 'setCountry', + 'currency' => 'setCurrency', + 'reference_id' => 'setReferenceId', + 'failure_code' => 'setFailureCode', + 'refund_fee_amount' => 'setRefundFeeAmount', + 'created' => 'setCreated', + 'updated' => 'setUpdated', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'payment_request_id' => 'getPaymentRequestId', + 'amount' => 'getAmount', + 'channel_code' => 'getChannelCode', + 'country' => 'getCountry', + 'currency' => 'getCurrency', + 'reference_id' => 'getReferenceId', + 'failure_code' => 'getFailureCode', + 'refund_fee_amount' => 'getRefundFeeAmount', + 'created' => 'getCreated', + 'updated' => 'getUpdated', + 'metadata' => 'getMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('payment_request_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('channel_code', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('reference_id', $data ?? [], null); + $this->setIfExists('failure_code', $data ?? [], null); + $this->setIfExists('refund_fee_amount', $data ?? [], null); + $this->setIfExists('created', $data ?? [], null); + $this->setIfExists('updated', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets payment_request_id + * + * @return string|null + */ + public function getPaymentRequestId() + { + return $this->container['payment_request_id']; + } + + /** + * Sets payment_request_id + * + * @param string|null $payment_request_id payment_request_id + * + * @return self + */ + public function setPaymentRequestId($payment_request_id) + { + if (is_null($payment_request_id)) { + throw new \InvalidArgumentException('non-nullable payment_request_id cannot be null'); + } + $this->container['payment_request_id'] = $payment_request_id; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets channel_code + * + * @return string|null + */ + public function getChannelCode() + { + return $this->container['channel_code']; + } + + /** + * Sets channel_code + * + * @param string|null $channel_code channel_code + * + * @return self + */ + public function setChannelCode($channel_code) + { + if (is_null($channel_code)) { + throw new \InvalidArgumentException('non-nullable channel_code cannot be null'); + } + $this->container['channel_code'] = $channel_code; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country country + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets reference_id + * + * @return string|null + */ + public function getReferenceId() + { + return $this->container['reference_id']; + } + + /** + * Sets reference_id + * + * @param string|null $reference_id reference_id + * + * @return self + */ + public function setReferenceId($reference_id) + { + if (is_null($reference_id)) { + array_push($this->openAPINullablesSetToNull, 'reference_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reference_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reference_id'] = $reference_id; + + return $this; + } + + /** + * Gets failure_code + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failure_code']; + } + + /** + * Sets failure_code + * + * @param string|null $failure_code failure_code + * + * @return self + */ + public function setFailureCode($failure_code) + { + if (is_null($failure_code)) { + array_push($this->openAPINullablesSetToNull, 'failure_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failure_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failure_code'] = $failure_code; + + return $this; + } + + /** + * Gets refund_fee_amount + * + * @return float|null + */ + public function getRefundFeeAmount() + { + return $this->container['refund_fee_amount']; + } + + /** + * Sets refund_fee_amount + * + * @param float|null $refund_fee_amount refund_fee_amount + * + * @return self + */ + public function setRefundFeeAmount($refund_fee_amount) + { + if (is_null($refund_fee_amount)) { + array_push($this->openAPINullablesSetToNull, 'refund_fee_amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('refund_fee_amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['refund_fee_amount'] = $refund_fee_amount; + + return $this; + } + + /** + * Gets created + * + * @return string|null + */ + public function getCreated() + { + return $this->container['created']; + } + + /** + * Sets created + * + * @param string|null $created created + * + * @return self + */ + public function setCreated($created) + { + if (is_null($created)) { + throw new \InvalidArgumentException('non-nullable created cannot be null'); + } + $this->container['created'] = $created; + + return $this; + } + + /** + * Gets updated + * + * @return string|null + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param string|null $updated updated + * + * @return self + */ + public function setUpdated($updated) + { + if (is_null($updated)) { + throw new \InvalidArgumentException('non-nullable updated cannot be null'); + } + $this->container['updated'] = $updated; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Refund/RefundApi.php b/lib/Refund/RefundApi.php new file mode 100644 index 0000000..a48ef5d --- /dev/null +++ b/lib/Refund/RefundApi.php @@ -0,0 +1,1553 @@ + [ + 'application/json', + ], + 'createRefund' => [ + 'application/json', + ], + 'getAllRefunds' => [ + 'application/json', + ], + 'getRefund' => [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + public function setApiKey($apiKey) + { + $this->config->setApiKey($apiKey); + return $this; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation cancelRefund + * + * @param string $refund_id refund_id (required) + * @param string $idempotency_key idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Refund\Refund|Xendit\Refund\CreateRefund400Response|Xendit\Refund\CreateRefund403Response|Xendit\Refund\CreateRefund404Response|Xendit\Refund\CreateRefundDefaultResponse + */ + public function cancelRefund($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['cancelRefund'][0]) + { + list($response) = $this->cancelRefundWithHttpInfo($refund_id, $idempotency_key, $contentType); + return $response; + } + + /** + * Operation cancelRefundWithHttpInfo + * + * @param string $refund_id (required) + * @param string $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Refund\Refund|Xendit\Refund\CreateRefund400Response|Xendit\Refund\CreateRefund403Response|Xendit\Refund\CreateRefund404Response|Xendit\Refund\CreateRefundDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelRefundWithHttpInfo($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['cancelRefund'][0]) + { + $request = $this->cancelRefundRequest($refund_id, $idempotency_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Refund\Refund' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\Refund' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\Refund', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\Refund\CreateRefund400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Refund\CreateRefund403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Refund\CreateRefund404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Refund\CreateRefundDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefundDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefundDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Refund\Refund'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\Refund', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefundDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelRefundAsync + * + * @param Xenditstring $refund_id (required) + * @param Xenditstring $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelRefundAsync($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['cancelRefund'][0]) + { + return $this->cancelRefundAsyncWithHttpInfo($refund_id, $idempotency_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelRefundAsyncWithHttpInfo + * + * @param Xenditstring $refund_id (required) + * @param Xenditstring $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelRefundAsyncWithHttpInfo($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['cancelRefund'][0]) + { + $returnType = '\Refund\Refund'; + $request = $this->cancelRefundRequest($refund_id, $idempotency_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelRefund' + * + * @param string $refund_id (required) + * @param string $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelRefundRequest($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['cancelRefund'][0]) + { + + // verify the required parameter 'refund_id' is set + if ($refund_id === null || (is_array($refund_id) && count($refund_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $refund_id when calling cancelRefund' + ); + } + + + + $resourcePath = '/refunds/{refundID}/cancel'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: idempotency-key + if ($idempotency_key !== null) { + $headerParams['idempotency-key'] = ObjectSerializer::toHeaderValue($idempotency_key); + } + // path params + if ($refund_id !== null) { + $resourcePath = str_replace( + '{' . 'refundID' . '}', + ObjectSerializer::toPathValue($refund_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createRefund + * + * @param string $idempotency_key idempotency_key (optional) + * @param \Xendit\Refund\CreateRefund $create_refund create_refund (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Refund\Refund|Xendit\Refund\CreateRefund400Response|Xendit\Refund\CreateRefund403Response|Xendit\Refund\CreateRefund404Response|Xendit\Refund\CreateRefund409Response|Xendit\Refund\CreateRefund503Response|Xendit\Refund\CreateRefundDefaultResponse + */ + public function createRefund($idempotency_key = null, $create_refund = null, string $contentType = self::contentTypes['createRefund'][0]) + { + list($response) = $this->createRefundWithHttpInfo($idempotency_key, $create_refund, $contentType); + return $response; + } + + /** + * Operation createRefundWithHttpInfo + * + * @param string $idempotency_key (optional) + * @param \Xendit\Refund\CreateRefund $create_refund (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Refund\Refund|Xendit\Refund\CreateRefund400Response|Xendit\Refund\CreateRefund403Response|Xendit\Refund\CreateRefund404Response|Xendit\Refund\CreateRefund409Response|Xendit\Refund\CreateRefund503Response|Xendit\Refund\CreateRefundDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createRefundWithHttpInfo($idempotency_key = null, $create_refund = null, string $contentType = self::contentTypes['createRefund'][0]) + { + $request = $this->createRefundRequest($idempotency_key, $create_refund, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Refund\Refund' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\Refund' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\Refund', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('Xendit\Refund\CreateRefund400Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund400Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund400Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('Xendit\Refund\CreateRefund403Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund403Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund403Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('Xendit\Refund\CreateRefund404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund404Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('Xendit\Refund\CreateRefund409Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund409Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund409Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 503: + if ('Xendit\Refund\CreateRefund503Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefund503Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefund503Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Refund\CreateRefundDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefundDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefundDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Refund\Refund'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\Refund', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund400Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund403Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund409Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefund503Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefundDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createRefundAsync + * + * @param Xenditstring $idempotency_key (optional) + * @param Xendit\Xendit\Refund\CreateRefund $create_refund (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRefundAsync($idempotency_key = null, $create_refund = null, string $contentType = self::contentTypes['createRefund'][0]) + { + return $this->createRefundAsyncWithHttpInfo($idempotency_key, $create_refund, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createRefundAsyncWithHttpInfo + * + * @param Xenditstring $idempotency_key (optional) + * @param Xendit\Xendit\Refund\CreateRefund $create_refund (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRefundAsyncWithHttpInfo($idempotency_key = null, $create_refund = null, string $contentType = self::contentTypes['createRefund'][0]) + { + $returnType = '\Refund\Refund'; + $request = $this->createRefundRequest($idempotency_key, $create_refund, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createRefund' + * + * @param string $idempotency_key (optional) + * @param \Xendit\Refund\CreateRefund $create_refund (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRefundRequest($idempotency_key = null, $create_refund = null, string $contentType = self::contentTypes['createRefund'][0]) + { + + + + + $resourcePath = '/refunds'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: idempotency-key + if ($idempotency_key !== null) { + $headerParams['idempotency-key'] = ObjectSerializer::toHeaderValue($idempotency_key); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_refund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_refund)); + } else { + $httpBody = $create_refund; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAllRefunds + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllRefunds'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Refund\RefundList|Xendit\Refund\CreateRefundDefaultResponse + */ + public function getAllRefunds(string $contentType = self::contentTypes['getAllRefunds'][0]) + { + list($response) = $this->getAllRefundsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getAllRefundsWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllRefunds'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Refund\RefundList|Xendit\Refund\CreateRefundDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllRefundsWithHttpInfo(string $contentType = self::contentTypes['getAllRefunds'][0]) + { + $request = $this->getAllRefundsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Refund\RefundList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\RefundList' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\RefundList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Refund\CreateRefundDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefundDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefundDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Refund\RefundList'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\RefundList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefundDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllRefundsAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllRefunds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllRefundsAsync(string $contentType = self::contentTypes['getAllRefunds'][0]) + { + return $this->getAllRefundsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllRefundsAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllRefunds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllRefundsAsyncWithHttpInfo(string $contentType = self::contentTypes['getAllRefunds'][0]) + { + $returnType = '\Refund\RefundList'; + $request = $this->getAllRefundsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAllRefunds' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllRefunds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllRefundsRequest(string $contentType = self::contentTypes['getAllRefunds'][0]) + { + + + $resourcePath = '/refunds/'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRefund + * + * @param string $refund_id refund_id (required) + * @param string $idempotency_key idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return Xendit\Refund\Refund|Xendit\Refund\CreateRefundDefaultResponse + */ + public function getRefund($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['getRefund'][0]) + { + list($response) = $this->getRefundWithHttpInfo($refund_id, $idempotency_key, $contentType); + return $response; + } + + /** + * Operation getRefundWithHttpInfo + * + * @param string $refund_id (required) + * @param string $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRefund'] to see the possible values for this operation + * + * @throws \Xendit\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of Xendit\Refund\Refund|Xendit\Refund\CreateRefundDefaultResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getRefundWithHttpInfo($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['getRefund'][0]) + { + $request = $this->getRefundRequest($refund_id, $idempotency_key, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('Xendit\Refund\Refund' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\Refund' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\Refund', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('Xendit\Refund\CreateRefundDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('Xendit\Refund\CreateRefundDefaultResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'Xendit\Refund\CreateRefundDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Refund\Refund'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\Refund', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'Xendit\Refund\CreateRefundDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRefundAsync + * + * @param Xenditstring $refund_id (required) + * @param Xenditstring $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRefundAsync($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['getRefund'][0]) + { + return $this->getRefundAsyncWithHttpInfo($refund_id, $idempotency_key, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRefundAsyncWithHttpInfo + * + * @param Xenditstring $refund_id (required) + * @param Xenditstring $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRefundAsyncWithHttpInfo($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['getRefund'][0]) + { + $returnType = '\Refund\Refund'; + $request = $this->getRefundRequest($refund_id, $idempotency_key, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRefund' + * + * @param string $refund_id (required) + * @param string $idempotency_key (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRefund'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRefundRequest($refund_id, $idempotency_key = null, string $contentType = self::contentTypes['getRefund'][0]) + { + + // verify the required parameter 'refund_id' is set + if ($refund_id === null || (is_array($refund_id) && count($refund_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $refund_id when calling getRefund' + ); + } + + + + $resourcePath = '/refunds/{refundID}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header param: idempotency-key + if ($idempotency_key !== null) { + $headerParams['idempotency-key'] = ObjectSerializer::toHeaderValue($idempotency_key); + } + // path params + if ($refund_id !== null) { + $resourcePath = str_replace( + '{' . 'refundID' . '}', + ObjectSerializer::toPathValue($refund_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getApiKey() . ":"); + + $defaultHeaders = []; + + // Xendit's custom headers + $defaultHeaders['xendit-lib'] = 'php'; + $defaultHeaders['xendit-lib-ver'] = '3.0.0-beta.0'; + + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Refund/RefundList.php b/lib/Refund/RefundList.php new file mode 100644 index 0000000..77c1226 --- /dev/null +++ b/lib/Refund/RefundList.php @@ -0,0 +1,439 @@ + + */ +class RefundList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RefundList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Xendit\Refund\Refund[]', + 'has_more' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'has_more' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'has_more' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'has_more' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'has_more' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'has_more' => 'getHasMore' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('has_more', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Refund\Refund[] + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Refund\Refund[] $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets has_more + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool|null $has_more has_more + * + * @return self + */ + public function setHasMore($has_more) + { + if (is_null($has_more)) { + throw new \InvalidArgumentException('non-nullable has_more cannot be null'); + } + $this->container['has_more'] = $has_more; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 5a87887..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - tests - - - - diff --git a/phpunit.xml.bak b/phpunit.xml.bak deleted file mode 100644 index 59e9097..0000000 --- a/phpunit.xml.bak +++ /dev/null @@ -1,15 +0,0 @@ - - - - tests - - - - - src - - - - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..485899a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./lib/Api + ./lib/Model + + + + + ./test/Api + ./test/Model + + + + + + diff --git a/src/ApiOperations/Create.php b/src/ApiOperations/Create.php deleted file mode 100644 index ccb5667..0000000 --- a/src/ApiOperations/Create.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\ApiOperations; - -/** - * Trait Create - * - * @category Trait - * @package Xendit\ApiOperations - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -trait Create -{ - /** - * Send a create request - * - * @param array $params user's params - * - * @return array - */ - public static function create($params = []) - { - self::validateParams($params, static::createReqParams()); - - $url = static::classUrl(); - - return static::_request('POST', $url, $params); - } -} diff --git a/src/ApiOperations/Request.php b/src/ApiOperations/Request.php deleted file mode 100644 index ca1f103..0000000 --- a/src/ApiOperations/Request.php +++ /dev/null @@ -1,100 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\ApiOperations; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Trait Request - * - * @category Trait - * @package Xendit\ApiOperations - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -trait Request -{ - /** - * Parameters validation - * - * @param array $params user's parameters - * @param array $requiredParams required parameters - * - * @return void - */ - protected static function validateParams($params = [], $requiredParams = []) - { - $currParams = array_diff_key(array_flip($requiredParams), $params); - if ($params && !is_array($params)) { - $message = "You must pass an array as params."; - throw new InvalidArgumentException($message); - } - if (count($currParams) > 0) { - $message = "You must pass required parameters on your params. " - . "Check https://xendit.github.io/apireference/ for more information."; - throw new InvalidArgumentException($message); - } - } - - /** - * Send request to Api Requestor - * - * @param $method string - * @param $url string ext url to the API - * @param $params array parameters - * - * @return array - * @throws \Xendit\Exceptions\ApiException - */ - protected static function _request( - $method, - $url, - $params = [] - ) { - $headers = []; - - if (array_key_exists('for-user-id', $params)) { - $headers['for-user-id'] = $params['for-user-id']; - } - - if (array_key_exists('with-fee-rule', $params)) { - $headers['with-fee-rule'] = $params['with-fee-rule']; - } - - if (array_key_exists('Idempotency-key', $params)) { - $headers['Idempotency-key'] = $params['Idempotency-key']; - } - - if (array_key_exists('X-IDEMPOTENCY-KEY', $params)) { - $headers['X-IDEMPOTENCY-KEY'] = $params['X-IDEMPOTENCY-KEY']; - } - - if (array_key_exists('xendit-idempotency-key', $params)) { - $headers['xendit-idempotency-key'] = $params['xendit-idempotency-key']; - } - - if (array_key_exists('api-version', $params)) { - $headers['api-version'] = $params['api-version']; - unset($params['api-version']); - } - - if (array_key_exists('X-API-VERSION', $params)) { - $headers['X-API-VERSION'] = $params['X-API-VERSION']; - } - - $requestor = new \Xendit\ApiRequestor(); - return $requestor->request($method, $url, $params, $headers); - } -} diff --git a/src/ApiOperations/Retrieve.php b/src/ApiOperations/Retrieve.php deleted file mode 100644 index 65d06ad..0000000 --- a/src/ApiOperations/Retrieve.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\ApiOperations; - -/** - * Trait Retrieve - * - * @category Trait - * @package Xendit\ApiOperations - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -trait Retrieve -{ - /** - * Send GET request to retrieve data - * - * @param string|null $id ID - * - * @return array - */ - public static function retrieve($id, $params = []) - { - $url = static::classUrl() . '/' . $id; - return static::_request('GET', $url, $params); - } -} diff --git a/src/ApiOperations/RetrieveAll.php b/src/ApiOperations/RetrieveAll.php deleted file mode 100644 index df4f451..0000000 --- a/src/ApiOperations/RetrieveAll.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\ApiOperations; - -/** - * Trait RetrieveAll - * - * @category Trait - * @package Xendit\ApiOperations - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -trait RetrieveAll -{ - /** - * Send request to get all object, e.g Invoice - * - * @return array - */ - public static function retrieveAll($params = []) - { - $url = static::classUrl(); - return static::_request('GET', $url, $params); - } -} diff --git a/src/ApiOperations/Update.php b/src/ApiOperations/Update.php deleted file mode 100644 index 3926032..0000000 --- a/src/ApiOperations/Update.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\ApiOperations; - -/** - * Trait Update - * - * @category Trait - * @package Xendit\ApiOperations - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -trait Update -{ - /** - * Send an update request - * - * @param string $id data ID - * @param array $params user's params - * - * @return array - */ - public static function update($id, $params = []) - { - self::validateParams($params, static::updateReqParams()); - - $url = static::classUrl() . '/' . $id; - - return static::_request('PATCH', $url, $params); - } -} diff --git a/src/ApiRequestor.php b/src/ApiRequestor.php deleted file mode 100644 index 6051dcf..0000000 --- a/src/ApiRequestor.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class ApiRequestor - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class ApiRequestor -{ - private static $_httpClient; - - /** - * Send request and processing response - * - * @param string $method request method (get, post, patch, etc) - * @param string $url base url - * @param array $params user's params - * @param array $headers user's additional headers - * - * @return array - * @throws Exceptions\ApiException - */ - public function request($method, $url, $params = [], $headers = []) - { - list($rbody, $rcode, $rheaders) - = $this->_requestRaw($method, $url, $params, $headers); - - return json_decode($rbody, true); - } - - /** - * Set must-have headers - * - * @param array $headers user's headers - * - * @return array - */ - private function _setDefaultHeaders($headers) - { - $defaultHeaders = []; - $lib = 'php'; - $libVersion = Xendit::getLibVersion(); - - $defaultHeaders['Content-Type'] = 'application/json'; - $defaultHeaders['xendit-lib'] = $lib; - $defaultHeaders['xendit-lib-ver'] = $libVersion; - - return array_merge($defaultHeaders, $headers); - } - - /** - * Send request from client - * - * @param string $method request method - * @param string $url additional url to base url - * @param array $params user's params - * @param array $headers request' headers - * - * @return array - * @throws Exceptions\ApiException - */ - private function _requestRaw($method, $url, $params, $headers) - { - $defaultHeaders = self::_setDefaultHeaders($headers); - - $response = $this->_httpClient()->sendRequest( - $method, - $url, - $defaultHeaders, - $params - ); - - $rbody = $response[0]; - $rcode = $response[1]; - $rheaders = $response[2]; - - return [$rbody, $rcode, $rheaders]; - } - - /** - * Create HTTP CLient - * - * @return HttpClient\GuzzleClient - */ - private function _httpClient() - { - if (!self::$_httpClient) { - self::$_httpClient = HttpClient\GuzzleClient::instance(); - } - return self::$_httpClient; - } - - /** - * GuzzleClient Setter - * - * @param HttpClient\GuzzleClient $client client - * - * @return void - */ - public static function setHttpClient($client) - { - self::$_httpClient = $client; - } -} diff --git a/src/Balance.php b/src/Balance.php deleted file mode 100644 index 3b7acb1..0000000 --- a/src/Balance.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class Balance - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Balance -{ - use ApiOperations\Request; - - /** - * Available account type - * - * @return array - */ - public static function accountType() - { - return ["CASH", "HOLDING", "TAX"]; - } - - /** - * Validation for account type - * - * @param string $account_type Account type - * - * @return void - */ - public static function validateAccountType($account_type = null) - { - if (!in_array($account_type, self::accountType())) { - $msg = "Account type is invalid. Available types: CASH, TAX, HOLDING"; - throw new InvalidArgumentException($msg); - } - } - - /** - * Send GET request to retrieve data - * - * @param string $account_type account type (CASH|HOLDING|TAX) - * - * @return array[ - * 'balance' => int - * ] - * @throws Exceptions\ApiException - */ - public static function getBalance($account_type = null, $params = []) - { - self::validateAccountType($account_type); - $url = '/balance?account_type=' . $account_type; - return static::_request('GET', $url, $params); - } -} diff --git a/src/CardlessCredit.php b/src/CardlessCredit.php deleted file mode 100644 index 139ba57..0000000 --- a/src/CardlessCredit.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class CardlessCredit - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class CardlessCredit -{ - use ApiOperations\Request; - use ApiOperations\Create; - - /** - * Instantiate relative URL - * - * @return string - */ - public static function classUrl() - { - return "/cardless-credit"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return [ - 'cardless_credit_type', - 'external_id', - 'amount', - 'payment_type', - 'items', - 'customer_details', - 'shipping_address', - 'redirect_url', - 'callback_url' - ]; - } - - /** - * Calculate payment types - * - * @param array $params user's parameters - * - * @return array - * - * @throws ApiException - */ - public static function calculatePaymentTypes($params = []) - { - $requiredParams = [ - 'cardless_credit_type', - 'amount', - 'items', - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/payment-types'; - - return static::_request('POST', $url, $params); - } -} diff --git a/src/Cards.php b/src/Cards.php deleted file mode 100644 index 54e12bb..0000000 --- a/src/Cards.php +++ /dev/null @@ -1,143 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Cards - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Cards -{ - use ApiOperations\Request; - use ApiOperations\Retrieve; - use ApiOperations\Create; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/credit_card_charges"; - } - - /** - * Capture charge, see https://xendit.github.io/apireference/?bash#capture-charge - * for more details - * - * @param string $id charge ID - * @param array $params user parameters - * - * @return array [ - * 'created' => string, - * 'status' => string, - * 'business_id' => string, - * 'authorized_amount' => int, - * 'external_id' => string, - * 'merchant_id' => string, - * 'merchant_reference_code' => string, - * 'card_type' => string, - * 'masked_card_number' => string, - * 'charge_type' => string, - * 'card_brand' => string, - * 'bank_reconciliation_id' => string, - * 'capture_amount' => int, - * 'descriptor' => string, - * 'id' => string - * ] - * @throws Exceptions\ApiException - */ - public static function capture($id, $params = []) - { - $url = self::classUrl() . '/' . $id . '/capture'; - $requiredParams = ['amount']; - - self::validateParams($params, $requiredParams); - - return static::_request('POST', $url, $params); - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return ['token_id', 'external_id', 'amount']; - } - - /** - * Reverse authorized charge - * - * @param string $id charge ID - * @param array $params user params - * - * @return array [ - * 'created' => string, - * 'credit_card_charge_id' => string, - * 'external_id' => string, - * 'business_id' => string, - * 'amount' => int, - * 'status' => string, - * 'id' => string - * ] - * @throws Exceptions\ApiException - */ - public static function reverseAuthorization($id, $params = []) - { - $url = self::classUrl() . '/' . $id . '/auth_reversal'; - $requiredParams = ['external_id']; - - self::validateParams($params, $requiredParams); - - return static::_request('POST', $url, $params); - } - - /** - * Create refund, see https://xendit.github.io/apireference/?bash#capture-charge - * for more details - * - * @param string $id charge ID - * @param array $params user parameters - * - * @return array [ - * 'updated' => string, - * 'created' => string, - * 'credit_card_charge_id' => string, - * 'user_id' => string, - * 'amount' => int, - * 'external_id' => string, - * 'status' => 'SUCCEEDED' || 'FAILED', - * 'fee_refund_amount' => int, - * 'id' => string - * ] - * @throws Exceptions\ApiException - */ - public static function createRefund($id, $params = []) - { - $url = self::classUrl() . '/' . $id . '/refunds'; - $requiredParams = ['amount', 'external_id']; - - self::validateParams($params, $requiredParams); - - return static::_request('POST', $url, $params); - } -} diff --git a/src/Customers.php b/src/Customers.php deleted file mode 100644 index 417c46a..0000000 --- a/src/Customers.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class Customers - * - * @category Class - * @package Xendit - * @author Glenda - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Customers -{ - use ApiOperations\Request; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/customers"; - } - - /** - * Send a create customer request - * - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#create-customer - * @throws Exceptions\ApiException - */ - public static function createCustomer($params = []) - { - $requiredParams = ['reference_id']; - - if (array_key_exists('api-version', $params) - && $params['api-version'] == '2020-10-31' - ) { - array_push( - $requiredParams, - 'type', - 'identity_accounts', - 'kyc_documents' - ); - } else { - array_push($requiredParams, 'given_names'); - if (!array_key_exists('mobile_number', $params)) { - array_push($requiredParams, 'email'); - } - - if (!array_key_exists('email', $params)) { - array_push($requiredParams, 'mobile_number'); - } - } - - self::validateParams($params, $requiredParams); - - $url = static::classUrl(); - - return static::_request("POST", $url, $params); - } - - /** - * Get customer by reference ID - * - * @param string $reference_id reference ID - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#get-customer-by-reference-id - * @throws Exceptions\ApiException - */ - public static function getCustomerByReferenceID($reference_id, $params=[]) - { - $url = static::classUrl() - . '?reference_id=' . $reference_id; - - return static::_request('GET', $url, $params); - } -} diff --git a/src/DirectDebit.php b/src/DirectDebit.php deleted file mode 100644 index 7524d1f..0000000 --- a/src/DirectDebit.php +++ /dev/null @@ -1,254 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class DirectDebit - * - * @category Class - * @package Xendit - * @author Glenda - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DirectDebit -{ - use ApiOperations\Request; - - /** - * Instantiate linked account base URL - * - * @return string - */ - public static function linkedAccountUrl() - { - return "/linked_account_tokens/"; - } - - /** - * Instantiate payment method base URL - * - * @return string - */ - public static function paymentMethodUrl() - { - return "/payment_methods"; - } - - /** - * Instantiate direct debit payment base URL - * - * @return string - */ - public static function directDebitPaymentUrl() - { - return "/direct_debits"; - } - - /** - * Send a initialize linked account tokenization request - * - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#initialize-linked-account-tokenization - * @throws Exceptions\ApiException - */ - public static function initializeLinkedAccountTokenization($params = []) - { - $requiredParams = ['customer_id', 'channel_code']; - - self::validateParams($params, $requiredParams); - - $url = static::linkedAccountUrl() . "auth"; - - return static::_request("POST", $url, $params); - } - - /** - * Send a validate OTP for linked account request - * - * @param string $linked_account_token_id linked account token ID - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#validate-otp-for-linked-account-token - * @throws Exceptions\ApiException - */ - public static function validateOTPForLinkedAccount( - $linked_account_token_id, - $params = [] - ) { - $requiredParams = ['otp_code']; - - self::validateParams($params, $requiredParams); - - $url = static::linkedAccountUrl() . $linked_account_token_id . - "/validate_otp"; - - return static::_request("POST", $url, $params); - } - - /** - * Retrieve accessible accounts by linked account token - * - * @param string $linked_account_token_id linked account token ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#retrieve-accessible-accounts-by-linked-account-token - * @throws Exceptions\ApiException - */ - public static function retrieveAccessibleLinkedAccounts($linked_account_token_id) - { - $url = static::linkedAccountUrl() . $linked_account_token_id . "/accounts"; - - return static::_request('GET', $url); - } - - /** - * Unbind linked account token - * - * @param string $linked_account_token_id linked account token ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#unbind-a-linked-account-token - * @throws Exceptions\ApiException - */ - public static function unbindLinkedAccountToken($linked_account_token_id) - { - $url = static::linkedAccountUrl() . $linked_account_token_id; - - return static::_request('DELETE', $url); - } - - /** - * Send a create payment method request - * - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#create-payment-method - * @throws Exceptions\ApiException - */ - public static function createPaymentMethod($params = []) - { - $requiredParams = ['type', 'properties']; - - self::validateParams($params, $requiredParams); - - $url = static::paymentMethodUrl(); - - return static::_request("POST", $url, $params); - } - - /** - * Get payment methods by customer ID - * - * @param string $customer_id customer ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#list-payment-methods - * @throws Exceptions\ApiException - */ - public static function getPaymentMethodsByCustomerID($customer_id) - { - $url = static::paymentMethodUrl() . "?customer_id=" . $customer_id; - - return static::_request('GET', $url); - } - - /** - * Send a create direct debit payment request - * - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#create-direct-debit-payment - * @throws Exceptions\ApiException - */ - public static function createDirectDebitPayment($params = []) - { - $requiredParams = [ - 'reference_id', - 'payment_method_id', - 'currency', - 'amount' - ]; - - self::validateParams($params, $requiredParams); - - $url = static::DirectDebitPaymentUrl(); - - return static::_request("POST", $url, $params); - } - - /** - * Send a validate OTP for direct debit payment - * - * @param string $direct_debit_payment_id direct debit payment ID - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#validate-otp-for-direct-debit-payment - * @throws Exceptions\ApiException - */ - public static function validateOTPForDirectDebitPayment( - $direct_debit_payment_id, - $params = [] - ) { - $requiredParams = ['otp_code']; - - self::validateParams($params, $requiredParams); - - $url = static::directDebitPaymentUrl() . '/' . $direct_debit_payment_id . - "/validate_otp/"; - - return static::_request("POST", $url, $params); - } - - /** - * Get direct debit payment by ID - * - * @param string $direct_debit_payment_id direct debit payment ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#get-payment-by-id - * @throws Exceptions\ApiException - */ - public static function getDirectDebitPaymentByID($direct_debit_payment_id) - { - $url = static::directDebitPaymentUrl() . "/" . $direct_debit_payment_id . - "/"; - - return static::_request('GET', $url); - } - - /** - * Get direct debit payment by reference ID - * - * @param string $reference_id reference ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#get-payment-by-reference-id - * @throws Exceptions\ApiException - */ - public static function getDirectDebitPaymentByReferenceID($reference_id) - { - $url = static::directDebitPaymentUrl() . "?reference_id=" . $reference_id; - - return static::_request('GET', $url); - } -} diff --git a/src/DisbursementChannels.php b/src/DisbursementChannels.php deleted file mode 100644 index 9f3a0d9..0000000 --- a/src/DisbursementChannels.php +++ /dev/null @@ -1,127 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class DisbursementChannels - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DisbursementChannels -{ - - use ApiOperations\Request; - use ApiOperations\Retrieve; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return '/disbursement-channels'; - } - - /** - * Send GET request to Get Disbursement Channels - * - * @param none - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ], [ - * 'channel_code'=> 'PH_CITI', - * 'name'=> 'Citibank, N.A.', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 1, - * 'maximum'=> 999999999, - * 'minimum_increment'=> 1 - * ]] - * @throws Exceptions\ApiException - */ - public static function getDisbursementChannels() - { - $url = '/disbursement-channels'; - return static::_request('GET', static::classUrl()); - } - - /** - * Send GET request to Get Disbursement Channels by Channel Category - * - * @param string $channel_category channel category - * @param array $params extra parameters - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ], [ - * 'channel_code'=> 'PH_CITI', - * 'name'=> 'Citibank, N.A.', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 1, - * 'maximum'=> 999999999, - * 'minimum_increment'=> 1 - * ]] - * @throws Exceptions\ApiException - */ - public static function getDisbursementChannelsByChannelCategory($channel_category, $params = []) - { - $url = static::classUrl() . '?channel_category=' . $channel_category; - return static::_request('GET', $url, $params); - } - - /** - * Send GET request to Get Disbursement Channels by Channel Code - * - * @param string $channel_code channel Code - * @param array $params extra parameters - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ]] - * @throws Exceptions\ApiException - */ - public static function getDisbursementChannelsByChannelCode($channel_code, $params = []) - { - $url = static::classUrl() . '?channel_code=' . $channel_code; - return static::_request('GET', $url, $params); - } -} diff --git a/src/Disbursements.php b/src/Disbursements.php deleted file mode 100644 index 57bc66a..0000000 --- a/src/Disbursements.php +++ /dev/null @@ -1,148 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Disbursements - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Disbursements -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return '/disbursements'; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return [ - 'external_id', - 'bank_code', - 'account_holder_name', - 'account_number', - 'description', - 'amount' - ]; - } - - /** - * Send a create batch request - * - * @param array $params user's params - * - * @return array[ - * 'created'=> string, - * 'reference'=> string, - * 'total_uploaded_amount'=> int, - * 'total_uploaded_count'=> int, - * 'status'=> 'NEEDS_APPROVAL', - * 'id'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function createBatch($params = []) - { - $requiredParams = ['reference', 'disbursements']; - - self::validateParams($params, $requiredParams); - - $url = '/batch_disbursements'; - - return static::_request('POST', $url, $params); - } - - /** - * Send GET request to retrieve data by external id - * - * @param string $external_id external id - * - * @return array[ - * [ - * 'user_id'=> '5785e6334d7b410667d355c4', - * 'external_id'=> 'disbursement_12345', - * 'amount'=> 500000, - * 'bank_code'=> 'BCA', - * 'account_holder_name'=> 'Rizky', - * 'disbursement_description'=> 'Custom description', - * 'status'=> 'PENDING', - * 'id'=> '57c9010f5ef9e7077bcb96b6' - * ],[ - * 'user_id'=> '5785e6334d7b410667d355c4', - * 'external_id'=> 'disbursement_12345', - * 'amount'=> 450000, - * 'bank_code'=> 'BNI', - * 'account_holder_name'=> 'Jajang', - * 'disbursement_description'=> 'Custom description', - * 'status'=> 'COMPLETED', - * 'id'=> '5a963089fd5fe5b6508f0b7b', - * 'email_to'=> ['test+to1@xendit.co','test+to2@xendit.co'], - * 'email_cc'=> ['test+bcc@xendit.co'], - * 'email_bcc'=> ['test+bcc@xendit.co'] - * ] - * ] - * @throws Exceptions\ApiException - */ - public static function retrieveExternal($external_id, $params = []) - { - $url = static::classUrl() . '?external_id=' . $external_id; - return static::_request('GET', $url, $params); - } - - /** - * Send GET request to retrieve available banks - * - * @return array[ - * [ - * 'name'=> 'Bank Mandiri', - * 'code'=> 'MANDIRI', - * 'can_disburse'=> true, - * 'can_name_validate'=> true - * ],[ - * 'name'=> 'Bank Rakyat Indonesia (BRI)', - * 'code'=> 'BRI', - * 'can_disburse'=> true, - * 'can_name_validate'=> true - * ],[ - * 'name'=> 'Bank Central Asia (BCA)', - * 'code'=> 'BCA', - * 'can_disburse'=> true, - * 'can_name_validate'=> true - * ]] - * @throws Exceptions\ApiException - */ - public static function getAvailableBanks() - { - $url = '/available_disbursements_banks'; - return static::_request('GET', $url); - } -} diff --git a/src/DisbursementsPHP.php b/src/DisbursementsPHP.php deleted file mode 100644 index 9d9e6b4..0000000 --- a/src/DisbursementsPHP.php +++ /dev/null @@ -1,199 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use InvalidArgumentException; - -/** - * Class DisbursementsPHP - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DisbursementsPHP -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return '/disbursements'; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createPHPReqParams() - { - return [ - 'xendit-idempotency-key', - 'reference_id', - 'currency', - 'channel_code', - 'account_name', - 'account_number', - 'description', - 'amount' - ]; - } - - /** - * Optional params for beneficiary - * - * @return array - */ - public static function beneficiaryReqParams() - { - return [ - 'type', - 'given_names', - 'middle_name', - 'surname', - 'business_name', - 'street_line1', - 'street_line2', - 'city', - 'province', - 'state', - 'country', - 'zip_code', - 'mobile_number', - 'phone_number', - 'email', - ]; - } - - /** - * Optional params for receipt Notification - * - * @return array - */ - public static function receiptNotificationReqParams() - { - return [ - 'email_to', - 'email_cc', - 'email_bcc' - ]; - } - - /** - * Send POST request to create disbursement - * @param array $params required parameters - * - * @return array[ - * [ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * @throws Exceptions\ApiException - */ - public static function createPHPDisbursement($params = []) - { - self::validateParams($params, static::createPHPReqParams()); - if (array_key_exists('beneficiary', $params)) { - self::validateParams($params['beneficiary'], static::beneficiaryReqParams()); - } - if (array_key_exists('receipt_notification', $params)) { - self::validateParams($params['receipt_notification'], static::receiptNotificationReqParams()); - } - return static::_request('POST', static::classUrl(), $params); - } - - - /** - * Send GET request to get disbursement by id - * - * @param string $disbursement_id disbursement id - * @param array $params extra parameters - * - * @return array[ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * @throws Exceptions\ApiException - */ - public static function getPHPDisbursementByID($disbursement_id, $params = []) - { - $url = static::classUrl() . '/' . $disbursement_id; - return static::_request('GET', $url, $params); - } - - /** - * Send GET request to get disbursement by reference_id - * - * @param string $reference_id reference_id id - * @param array $params extra parameters - * - * @return array[ - * [ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float, - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * ], [ - * 'id'=> 'disb-random-id-2', - * 'reference_id'=> 'random-id-2', - * 'currency'=> 'PHP', - * 'amount'=> float, - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * ]] - * @throws Exceptions\ApiException - */ - public static function getPHPDisbursementsByReferenceID($reference_id, $params = []) - { - $url = static::classUrl() . '?reference_id=' . $reference_id; - return static::_request('GET', $url, $params); - } -} diff --git a/src/EWallets.php b/src/EWallets.php deleted file mode 100644 index f21c01a..0000000 --- a/src/EWallets.php +++ /dev/null @@ -1,200 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class EWallets - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class EWallets -{ - use ApiOperations\Request; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/ewallets"; - } - - /** - * Send a create request - * - * @param array $params user's parameters - * - * @return array please check for responses for each e-wallet type - * https://xendit.github.io/apireference/?bash#create-payment - * @throws Exceptions\ApiException - */ - public static function create($params = []) - { - $requiredParams = []; - - if (!array_key_exists('ewallet_type', $params)) { - $message = 'Please specify ewallet_type inside your parameters.'; - throw new InvalidArgumentException($message); - } - - if ($params['ewallet_type'] === 'OVO') { - $requiredParams = ['external_id', 'amount', 'phone']; - } elseif ($params['ewallet_type'] === 'DANA') { - $requiredParams = ['external_id', 'amount', - 'callback_url', 'redirect_url']; - } elseif ($params['ewallet_type'] === 'LINKAJA') { - $requiredParams = ['external_id', 'amount', 'phone', - 'items', 'callback_url', 'redirect_url']; - } - - self::validateParams($params, $requiredParams); - - $url = static::classUrl(); - - return static::_request('POST', $url, $params); - } - - /** - * Get Payment Status - * - * @param string $external_id external ID - * @param string $ewallet_type E-wallet type (OVO, DANA, LINKAJA - * - * @return array please check for responses for each e-wallet type - * https://xendit.github.io/apireference/?bash#get-payment-status - * @throws Exceptions\ApiException - */ - public static function getPaymentStatus($external_id, $ewallet_type) - { - $url = static::classUrl() - . '?external_id=' . $external_id - . '&ewallet_type=' . $ewallet_type; - - return static::_request('GET', $url); - } - - /** - * Send a create e-wallet charge request - * - * @param array $params user's parameters - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#create-ewallet-charge - * @throws Exceptions\ApiException - */ - public static function createEWalletCharge($params = []) - { - $requiredParams = ['reference_id', 'currency', 'amount', 'checkout_method']; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/charges'; - - return static::_request("POST", $url, $params); - } - - /** - * Get e-wallet charge status - * - * @param string $charge_id charge ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/?bash#get-ewallet-charge-status - * @throws Exceptions\ApiException - */ - public static function getEWalletChargeStatus($charge_id, $params=[]) - { - $url = static::classUrl() - . '/charges/' . $charge_id; - - return static::_request('GET', $url, $params); - } - - /** - * Void eWallet Charge - * - * @param string $charge_id charge ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/#void-ewallet-charge - * @throws Exceptions\ApiException - */ - public static function voidEwalletCharge($charge_id, $params=[]) - { - $url = static::classUrl() - . '/charges/' . $charge_id.'/void'; - - return static::_request('POST', $url, $params); - } - - /** - * Refund eWallet Charge - * - * @param string $charge_id charge ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/#refund-ewallet-charge - * @throws Exceptions\ApiException - */ - public static function refundEwalletCharge($charge_id, $params=[]) - { - $url = static::classUrl() - . '/charges/' . $charge_id.'/refunds'; - - return static::_request('POST', $url, $params); - } - - /** - * Get eWallet Refund by Refund ID - * - * @param string $charge_id charge ID - * @param string $refund_id refund ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/#refund-ewallet-charge - * @throws Exceptions\ApiException - */ - public static function getRefund($charge_id, $refund_id, $params=[]) - { - $url = static::classUrl() - . '/charges/' . $charge_id.'/refunds/'.$refund_id; - - return static::_request('GET', $url, $params); - } - - /** - * Get eWallet Refund by Refund ID - * - * @param string $charge_id charge ID - * - * @return array please check for responses parameters here - * https://developers.xendit.co/api-reference/#refund-ewallet-charge - * @throws Exceptions\ApiException - */ - public static function listRefund($charge_id, $params=[]) - { - $url = static::classUrl() - . '/charges/' . $charge_id.'/refunds/'; - - return static::_request('GET', $url, $params); - } -} diff --git a/src/Exceptions/ApiException.php b/src/Exceptions/ApiException.php deleted file mode 100644 index 2f3f950..0000000 --- a/src/Exceptions/ApiException.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\Exceptions; - -/** - * Class ApiException - * - * @category Exception - * @package Xendit\Exceptions - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class ApiException extends \Exception implements ExceptionInterface -{ - protected $errorCode; - - /** - * Get error code for the exception instance - * - * @return string - */ - public function getErrorCode() - { - return $this->errorCode; - } - - /** - * Create new instance of ApiException - * - * @param string $message corresponds to message field in Xendit's HTTP error - * @param string $code corresponds to http status in Xendit's HTTP response - * @param string $errorCode corresponds to error_code field in Xendit's HTTP - * error - */ - public function __construct($message, $code, $errorCode) - { - if (!$message) { - throw new $this('Unknown '. get_class($this)); - } - parent::__construct($message, $code); - $this->errorCode = $errorCode; - } -} diff --git a/src/Exceptions/ExceptionInterface.php b/src/Exceptions/ExceptionInterface.php deleted file mode 100644 index ed96fb8..0000000 --- a/src/Exceptions/ExceptionInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\Exceptions; - -/** - * Interface ExceptionInterface - * - * @category Interface - * @package Xendit\Exception - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -interface ExceptionInterface extends \Throwable -{ - /** - * Get error code for the exception instance - * - * @return string - */ - public function getErrorCode(); -} diff --git a/src/Exceptions/InvalidArgumentException.php b/src/Exceptions/InvalidArgumentException.php deleted file mode 100644 index 155f694..0000000 --- a/src/Exceptions/InvalidArgumentException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\Exceptions; - -/** - * Class InvalidArgumentException - * - * @category Exception - * @package Xendit\Exceptions - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class InvalidArgumentException - extends \InvalidArgumentException -{ -} diff --git a/src/HttpClient/ClientInterface.php b/src/HttpClient/ClientInterface.php deleted file mode 100644 index de4049d..0000000 --- a/src/HttpClient/ClientInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\HttpClient; - -use Xendit\Exceptions\ApiException; - -/** - * Interface ClientInterface - * - * @category Interface - * @package Xendit\HttpClient - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -interface ClientInterface -{ - /** - * Create a request to execute in _executeRequest - * - * @param string $method request method - * @param string $url url - * @param array $defaultHeaders request headers - * @param array $params parameters - * - * @return array - * @throws ApiException - */ - public function sendRequest($method, - string $url, - array $defaultHeaders, - $params - ); -} diff --git a/src/HttpClient/GuzzleClient.php b/src/HttpClient/GuzzleClient.php deleted file mode 100644 index 81d1179..0000000 --- a/src/HttpClient/GuzzleClient.php +++ /dev/null @@ -1,173 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit\HttpClient; - -use GuzzleHttp\Client as Guzzle; -use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\RequestOptions; -use Xendit\Exceptions\ApiException; -use Xendit\Xendit; - -/** - * Class GuzzleClient - * - * @category Class - * @package Xendit\HttpClient - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class GuzzleClient implements ClientInterface -{ - private static $_instance; - - protected $http; - - /** - * XenditClient constructor - */ - public function __construct() - { - if (Xendit::getHttpClient()) { - $this->http = Xendit::getHttpClient(); - } else { - $baseUri = strval(Xendit::$apiBase); - $this->http = new Guzzle( - [ - 'base_uri' => $baseUri, - 'verify' => false, - 'timeout' => 60 - ] - ); - } - } - - /** - * Create Client instance - * - * @return GuzzleClient - */ - public static function instance() - { - if (!self::$_instance) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * Create a request to execute in _executeRequest - * - * @param string $method request method - * @param string $url url - * @param array $defaultHeaders request headers - * @param array $params parameters - * - * @return array - * @throws ApiException - */ - public function sendRequest($method, string $url, array $defaultHeaders, $params) - { - $method = strtoupper($method); - - $opts = []; - - $opts['method'] = $method; - $opts['headers'] = $defaultHeaders; - $opts['params'] = $params; - - $response = $this->_executeRequest($opts, $url); - - $rbody = $response[0]; - $rcode = $response[1]; - $rheader = $response[2]; - - return [$rbody, $rcode, $rheader]; - } - - /** - * Execute request - * - * @param array $opts request options (headers, params) - * @param string $url request url - * - * @return array - * @throws ApiException - */ - private function _executeRequest(array $opts, string $url) - { - $headers = $opts['headers']; - $params = $opts['params']; - $apiKey = Xendit::$apiKey; - $url = strval($url); - try { - if (count($params) > 0) { - $isQueryParam = isset($params['query-param']) && $params['query-param'] === 'true'; // additional condition to check if the requestor is imposing query param, otherwise default json - - if($isQueryParam) unset($params['query-param']); - - $response = $this->http->request( - $opts['method'], $url, [ - 'auth' => [$apiKey, ''], - 'headers' => $headers, - $isQueryParam ? RequestOptions::QUERY : RequestOptions::JSON => $params - ] - ); - } else { - $response = $this->http->request( - $opts['method'], $url, [ - 'auth' => [$apiKey, ''], - 'headers' => $headers - ] - ); - } - } catch (RequestException $e) { - $response = $e->getResponse(); - $rbody = json_decode($response->getBody()->getContents(), true); - $rcode = $response->getStatusCode(); - $rheader = $response->getHeaders(); - - self::_handleAPIError( - array('body' => $rbody, - 'code' => $rcode, - 'header' => $rheader) - ); - } - - $rbody = $response->getBody(); - $rcode = (int) $response->getStatusCode(); - $rheader = $response->getHeaders(); - - return [$rbody, $rcode, $rheader]; - } - - /** - * Handles API Error - * - * @param array $response response from GuzzleClient - * - * @return void - * @throws ApiException - */ - private static function _handleAPIError($response) - { - $rbody = $response['body']; - - $rhttp = strval($response['code']); - $message = $rbody['message']; - $rcode = $rbody['error_code']; - - throw new ApiException($message, $rhttp, $rcode); - } -} diff --git a/src/HttpClientInterface.php b/src/HttpClientInterface.php deleted file mode 100644 index 1e7a74b..0000000 --- a/src/HttpClientInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://github.com/xendit/xendit-php/blob/master/src/HttpClientInterface.php - */ - -namespace Xendit; - - -/** - * Interface HttpClientInterface - * - * @category Interface - * @package Xendit - * @author Stanley Nguyen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://github.com/xendit/xendit-php/blob/master/src/HttpClientInterface.php - */ -interface HttpClientInterface -{ - /** - * Create and send an HTTP request. - * - * Use an absolute path to override the base path of the client, or a - * relative path to append to the base path of the client. The URL can - * contain the query string as well. - * - * @param string $method HTTP method. - * @param string|UriInterface $uri URI object or string. - * @param array $options Request options to apply. - * - * @return ResponseInterface - * @throws GuzzleException - */ - public function request($method, $uri, array $options = []); -} \ No newline at end of file diff --git a/src/Invoice.php b/src/Invoice.php deleted file mode 100644 index 2a9c3ea..0000000 --- a/src/Invoice.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Invoice - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Invoice -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\RetrieveAll; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/v2/invoices"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return ['external_id', 'amount']; - } - - /** - * Expire Invoice - * - * @param string $id Invoice ID - * - * @return array[ - * 'id'=> string, - * 'user_id'=> string, - * 'external_id'=> string, - * 'status'=> 'EXPIRED', - * 'merchant_name'=> string, - * 'merchant_profile_picture_url'=> string, - * 'amount'=> int, - * 'payer_email'=> string, - * 'description'=> string, - * 'invoice_url'=> string, - * 'expiry_date'=> string, - * 'available_banks'=> array, - * 'should_exclude_credit_card'=> bool, - * 'should_send_email'=> bool, - * 'created'=> string, - * 'updated'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function expireInvoice($id, $params=[]) - { - $url = '/invoices/' . $id . '/expire!'; - - return static::_request('POST', $url, $params); - } -} diff --git a/src/PayLater.php b/src/PayLater.php deleted file mode 100644 index b19c3ec..0000000 --- a/src/PayLater.php +++ /dev/null @@ -1,175 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; -use Xendit\Exceptions\ApiException; - -/** - * Class PayLater - * - * @category Class - * @package Xendit - * @author Asoka Wotulo - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PayLater -{ - use ApiOperations\Request; - - /** - * Instantiate relative URL - * - * @return string - */ - public static function classUrl() - { - return "/paylater"; - } - - /** - * Retrieve list of PayLater plans - * - * @param array $params - * @return array - * @throws InvalidArgumentException - * @throws ApiException - */ - public static function initiatePayLaterPlans($params = []) - { - $requiredParams = [ - 'customer_id', - 'channel_code', - 'currency', - 'amount', - 'order_items', - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/plans'; - - return static::_request('POST', $url, $params); - } - - /** - * Create PayLater transaction / generate checkout URL - * - * @param array $params - * @return array - * @throws InvalidArgumentException - * @throws ApiException - */ - public static function createPayLaterCharge($params = []) - { - $requiredParams = [ - 'plan_id', - 'reference_id', - 'checkout_method', - 'success_redirect_url', - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/charges'; - - return static::_request('POST', $url, $params); - } - - /** - * Get PayLater Charge by ID - * - * @param string $id - * @param array $params - * @return array - * @throws InvalidArgumentException - * @throws ApiException - */ - public static function getPayLaterChargeStatus($id, $params = []) - { - $requiredParams = [ - - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/charges/'.$id; - - return static::_request('GET', $url, $params); - } - - /** - * Create Paylater Refund - * - * @param string $id - * @param array $params - * @return array - * @throws InvalidArgumentException - * @throws ApiException - */ - public static function createPayLaterRefund($id, $params = []) - { - $requiredParams = [ - - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/charges/'.$id.'/refunds'; - - return static::_request('POST', $url, $params); - } - - /** - * Get Refund by Refund ID - * - * @param string $charge_id - * @param string $refund_id - * @param array $params - * @return array - * @throws InvalidArgumentException - * @throws ApiException - */ - public static function getPayLaterRefund($charge_id, $refund_id, $params = []) - { - $requiredParams = [ - - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl() . '/charges/'.$charge_id.'/refunds/'.$refund_id; - - return static::_request('GET', $url, $params); - } - - /** - * List Paylater Refunds - * - * @param array $params Paylater Refunds params - * - * @return array - * https://developers.xendit.co/api-reference/#list-paylater-refunds - * @throws Exceptions\ApiException - */ - public static function listPayLaterRefund($charge_id, $params = []) - { - $url = static::classUrl() . '/charges/'.$charge_id.'/refunds/'; - - return static::_request('GET', $url, $params); - } - - -} diff --git a/src/PaymentChannels.php b/src/PaymentChannels.php deleted file mode 100644 index 7ecb807..0000000 --- a/src/PaymentChannels.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class PaymentChannels - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PaymentChannels -{ - use ApiOperations\Request; - - /** - * Payment channel list - * - * @return array - * https://developers.xendit.co/api-reference/#get-payment-channels - * @throws Exceptions\ApiException - * * GetPaymentChannels is in maintenance mode. Existing behavior on the endpoint will continue to work as before, but newer channels will be missing from the returned result. - */ - public static function list() - { - $url = '/payment_channels'; - - return static::_request('GET', $url); - } -} diff --git a/src/Payouts.php b/src/Payouts.php deleted file mode 100644 index 55ccab6..0000000 --- a/src/Payouts.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Payouts - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Payouts -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - - /** - * Instantiate relative URL - * - * @return string - */ - public static function classUrl() - { - return "/payouts"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return ['external_id', 'amount', 'email']; - } - - /** - * Void a payout - * - * @param string $id payout ID - * - * @return array[ - * 'id'=> string, - * 'external_id'=> string, - * 'amount'=> int, - * 'merchant_name'=> string, - * 'status'=> 'ISSUED' || 'DISBURSING' || 'VOIDED' || 'LOCKED' - * || 'COMPLETED' || 'FAILED', - * 'expiration_timestamp'=> string, - * 'created'=> string', - * 'email'=> string, - * 'payout_url'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function void($id) - { - $url = static::classUrl() . '/' . $id . '/void'; - - return static::_request('POST', $url); - } -} diff --git a/src/PayoutsNew.php b/src/PayoutsNew.php deleted file mode 100644 index 04155f5..0000000 --- a/src/PayoutsNew.php +++ /dev/null @@ -1,182 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PayoutsNew -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl(): string - { - return '/v2/payouts'; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams(): array - { - return [ - 'reference_id', - 'channel_code', - 'channel_properties', - 'amount', - 'description', - 'currency', - 'receipt_notification', - 'metadata' - ]; - } - - /** - * Send GET request to retrieve data by reference id - * - * @param $referenceId - * @param array $params - * - * @return array[ - * [ - * 'id' => 'disb-1475459775872', - * 'amount' => 100, - * 'channel_code' => 'ID_BCA', - * 'currency' => 'IDR', - * 'description' => 'Sample Failed Create Payout', - * 'estimated_arrival_time' => '2022-01-05T06:09:23.667Z', - * 'failure_code' => 'TEMPORARY_TRANSFER_ERROR', - * 'reference_id' => 'sample-failed-create-payout', - * 'status' => 'FAILED', - * 'created' => '2022-01-05T05:54:23.670Z', - * 'updated' => '2022-01-05T05:54:35.680Z', - * 'business_id' => '5785e6334d7b410667d355c4', - * 'channel_properties' => [ - * 'account_number' => '123456', - * 'account_holder_name' => 'Test', - * ], - * ], - * [ - * 'id' => 'disb-567845975142', - * 'amount' => 200, - * 'channel_code' => 'ID_BCA', - * 'currency' => 'IDR', - * 'description' => 'Sample Failed Create Payout2', - * 'estimated_arrival_time' => '2022-01-05T06:14:23.667Z', - * 'failure_code' => 'TEMPORARY_TRANSFER_ERROR', - * 'reference_id' => 'sample-failed-create-payout2', - * 'status' => 'FAILED', - * 'created' => '2022-01-05T05:58:23.670Z', - * 'updated' => '2022-01-05T05:58:35.680Z', - * 'business_id' => '5785e6334d7b410667d355c4', - * 'channel_properties' => [ - * 'account_number' => '123456', - * 'account_holder_name' => 'Test', - * ], - * ], - * ] - * @throws \Xendit\Exceptions\ApiException - */ - public static function retrieveReference($referenceId, array $params = []) - { - $url = static::classUrl() . '?reference_id=' . $referenceId; - return static::_request('GET', $url, $params); - } - - /** - * Send GET request to retrieve available payouts channels - * - * @return array [ - * [ - * 'channel_code' => 'ID_BSI', - * 'channel_category' => 'BANK', - * 'currency' => 'IDR', - * 'channel_name' => 'Bank Syariah Indonesia', - * 'amount_limits' => [ - * 'minimum' => 10000, - * 'maximum' => 1999999999999, - * 'minimum_increment' => 1, - * ], - * ], - * [ - * 'channel_code' => 'PH_AUB', - * 'channel_category' => 'BANK', - * 'currency' => 'PHP', - * 'channel_name' => 'Asia United Bank', - * 'amount_limits' => [ - * 'minimum' => 1, - * 'maximum' => 100000000, - * 'minimum_increment' => 1, - * ], - * ], - * ] - * @throws Exceptions\ApiException - */ - public static function getPayoutsChannels() - { - $url = '/payouts_channels'; - return static::_request('GET', $url); - } - - /** - * @return array[ - * [ - * 'id' => 'disb-1475459775872', - * 'amount' => 100, - * 'channel_code' => 'ID_BCA', - * 'currency' => 'IDR', - * 'description' => 'Sample Failed Create Payout', - * 'estimated_arrival_time' => '2022-01-05T06:09:23.667Z', - * 'failure_code' => 'TEMPORARY_TRANSFER_ERROR', - * 'reference_id' => 'sample-failed-create-payout', - * 'status' => 'FAILED', - * 'created' => '2022-01-05T05:54:23.670Z', - * 'updated' => '2022-01-05T05:54:35.680Z', - * 'business_id' => '5785e6334d7b410667d355c4', - * 'channel_properties' => [ - * 'account_number' => '123456', - * 'account_holder_name' => 'Test', - * ], - * ], - * [ - * 'id' => 'disb-567845975142', - * 'amount' => 200, - * 'channel_code' => 'ID_BCA', - * 'currency' => 'IDR', - * 'description' => 'Sample Failed Create Payout2', - * 'estimated_arrival_time' => '2022-01-05T06:14:23.667Z', - * 'failure_code' => 'TEMPORARY_TRANSFER_ERROR', - * 'reference_id' => 'sample-failed-create-payout2', - * 'status' => 'FAILED', - * 'created' => '2022-01-05T05:58:23.670Z', - * 'updated' => '2022-01-05T05:58:35.680Z', - * 'business_id' => '5785e6334d7b410667d355c4', - * 'channel_properties' => [ - * 'account_number' => '123456', - * 'account_holder_name' => 'Test', - * ], - * ], - * ] - * @throws \Xendit\Exceptions\ApiException - */ - public static function cancel(string $id) - { - $url = static::classUrl() . '/' . $id . '/cancel'; - return static::_request('GET', $url); - } -} diff --git a/src/Platform.php b/src/Platform.php deleted file mode 100644 index 043634a..0000000 --- a/src/Platform.php +++ /dev/null @@ -1,213 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class Platform - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Platform -{ - use ApiOperations\Request; - - /** - * Available account type - * - * @return array - */ - public static function accountType() - { - return ["MANAGED", "OWNED"]; - } - - /** - * Available unit route - * - * @return array - */ - public static function unitRoute() - { - return ["percent", "flat"]; - } - - /** - * Validation for account type - * - * @param string $account_type Account type - * - * @return void - */ - public static function validateAccountType($account_type = null) - { - if (!in_array($account_type, self::accountType())) { - $msg = "Account type is invalid. Available types: MANAGED, OWNED"; - throw new InvalidArgumentException($msg); - } - } - - /** - * Validation for unit route - * - * @param string $unit unit route - * - * @return void - */ - public static function validateUnitRoute($unit = null) - { - if (!in_array($unit, self::unitRoute())) { - $msg = "Unit value is invalid. Available values: percent, flat"; - throw new InvalidArgumentException($msg); - } - } - - /** - * Create account - * - * @param array $params user params - * - * @return array - * https://developers.xendit.co/api-reference/#create-account - * @throws Exceptions\ApiException - */ - public static function createAccount($params = []) - { - $requiredParams = ['email', 'type']; - - self::validateParams($params, $requiredParams); - self::validateAccountType($params['type']); - - $url = '/v2/accounts'; - - return static::_request('POST', $url, $params); - } - - /** - * Get Account by ID - * - * @param string $account_id - * - * @return array - * https://developers.xendit.co/api-reference/#get-account-by-id - * @throws Exceptions\ApiException - */ - public static function getAccount($account_id) - { - $url = '/v2/accounts/'.$account_id; - - return static::_request('GET', $url); - } - - /** - * Update account - * - * @param string $account_id - * @param array $params user params - * - * @return array - * https://developers.xendit.co/api-reference/#update-account - * @throws Exceptions\ApiException - */ - public static function updateAccount($account_id, $params = []) - { - $requiredParams = ['email']; - - self::validateParams($params, $requiredParams); - - $url = '/v2/accounts/'.$account_id; - - return static::_request('PATCH', $url, $params); - } - - /** - * Create transfer - * - * @param array $params user params - * - * @return array - * https://developers.xendit.co/api-reference/#create-transfers - * @throws Exceptions\ApiException - */ - public static function createTransfer($params = []) - { - $requiredParams = ['reference', 'amount', 'source_user_id', 'destination_user_id']; - - self::validateParams($params, $requiredParams); - - $url = '/transfers'; - - return static::_request('POST', $url, $params); - } - - /** - * Create fee rule - * - * @param array $params user params - * - * @return array - * https://developers.xendit.co/api-reference/#create-fee-rule - * @throws Exceptions\ApiException - */ - public static function createFeeRule($params = []) - { - $requiredParams = ['name', 'unit', 'amount', 'currency']; - - self::validateParams($params, $requiredParams); - self::validateUnitRoute($params['unit']); - - $payload = array(); - $payload['name'] = $params['name']; - if (isset($params['description'])) { - $payload['description'] = $params['description']; - } - $payload['routes'] = [ - array( - 'unit' => $params['unit'], - 'amount' => $params['amount'], - 'currency' => $params['currency'] - ) - ]; - - $url = '/fee_rules'; - - return static::_request('POST', $url, $payload); - } - - /** - * Set Callback URL - * - * @param string $type - * @param array $params user params - * - * @return array - * https://developers.xendit.co/api-reference/#set-callback-urls - * @throws Exceptions\ApiException - */ - public static function setCallbackUrl($type, $params = []) - { - $requiredParams = ['url']; - - self::validateParams($params, $requiredParams); - - $url = '/callback_urls/'.$type; - - return static::_request('POST', $url, $params); - } -} diff --git a/src/Promotion.php b/src/Promotion.php deleted file mode 100644 index 4a9d88c..0000000 --- a/src/Promotion.php +++ /dev/null @@ -1,104 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class Promotion - * - * @category Class - * @package Xendit - * @author Christian - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Promotion -{ - use ApiOperations\Request; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/promotions"; - } - - /** - * Send a create request - * - * Create a Promotion - * - * either promo_code or bin_list is required - * either discount_percent or discount_amount is required - * - * Please refer to this documentation for more detailed info - * https://developers.xendit.co/api-reference/#create-promotion - * - * @param array $params user's parameters - * - * @return array [ - * 'business_id' => string, - * 'currency' => string, - * 'created' => string, - * 'description' => string, - * 'discount_amount' => int, - * 'end_time' => string, - * 'id' => string, - * 'promo_code' => string, - * 'reference_id' => string, - * 'start_time' => string, - * 'status' => string, - * 'type' => string, - * ] - * - * @throws Exceptions\InvalidArgumentException - * - * @throws Exceptions\ApiException if request status code is not 2xx - **/ - public static function create($params = []) - { - if (!array_key_exists('promo_code', $params) - && !array_key_exists('bin_list', $params) - ) { - $message = 'Please specify "promo_code" or "bin_list"' . - 'inside your parameters.'; - throw new InvalidArgumentException($message); - } - - if (!array_key_exists('discount_percent', $params) - && !array_key_exists('discount_amount', $params) - ) { - $message = 'Please specify "discount_percent" or "discount_amount"' . - 'inside your parameters.'; - throw new InvalidArgumentException($message); - } - - $requiredParams = [ - 'reference_id', - 'description', - 'currency', - 'start_time', - 'end_time', - ]; - - self::validateParams($params, $requiredParams); - - $url = static::classUrl(); - - return static::_request('POST', $url, $params); - } -} diff --git a/src/QRCode.php b/src/QRCode.php deleted file mode 100644 index dbe1139..0000000 --- a/src/QRCode.php +++ /dev/null @@ -1,167 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -namespace Xendit; - -use Xendit\Exceptions\ApiException; -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class QRCode - * - * @category Class - * @package Xendit - * @author Dave - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class QRCode -{ - use ApiOperations\Request; - - private static $apiVersion1 = '2020-07-01'; - private static $apiVersion2 = '2022-07-31'; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/qr_codes"; - } - - /** - * Send a create request - * - * Create a QR Code - * Required parameters: - * For API version 2020-07-01: external_id, type, callback_url, amount (only if type = DYNAMIC). - * For API version 2022-07-31: reference_id, type, currency, amount (only if type = DYNAMIC). - * - * To create QR Code for a Xenplatform sub-account, - * include for-user-id in $params - * - * Please refer to this documentation for more detailed info - * https://xendit.github.io/apireference/#create-qr-code - * - * @param array $params user's parameters - * - * @return array [ - * 'id' => string, - * 'external_id' => string, (only for API version 2020-07-01) - * 'callback_url' => string, (only for API version 2020-07-01) - * 'amount' => int, - * 'qr_string' => string, - * 'reference_id' => string, (only for API version 2022-07-31) - * 'currency' => string, (only for API version 2022-07-31) - * 'channel_code' => string, (only for API version 2022-07-31) - * 'expires_at' => date, (only for API version 2022-07-31) - * 'type' => 'DYNAMIC' || 'STATIC', - * 'status' => 'ACTIVE' || 'INACTIVE', - * 'created' => date, - * 'updated' => date, - * ] - * - * @throws InvalidArgumentException if some parameters are missing or invalid - * @throws ApiException if request status code is not 2xx - **/ - public static function create($params = []) - { - if (!array_key_exists('type', $params)) { - $message = 'Please specify "type" inside your parameters.'; - throw new InvalidArgumentException($message); - } - - $requiredParams = ['type']; - - if ($params['type'] === 'DYNAMIC') { - array_push($requiredParams, 'amount'); - } elseif ($params['type'] !== 'STATIC') { - $message = 'Invalid QR Code type'; - throw new InvalidArgumentException($message); - } - - if (array_key_exists('api_version', $params)) { - $params['api-version'] = $params['api_version']; - unset($params['api_version']); - } else { - $params['api-version'] = QRCode::$apiVersion1; - } - - if ($params['api-version'] === QRCode::$apiVersion1) { - array_push($requiredParams, 'external_id', 'callback_url'); - } elseif ($params['api-version'] === QRCode::$apiVersion2) { - array_push($requiredParams, 'reference_id', 'currency'); - - if (array_key_exists('callback_url', $params)) { - $message = 'The API version 2022-07-31 does not support passing callback URL in the request. Please set the callback URL from your Xendit Dashboard instead.'; - throw new InvalidArgumentException($message); - } - } else { - $message = 'Invalid API version'; - throw new InvalidArgumentException($message); - } - - self::validateParams($params, $requiredParams); - - $url = static::classUrl(); - - return static::_request('POST', $url, $params); - } - - /** - * Get QR Code - * - * Get a QR Code detail - * - * Please refer to this documentation for more detailed info - * https://xendit.github.io/apireference/#get-qr-code-by-external-id - * - * @param string $id ID of the QR Code. - * For API Version 2022-07-31, this should be the ID with `qr_` prefix that is returned after creating the QR Code. - * Otherwise, this ID should be the external ID that is provided during the creation of the QR Code. - * @param string|null $api_version The API version. - * Valid values are: - * - 2020-07-01 (default) - * - 2022-07-31 - * - * @return array [ - * 'id' => string, - * 'external_id' => string, (only for API version 2020-07-01) - * 'callback_url' => string, (only for API version 2020-07-01) - * 'amount' => int, - * 'qr_string' => string, - * 'reference_id' => string, (only for API version 2022-07-31) - * 'currency' => string, (only for API version 2022-07-31) - * 'channel_code' => string, (only for API version 2022-07-31) - * 'expires_at' => date, (only for API version 2022-07-31) - * 'type' => 'DYNAMIC' || 'STATIC', - * 'status' => 'ACTIVE' || 'INACTIVE', - * 'created' => date, - * 'updated' => date, - * ] - * - * @throws ApiException - */ - public static function get(string $id, string $api_version = null) - { - $params = []; - if ($api_version !== null) { - $params['api-version'] = $api_version; - } - - $url = static::classUrl(). '/' . $id; - return static::_request('GET', $url, $params); - } -} diff --git a/src/Recurring.php b/src/Recurring.php deleted file mode 100644 index 63eaf5a..0000000 --- a/src/Recurring.php +++ /dev/null @@ -1,164 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Recurring - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Recurring -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\Update; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/recurring_payments"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return [ - 'external_id', - 'payer_email', - 'description', - 'amount', - 'interval', - 'interval_count' - ]; - } - - /** - * Instantiate required params for Update - * - * @return array - */ - public static function updateReqParams() - { - return []; - } - - /** - * Stop a recurring payment - * - * @param string $id recurring payment ID - * - * @return array[ - * 'id'=> string, - * 'user_id'=> string, - * 'external_id'=> string, - * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', - * 'amount'=> int, - * 'payer_email'=> string, - * 'description'=> string, - * 'interval'=> string, - * 'interval_count'=> int, - * 'recurrence_progress'=> int, - * 'should_send_email'=> bool, - * 'missed_payment_action'=> string, - * 'recharge'=> bool, - * 'created'=> string, - * 'updated'=> string, - * 'start_date'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function stop($id) - { - $url = '/recurring_payments/' . $id . '/stop!'; - - return static::_request('POST', $url); - } - - /** - * Pause a recurring payment - * - * @param string $id recurring payment ID - * - * @return array[ - * 'id'=> string, - * 'user_id'=> string, - * 'external_id'=> string, - * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', - * 'amount'=> int, - * 'payer_email'=> string, - * 'description'=> string, - * 'interval'=> string, - * 'interval_count'=> int, - * 'recurrence_progress'=> int, - * 'should_send_email'=> bool, - * 'missed_payment_action'=> string, - * 'recharge'=> bool, - * 'created'=> string, - * 'updated'=> string, - * 'start_date'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function pause($id) - { - $url = '/recurring_payments/' . $id . '/pause!'; - - return static::_request('POST', $url); - } - - /** - * Resume a recurring payment - * - * @param string $id recurring payment ID - * - * @return array[ - * 'id'=> string, - * 'user_id'=> string, - * 'external_id'=> string, - * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', - * 'amount'=> int, - * 'payer_email'=> string, - * 'description'=> string, - * 'interval'=> string, - * 'interval_count'=> int, - * 'recurrence_progress'=> int, - * 'should_send_email'=> bool, - * 'missed_payment_action'=> string, - * 'recharge'=> bool, - * 'created'=> string, - * 'updated'=> string, - * 'start_date'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function resume($id) - { - $url = '/recurring_payments/' . $id . '/resume!'; - - return static::_request('POST', $url); - } -} diff --git a/src/Report.php b/src/Report.php deleted file mode 100644 index 9b492e9..0000000 --- a/src/Report.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Exceptions\InvalidArgumentException; - -/** - * Class Report - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -class Report -{ - use ApiOperations\Request; - - /** - * Available report type - * - * @return array - */ - public static function reportType() - { - return ["BALANCE_HISTORY", "TRANSACTIONS", "UPCOMING_TRANSACTIONS"]; - } - - /** - * Validation for report type - * - * @param string $report_type Report type - * - * @return void - */ - public static function validateReportType($report_type = null) - { - if (!in_array($report_type, self::reportType())) { - $msg = "Report type is invalid. Available types: MANAGED, OWNED"; - throw new InvalidArgumentException($msg); - } - } - - /** - * Generate report - * - * @param array $params reports params - * - * @return array - * https://developers.xendit.co/api-reference/#generate-report - * @throws Exceptions\ApiException - */ - public static function generate($params = []) - { - $requiredParams = ['type']; - - self::validateParams($params, $requiredParams); - self::validateReportType($params['type']); - - $url = '/reports'; - - return static::_request('POST', $url, $params); - } - - /** - * Get report - * - * @param string $report_id - * - * @return array - * https://developers.xendit.co/api-reference/#get-report - * @throws Exceptions\ApiException - */ - public static function detail(string $report_id) - { - $url = '/reports/'.$report_id; - - return static::_request('GET', $url); - } -} diff --git a/src/Retail.php b/src/Retail.php deleted file mode 100644 index 8ec3ca0..0000000 --- a/src/Retail.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Retail - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Retail -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\Update; - - /** - * Instantiate relative URL - * - * @return string - */ - public static function classUrl() - { - return "/fixed_payment_code"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return ['external_id', 'retail_outlet_name', 'name', 'expected_amount']; - } - - /** - * Instantiate required params for Update - * - * @return array - */ - public static function updateReqParams() - { - return []; - } -} diff --git a/src/Transaction.php b/src/Transaction.php deleted file mode 100644 index dd1b222..0000000 --- a/src/Transaction.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class Transaction - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Transaction -{ - use ApiOperations\Request; - - /** - * List transactions - * - * @param array $params transaction params - * - * @return array - * https://developers.xendit.co/api-reference/#get-transaction - * @throws Exceptions\ApiException - */ - public static function list($params = []) - { - $url = '/transactions'; - - return static::_request('GET', $url, $params); - } - - /** - * Get transaction - * - * @param string $transaction_id - * - * @return array - * https://developers.xendit.co/api-reference/#get-transaction - * @throws Exceptions\ApiException - */ - public static function detail(string $transaction_id) - { - $url = '/transactions/'.$transaction_id; - - return static::_request('GET', $url); - } -} diff --git a/src/VirtualAccounts.php b/src/VirtualAccounts.php deleted file mode 100644 index e23f0cd..0000000 --- a/src/VirtualAccounts.php +++ /dev/null @@ -1,102 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class VirtualAccounts - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class VirtualAccounts -{ - use ApiOperations\Request; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\Update; - - /** - * Instantiate base URL - * - * @return string - */ - public static function classUrl() - { - return "/callback_virtual_accounts"; - } - - /** - * Instantiate required params for Create - * - * @return array - */ - public static function createReqParams() - { - return ['external_id', 'bank_code', 'name']; - } - - /** - * Instantiate required params for Update - * - * @return array - */ - public static function updateReqParams() - { - return []; - } - - /** - * Get available VA banks - * - * @return array[ - * 'name' => string, - * 'code' => string - * ] - * @throws Exceptions\ApiException - */ - public static function getVABanks() - { - $url = '/available_virtual_account_banks'; - - return static::_request('GET', $url); - } - - /** - * Get FVA payment - * - * @param string $payment_id payment ID - * - * @return array[ - * 'id'=> string, - * 'payment_id'=> string, - * 'callback_virtual_account_id'=> string, - * 'external_id'=> string, - * 'merchant_code'=> string, - * 'account_number'=> string, - * 'bank_code'=> string, - * 'amount'=> int, - * 'transaction_timestamp'=> string - * ] - * @throws Exceptions\ApiException - */ - public static function getFVAPayment($payment_id) - { - $url = '/callback_virtual_account_payments/payment_id=' . $payment_id; - - return static::_request('GET', $url); - } -} diff --git a/src/Xendit.php b/src/Xendit.php deleted file mode 100644 index 1e1328c..0000000 --- a/src/Xendit.php +++ /dev/null @@ -1,129 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Dotenv\Dotenv; - -/** - * Class Xendit - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class Xendit -{ - public static $apiKey; - - public static $apiBase = 'https://api.xendit.co'; - - public static $libVersion; - - private static $_httpClient; - - const VERSION = "2.18.0"; - - /** - * ApiBase getter - * - * @return string - */ - public static function getApiBase(): string - { - return self::$apiBase; - } - - /** - * ApiBase setter - * - * @param string $apiBase api base url - * - * @return void - */ - public static function setApiBase(string $apiBase): void - { - self::$apiBase = $apiBase; - } - - /** - * Get the value of apiKey - * - * @return string Secret API key - */ - public static function getApiKey() - { - return self::$apiKey; - } - - /** - * Set the value of apiKey - * - * @param string $apiKey Secret API key - * - * @return void - */ - public static function setApiKey($apiKey) - { - self::$apiKey = $apiKey; - } - - /** - * Get library version - * - * @return mixed - */ - public static function getLibVersion() - { - if (self::$libVersion === null) { - self::$libVersion = self::VERSION; - } - return self::$libVersion; - } - - /** - * Set library version - * - * @param string $libVersion library version - * - * @return void - */ - public static function setLibVersion($libVersion = null): void - { - self::$libVersion = $libVersion; - } - - /** - * Set custom http client - * - * @param HttpCLientInterface $client custom http client - * - * @return void - */ - public static function setHttpClient(HttpClientInterface $client): void - { - self::$_httpClient = $client; - } - - /** - * Get current http client being used in the package - * - * @return HttpClientInterface - */ - public static function getHttpClient() - { - return self::$_httpClient; - } -} diff --git a/test/Api/BalanceApiTest.php b/test/Api/BalanceApiTest.php new file mode 100644 index 0000000..c6af759 --- /dev/null +++ b/test/Api/BalanceApiTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/InvoiceApiTest.php b/test/Api/InvoiceApiTest.php new file mode 100644 index 0000000..b0118e7 --- /dev/null +++ b/test/Api/InvoiceApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for expireInvoice + * + * Manually expire an invoice. + * + */ + public function testExpireInvoice() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInvoiceById + * + * Get invoice by invoice id. + * + */ + public function testGetInvoiceById() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getInvoices + * + * Get all Invoices. + * + */ + public function testGetInvoices() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/PaymentMethodApiTest.php b/test/Api/PaymentMethodApiTest.php new file mode 100644 index 0000000..dbe495a --- /dev/null +++ b/test/Api/PaymentMethodApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createPaymentMethod + * + * Creates payment method. + * + */ + public function testCreatePaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for expirePaymentMethod + * + * Expires a payment method. + * + */ + public function testExpirePaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllPaymentChannels + * + * Get all payment channels. + * + */ + public function testGetAllPaymentChannels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllPaymentMethods + * + * Get all payment methods by filters. + * + */ + public function testGetAllPaymentMethods() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPaymentMethodByID + * + * Get payment method by ID. + * + */ + public function testGetPaymentMethodByID() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPaymentsByPaymentMethodId + * + * Returns payments with matching PaymentMethodID.. + * + */ + public function testGetPaymentsByPaymentMethodId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for patchPaymentMethod + * + * Patch payment methods. + * + */ + public function testPatchPaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for simulatePayment + * + * Makes payment with matching PaymentMethodID.. + * + */ + public function testSimulatePayment() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/PaymentRequestApiTest.php b/test/Api/PaymentRequestApiTest.php new file mode 100644 index 0000000..16ec7e2 --- /dev/null +++ b/test/Api/PaymentRequestApiTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for capturePaymentRequest + * + * Payment Request Capture. + * + */ + public function testCapturePaymentRequest() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for createPaymentRequest + * + * Create Payment Request. + * + */ + public function testCreatePaymentRequest() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllPaymentRequests + * + * Get all payment requests by filter. + * + */ + public function testGetAllPaymentRequests() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPaymentRequestByID + * + * Get payment request by ID. + * + */ + public function testGetPaymentRequestByID() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPaymentRequestCaptures + * + * Get Payment Request Capture. + * + */ + public function testGetPaymentRequestCaptures() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for resendPaymentRequestAuth + * + * Payment Request Resend Auth. + * + */ + public function testResendPaymentRequestAuth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/PayoutApiTest.php b/test/Api/PayoutApiTest.php new file mode 100644 index 0000000..0a94053 --- /dev/null +++ b/test/Api/PayoutApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createPayout + * + * API to send money at scale to bank accounts & eWallets. + * + */ + public function testCreatePayout() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPayoutById + * + * API to fetch the current status, or details of the payout. + * + */ + public function testGetPayoutById() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPayoutChannels + * + * API providing the current list of banks and e-wallets we support for payouts for both regions. + * + */ + public function testGetPayoutChannels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getPayouts + * + * API to retrieve all matching payouts with reference ID. + * + */ + public function testGetPayouts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/RefundApiTest.php b/test/Api/RefundApiTest.php new file mode 100644 index 0000000..ccf44be --- /dev/null +++ b/test/Api/RefundApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createRefund + * + * . + * + */ + public function testCreateRefund() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getAllRefunds + * + * . + * + */ + public function testGetAllRefunds() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for getRefund + * + * . + * + */ + public function testGetRefund() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TransactionApiTest.php b/test/Api/TransactionApiTest.php new file mode 100644 index 0000000..32877dc --- /dev/null +++ b/test/Api/TransactionApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTransactionByID + * + * Get a transaction based on its id. + * + */ + public function testGetTransactionByID() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AddressObjectTest.php b/test/Model/AddressObjectTest.php new file mode 100644 index 0000000..7d4e2c5 --- /dev/null +++ b/test/Model/AddressObjectTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line1" + */ + public function testPropertyStreetLine1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line2" + */ + public function testPropertyStreetLine2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "province" + */ + public function testPropertyProvince() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "postal_code" + */ + public function testPropertyPostalCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BadRequestErrorTest.php b/test/Model/BadRequestErrorTest.php new file mode 100644 index 0000000..54ab418 --- /dev/null +++ b/test/Model/BadRequestErrorTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BalanceTest.php b/test/Model/BalanceTest.php new file mode 100644 index 0000000..b558700 --- /dev/null +++ b/test/Model/BalanceTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "balance" + */ + public function testPropertyBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BankCodeTest.php b/test/Model/BankCodeTest.php new file mode 100644 index 0000000..c774b6e --- /dev/null +++ b/test/Model/BankCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BankTest.php b/test/Model/BankTest.php new file mode 100644 index 0000000..17e82dc --- /dev/null +++ b/test/Model/BankTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bank_code" + */ + public function testPropertyBankCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "collection_type" + */ + public function testPropertyCollectionType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bank_branch" + */ + public function testPropertyBankBranch() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bank_account_number" + */ + public function testPropertyBankAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_holder_name" + */ + public function testPropertyAccountHolderName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "transfer_amount" + */ + public function testPropertyTransferAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BillingInformationTest.php b/test/Model/BillingInformationTest.php new file mode 100644 index 0000000..06abe69 --- /dev/null +++ b/test/Model/BillingInformationTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line1" + */ + public function testPropertyStreetLine1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line2" + */ + public function testPropertyStreetLine2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "province_state" + */ + public function testPropertyProvinceState() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "postal_code" + */ + public function testPropertyPostalCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CaptureListResponseTest.php b/test/Model/CaptureListResponseTest.php new file mode 100644 index 0000000..1f4d6c4 --- /dev/null +++ b/test/Model/CaptureListResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CaptureParametersTest.php b/test/Model/CaptureParametersTest.php new file mode 100644 index 0000000..691e8cf --- /dev/null +++ b/test/Model/CaptureParametersTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "capture_amount" + */ + public function testPropertyCaptureAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CaptureTest.php b/test/Model/CaptureTest.php new file mode 100644 index 0000000..0802c45 --- /dev/null +++ b/test/Model/CaptureTest.php @@ -0,0 +1,209 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_request_id" + */ + public function testPropertyPaymentRequestId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_id" + */ + public function testPropertyPaymentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "authorized_amount" + */ + public function testPropertyAuthorizedAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "captured_amount" + */ + public function testPropertyCapturedAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_method" + */ + public function testPropertyPaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_id" + */ + public function testPropertyCustomerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardChannelPropertiesTest.php b/test/Model/CardChannelPropertiesTest.php new file mode 100644 index 0000000..5ba75cd --- /dev/null +++ b/test/Model/CardChannelPropertiesTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "skip_three_d_secure" + */ + public function testPropertySkipThreeDSecure() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardonfile_type" + */ + public function testPropertyCardonfileType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardInformationTest.php b/test/Model/CardInformationTest.php new file mode 100644 index 0000000..27eeaaf --- /dev/null +++ b/test/Model/CardInformationTest.php @@ -0,0 +1,164 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "token_id" + */ + public function testPropertyTokenId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "masked_card_number" + */ + public function testPropertyMaskedCardNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_month" + */ + public function testPropertyExpiryMonth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_year" + */ + public function testPropertyExpiryYear() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardholder_name" + */ + public function testPropertyCardholderName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fingerprint" + */ + public function testPropertyFingerprint() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "network" + */ + public function testPropertyNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "issuer" + */ + public function testPropertyIssuer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardParametersCardInformationTest.php b/test/Model/CardParametersCardInformationTest.php new file mode 100644 index 0000000..039f336 --- /dev/null +++ b/test/Model/CardParametersCardInformationTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_number" + */ + public function testPropertyCardNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_month" + */ + public function testPropertyExpiryMonth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_year" + */ + public function testPropertyExpiryYear() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardholder_name" + */ + public function testPropertyCardholderName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cvv" + */ + public function testPropertyCvv() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardParametersTest.php b/test/Model/CardParametersTest.php new file mode 100644 index 0000000..dd6a37f --- /dev/null +++ b/test/Model/CardParametersTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_information" + */ + public function testPropertyCardInformation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardTest.php b/test/Model/CardTest.php new file mode 100644 index 0000000..6cb621f --- /dev/null +++ b/test/Model/CardTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_information" + */ + public function testPropertyCardInformation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_verification_results" + */ + public function testPropertyCardVerificationResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardVerificationResultsTest.php b/test/Model/CardVerificationResultsTest.php new file mode 100644 index 0000000..5fc8ab2 --- /dev/null +++ b/test/Model/CardVerificationResultsTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure" + */ + public function testPropertyThreeDSecure() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cvv_result" + */ + public function testPropertyCvvResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address_verification_result" + */ + public function testPropertyAddressVerificationResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CardVerificationResultsThreeDSecureTest.php b/test/Model/CardVerificationResultsThreeDSecureTest.php new file mode 100644 index 0000000..b32c358 --- /dev/null +++ b/test/Model/CardVerificationResultsThreeDSecureTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_flow" + */ + public function testPropertyThreeDSecureFlow() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "eci_code" + */ + public function testPropertyEciCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_result" + */ + public function testPropertyThreeDSecureResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_result_reason" + */ + public function testPropertyThreeDSecureResultReason() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_version" + */ + public function testPropertyThreeDSecureVersion() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelAccountTypeTest.php b/test/Model/ChannelAccountTypeTest.php new file mode 100644 index 0000000..ef099d4 --- /dev/null +++ b/test/Model/ChannelAccountTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelAmountLimitsAllOfTest.php b/test/Model/ChannelAmountLimitsAllOfTest.php new file mode 100644 index 0000000..6291244 --- /dev/null +++ b/test/Model/ChannelAmountLimitsAllOfTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_limit" + */ + public function testPropertyMinLimit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_limit" + */ + public function testPropertyMaxLimit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelAmountLimitsTest.php b/test/Model/ChannelAmountLimitsTest.php new file mode 100644 index 0000000..59663c9 --- /dev/null +++ b/test/Model/ChannelAmountLimitsTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_limit" + */ + public function testPropertyMinLimit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_limit" + */ + public function testPropertyMaxLimit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelCategoryTest.php b/test/Model/ChannelCategoryTest.php new file mode 100644 index 0000000..f2a61eb --- /dev/null +++ b/test/Model/ChannelCategoryTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelPropertyAllOfTest.php b/test/Model/ChannelPropertyAllOfTest.php new file mode 100644 index 0000000..df1a87f --- /dev/null +++ b/test/Model/ChannelPropertyAllOfTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_required" + */ + public function testPropertyIsRequired() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelPropertyTest.php b/test/Model/ChannelPropertyTest.php new file mode 100644 index 0000000..0a3cca1 --- /dev/null +++ b/test/Model/ChannelPropertyTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_required" + */ + public function testPropertyIsRequired() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelTest.php b/test/Model/ChannelTest.php new file mode 100644 index 0000000..1e0cf27 --- /dev/null +++ b/test/Model/ChannelTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_category" + */ + public function testPropertyChannelCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_name" + */ + public function testPropertyChannelName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount_limits" + */ + public function testPropertyAmountLimits() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelsCategoriesTest.php b/test/Model/ChannelsCategoriesTest.php new file mode 100644 index 0000000..9c46737 --- /dev/null +++ b/test/Model/ChannelsCategoriesTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateInvoiceRequestTest.php b/test/Model/CreateInvoiceRequestTest.php new file mode 100644 index 0000000..6d5ce18 --- /dev/null +++ b/test/Model/CreateInvoiceRequestTest.php @@ -0,0 +1,263 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "external_id" + */ + public function testPropertyExternalId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payer_email" + */ + public function testPropertyPayerEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "client_type" + */ + public function testPropertyClientType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_duration" + */ + public function testPropertyInvoiceDuration() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "callback_virtual_account_id" + */ + public function testPropertyCallbackVirtualAccountId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_send_email" + */ + public function testPropertyShouldSendEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer" + */ + public function testPropertyCustomer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_notification_preference" + */ + public function testPropertyCustomerNotificationPreference() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_redirect_url" + */ + public function testPropertySuccessRedirectUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_redirect_url" + */ + public function testPropertyFailureRedirectUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_methods" + */ + public function testPropertyPaymentMethods() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mid_label" + */ + public function testPropertyMidLabel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_authenticate_credit_card" + */ + public function testPropertyShouldAuthenticateCreditCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reminder_time" + */ + public function testPropertyReminderTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "local" + */ + public function testPropertyLocal() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reminder_time_unit" + */ + public function testPropertyReminderTimeUnit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "items" + */ + public function testPropertyItems() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fees" + */ + public function testPropertyFees() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreatePaymentMethod409ResponseTest.php b/test/Model/CreatePaymentMethod409ResponseTest.php new file mode 100644 index 0000000..0c8d97e --- /dev/null +++ b/test/Model/CreatePaymentMethod409ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreatePaymentMethod503ResponseTest.php b/test/Model/CreatePaymentMethod503ResponseTest.php new file mode 100644 index 0000000..8cf5067 --- /dev/null +++ b/test/Model/CreatePaymentMethod503ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreatePayoutRequestTest.php b/test/Model/CreatePayoutRequestTest.php new file mode 100644 index 0000000..83868ca --- /dev/null +++ b/test/Model/CreatePayoutRequestTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "receipt_notification" + */ + public function testPropertyReceiptNotification() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefund400ResponseTest.php b/test/Model/CreateRefund400ResponseTest.php new file mode 100644 index 0000000..154ede6 --- /dev/null +++ b/test/Model/CreateRefund400ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefund403ResponseTest.php b/test/Model/CreateRefund403ResponseTest.php new file mode 100644 index 0000000..9aa9ed9 --- /dev/null +++ b/test/Model/CreateRefund403ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefund404ResponseTest.php b/test/Model/CreateRefund404ResponseTest.php new file mode 100644 index 0000000..f1e20ae --- /dev/null +++ b/test/Model/CreateRefund404ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefund409ResponseTest.php b/test/Model/CreateRefund409ResponseTest.php new file mode 100644 index 0000000..902cffc --- /dev/null +++ b/test/Model/CreateRefund409ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefund503ResponseTest.php b/test/Model/CreateRefund503ResponseTest.php new file mode 100644 index 0000000..ee1af7c --- /dev/null +++ b/test/Model/CreateRefund503ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefundDefaultResponseTest.php b/test/Model/CreateRefundDefaultResponseTest.php new file mode 100644 index 0000000..a0606b7 --- /dev/null +++ b/test/Model/CreateRefundDefaultResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CreateRefundTest.php b/test/Model/CreateRefundTest.php new file mode 100644 index 0000000..f319a0e --- /dev/null +++ b/test/Model/CreateRefundTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_request_id" + */ + public function testPropertyPaymentRequestId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_id" + */ + public function testPropertyInvoiceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reason" + */ + public function testPropertyReason() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CurrencyTest.php b/test/Model/CurrencyTest.php new file mode 100644 index 0000000..507e47e --- /dev/null +++ b/test/Model/CurrencyTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CustomerObjectTest.php b/test/Model/CustomerObjectTest.php new file mode 100644 index 0000000..caaafd7 --- /dev/null +++ b/test/Model/CustomerObjectTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "given_names" + */ + public function testPropertyGivenNames() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "surname" + */ + public function testPropertySurname() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_id" + */ + public function testPropertyCustomerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "addresses" + */ + public function testPropertyAddresses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DateRangeFilterTest.php b/test/Model/DateRangeFilterTest.php new file mode 100644 index 0000000..04d0928 --- /dev/null +++ b/test/Model/DateRangeFilterTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "gte" + */ + public function testPropertyGte() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "lte" + */ + public function testPropertyLte() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DigitalPayoutChannelPropertiesTest.php b/test/Model/DigitalPayoutChannelPropertiesTest.php new file mode 100644 index 0000000..47229ff --- /dev/null +++ b/test/Model/DigitalPayoutChannelPropertiesTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_holder_name" + */ + public function testPropertyAccountHolderName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_number" + */ + public function testPropertyAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_type" + */ + public function testPropertyAccountType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitAllOfTest.php b/test/Model/DirectDebitAllOfTest.php new file mode 100644 index 0000000..f98d3a2 --- /dev/null +++ b/test/Model/DirectDebitAllOfTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bank_account" + */ + public function testPropertyBankAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "debit_card" + */ + public function testPropertyDebitCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitBankAccountTest.php b/test/Model/DirectDebitBankAccountTest.php new file mode 100644 index 0000000..bf96cf3 --- /dev/null +++ b/test/Model/DirectDebitBankAccountTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "masked_bank_account_number" + */ + public function testPropertyMaskedBankAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "bank_account_hash" + */ + public function testPropertyBankAccountHash() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitChannelCodeTest.php b/test/Model/DirectDebitChannelCodeTest.php new file mode 100644 index 0000000..afc15d0 --- /dev/null +++ b/test/Model/DirectDebitChannelCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitChannelPropertiesBankAccountTest.php b/test/Model/DirectDebitChannelPropertiesBankAccountTest.php new file mode 100644 index 0000000..3497e74 --- /dev/null +++ b/test/Model/DirectDebitChannelPropertiesBankAccountTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "identity_document_number" + */ + public function testPropertyIdentityDocumentNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitChannelPropertiesBankRedirectTest.php b/test/Model/DirectDebitChannelPropertiesBankRedirectTest.php new file mode 100644 index 0000000..d4c6859 --- /dev/null +++ b/test/Model/DirectDebitChannelPropertiesBankRedirectTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitChannelPropertiesDebitCardTest.php b/test/Model/DirectDebitChannelPropertiesDebitCardTest.php new file mode 100644 index 0000000..b2c0df1 --- /dev/null +++ b/test/Model/DirectDebitChannelPropertiesDebitCardTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_number" + */ + public function testPropertyAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_last_four" + */ + public function testPropertyCardLastFour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_expiry" + */ + public function testPropertyCardExpiry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitChannelPropertiesTest.php b/test/Model/DirectDebitChannelPropertiesTest.php new file mode 100644 index 0000000..ef5e075 --- /dev/null +++ b/test/Model/DirectDebitChannelPropertiesTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "identity_document_number" + */ + public function testPropertyIdentityDocumentNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_number" + */ + public function testPropertyAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_last_four" + */ + public function testPropertyCardLastFour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_expiry" + */ + public function testPropertyCardExpiry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitDebitCardTest.php b/test/Model/DirectDebitDebitCardTest.php new file mode 100644 index 0000000..332349a --- /dev/null +++ b/test/Model/DirectDebitDebitCardTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobile_number" + */ + public function testPropertyMobileNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_last_four" + */ + public function testPropertyCardLastFour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_expiry" + */ + public function testPropertyCardExpiry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitParametersTest.php b/test/Model/DirectDebitParametersTest.php new file mode 100644 index 0000000..4c423fd --- /dev/null +++ b/test/Model/DirectDebitParametersTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitTest.php b/test/Model/DirectDebitTest.php new file mode 100644 index 0000000..d8ab57d --- /dev/null +++ b/test/Model/DirectDebitTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "direct_debit_type" + */ + public function testPropertyDirectDebitType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DirectDebitTypeTest.php b/test/Model/DirectDebitTypeTest.php new file mode 100644 index 0000000..71f7c4d --- /dev/null +++ b/test/Model/DirectDebitTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletAccountTest.php b/test/Model/EWalletAccountTest.php new file mode 100644 index 0000000..f0c63aa --- /dev/null +++ b/test/Model/EWalletAccountTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_details" + */ + public function testPropertyAccountDetails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "balance" + */ + public function testPropertyBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "point_balance" + */ + public function testPropertyPointBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletAllOfTest.php b/test/Model/EWalletAllOfTest.php new file mode 100644 index 0000000..8e86485 --- /dev/null +++ b/test/Model/EWalletAllOfTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account" + */ + public function testPropertyAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletChannelCodeTest.php b/test/Model/EWalletChannelCodeTest.php new file mode 100644 index 0000000..7278e25 --- /dev/null +++ b/test/Model/EWalletChannelCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletChannelPropertiesTest.php b/test/Model/EWalletChannelPropertiesTest.php new file mode 100644 index 0000000..220b5aa --- /dev/null +++ b/test/Model/EWalletChannelPropertiesTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cancel_return_url" + */ + public function testPropertyCancelReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "redeem_points" + */ + public function testPropertyRedeemPoints() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mobilenumber" + */ + public function testPropertyMobilenumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cashtag" + */ + public function testPropertyCashtag() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletParametersTest.php b/test/Model/EWalletParametersTest.php new file mode 100644 index 0000000..3dc92d4 --- /dev/null +++ b/test/Model/EWalletParametersTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account" + */ + public function testPropertyAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EWalletTest.php b/test/Model/EWalletTest.php new file mode 100644 index 0000000..31318fd --- /dev/null +++ b/test/Model/EWalletTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account" + */ + public function testPropertyAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorErrorsInnerTest.php b/test/Model/ErrorErrorsInnerTest.php new file mode 100644 index 0000000..6ee1b9b --- /dev/null +++ b/test/Model/ErrorErrorsInnerTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "path" + */ + public function testPropertyPath() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorTest.php b/test/Model/ErrorTest.php new file mode 100644 index 0000000..49dc1b2 --- /dev/null +++ b/test/Model/ErrorTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EwalletTest.php b/test/Model/EwalletTest.php new file mode 100644 index 0000000..b2a54f6 --- /dev/null +++ b/test/Model/EwalletTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ewallet_type" + */ + public function testPropertyEwalletType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EwalletTypeTest.php b/test/Model/EwalletTypeTest.php new file mode 100644 index 0000000..dc4c516 --- /dev/null +++ b/test/Model/EwalletTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/FeeResponseTest.php b/test/Model/FeeResponseTest.php new file mode 100644 index 0000000..eadd4d0 --- /dev/null +++ b/test/Model/FeeResponseTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "xendit_fee" + */ + public function testPropertyXenditFee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value_added_tax" + */ + public function testPropertyValueAddedTax() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "xendit_withholding_tax" + */ + public function testPropertyXenditWithholdingTax() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "third_party_withholding_tax" + */ + public function testPropertyThirdPartyWithholdingTax() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ForbiddenErrorTest.php b/test/Model/ForbiddenErrorTest.php new file mode 100644 index 0000000..5d0017e --- /dev/null +++ b/test/Model/ForbiddenErrorTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetAllPaymentMethods400ResponseTest.php b/test/Model/GetAllPaymentMethods400ResponseTest.php new file mode 100644 index 0000000..43d0f6e --- /dev/null +++ b/test/Model/GetAllPaymentMethods400ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetAllPaymentMethods403ResponseTest.php b/test/Model/GetAllPaymentMethods403ResponseTest.php new file mode 100644 index 0000000..299d83f --- /dev/null +++ b/test/Model/GetAllPaymentMethods403ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetAllPaymentMethods404ResponseTest.php b/test/Model/GetAllPaymentMethods404ResponseTest.php new file mode 100644 index 0000000..696bf1a --- /dev/null +++ b/test/Model/GetAllPaymentMethods404ResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetAllPaymentMethodsDefaultResponseTest.php b/test/Model/GetAllPaymentMethodsDefaultResponseTest.php new file mode 100644 index 0000000..ac977d9 --- /dev/null +++ b/test/Model/GetAllPaymentMethodsDefaultResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetPayouts200ResponseDataInnerTest.php b/test/Model/GetPayouts200ResponseDataInnerTest.php new file mode 100644 index 0000000..d569bde --- /dev/null +++ b/test/Model/GetPayouts200ResponseDataInnerTest.php @@ -0,0 +1,209 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "receipt_notification" + */ + public function testPropertyReceiptNotification() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "business_id" + */ + public function testPropertyBusinessId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "estimated_arrival_time" + */ + public function testPropertyEstimatedArrivalTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetPayouts200ResponseLinksTest.php b/test/Model/GetPayouts200ResponseLinksTest.php new file mode 100644 index 0000000..9ed57f3 --- /dev/null +++ b/test/Model/GetPayouts200ResponseLinksTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GetPayouts200ResponseTest.php b/test/Model/GetPayouts200ResponseTest.php new file mode 100644 index 0000000..ab194f6 --- /dev/null +++ b/test/Model/GetPayouts200ResponseTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceClientTypeTest.php b/test/Model/InvoiceClientTypeTest.php new file mode 100644 index 0000000..24d3d56 --- /dev/null +++ b/test/Model/InvoiceClientTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceCurrencyTest.php b/test/Model/InvoiceCurrencyTest.php new file mode 100644 index 0000000..70d0671 --- /dev/null +++ b/test/Model/InvoiceCurrencyTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceError404ResponseDefinitionTest.php b/test/Model/InvoiceError404ResponseDefinitionTest.php new file mode 100644 index 0000000..c477257 --- /dev/null +++ b/test/Model/InvoiceError404ResponseDefinitionTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceFeeTest.php b/test/Model/InvoiceFeeTest.php new file mode 100644 index 0000000..29c64d0 --- /dev/null +++ b/test/Model/InvoiceFeeTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceItemTest.php b/test/Model/InvoiceItemTest.php new file mode 100644 index 0000000..8045262 --- /dev/null +++ b/test/Model/InvoiceItemTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "price" + */ + public function testPropertyPrice() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "quantity" + */ + public function testPropertyQuantity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceNotFoundErrorTest.php b/test/Model/InvoiceNotFoundErrorTest.php new file mode 100644 index 0000000..3927fa8 --- /dev/null +++ b/test/Model/InvoiceNotFoundErrorTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoicePaymentMethodTest.php b/test/Model/InvoicePaymentMethodTest.php new file mode 100644 index 0000000..f65b77e --- /dev/null +++ b/test/Model/InvoicePaymentMethodTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceStatusTest.php b/test/Model/InvoiceStatusTest.php new file mode 100644 index 0000000..6d69601 --- /dev/null +++ b/test/Model/InvoiceStatusTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InvoiceTest.php b/test/Model/InvoiceTest.php new file mode 100644 index 0000000..fde997d --- /dev/null +++ b/test/Model/InvoiceTest.php @@ -0,0 +1,389 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "external_id" + */ + public function testPropertyExternalId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "user_id" + */ + public function testPropertyUserId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_high" + */ + public function testPropertyIsHigh() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payer_email" + */ + public function testPropertyPayerEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_method" + */ + public function testPropertyPaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "merchant_name" + */ + public function testPropertyMerchantName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "merchant_profile_picture_url" + */ + public function testPropertyMerchantProfilePictureUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "locale" + */ + public function testPropertyLocale() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_date" + */ + public function testPropertyExpiryDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_url" + */ + public function testPropertyInvoiceUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_banks" + */ + public function testPropertyAvailableBanks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_retail_outlets" + */ + public function testPropertyAvailableRetailOutlets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_ewallets" + */ + public function testPropertyAvailableEwallets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_qr_codes" + */ + public function testPropertyAvailableQrCodes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_direct_debits" + */ + public function testPropertyAvailableDirectDebits() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_paylaters" + */ + public function testPropertyAvailablePaylaters() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_exclude_credit_card" + */ + public function testPropertyShouldExcludeCreditCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_send_email" + */ + public function testPropertyShouldSendEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "client_type" + */ + public function testPropertyClientType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_redirect_url" + */ + public function testPropertySuccessRedirectUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_redirect_url" + */ + public function testPropertyFailureRedirectUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_authenticate_credit_card" + */ + public function testPropertyShouldAuthenticateCreditCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "items" + */ + public function testPropertyItems() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fixed_va" + */ + public function testPropertyFixedVa() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reminder_date" + */ + public function testPropertyReminderDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer" + */ + public function testPropertyCustomer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_notification_preference" + */ + public function testPropertyCustomerNotificationPreference() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fees" + */ + public function testPropertyFees() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/LinkItemTest.php b/test/Model/LinkItemTest.php new file mode 100644 index 0000000..e16cbc6 --- /dev/null +++ b/test/Model/LinkItemTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/NotificationChannelTest.php b/test/Model/NotificationChannelTest.php new file mode 100644 index 0000000..7edd2d0 --- /dev/null +++ b/test/Model/NotificationChannelTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/NotificationPreferenceTest.php b/test/Model/NotificationPreferenceTest.php new file mode 100644 index 0000000..3227bb7 --- /dev/null +++ b/test/Model/NotificationPreferenceTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_created" + */ + public function testPropertyInvoiceCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_reminder" + */ + public function testPropertyInvoiceReminder() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_expired" + */ + public function testPropertyInvoiceExpired() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "invoice_paid" + */ + public function testPropertyInvoicePaid() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterChannelCodeTest.php b/test/Model/OverTheCounterChannelCodeTest.php new file mode 100644 index 0000000..01b0dd1 --- /dev/null +++ b/test/Model/OverTheCounterChannelCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterChannelPropertiesTest.php b/test/Model/OverTheCounterChannelPropertiesTest.php new file mode 100644 index 0000000..5bb96fe --- /dev/null +++ b/test/Model/OverTheCounterChannelPropertiesTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_code" + */ + public function testPropertyPaymentCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_name" + */ + public function testPropertyCustomerName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterChannelPropertiesUpdateTest.php b/test/Model/OverTheCounterChannelPropertiesUpdateTest.php new file mode 100644 index 0000000..f776a18 --- /dev/null +++ b/test/Model/OverTheCounterChannelPropertiesUpdateTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_name" + */ + public function testPropertyCustomerName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterParametersTest.php b/test/Model/OverTheCounterParametersTest.php new file mode 100644 index 0000000..3dc3ee0 --- /dev/null +++ b/test/Model/OverTheCounterParametersTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterTest.php b/test/Model/OverTheCounterTest.php new file mode 100644 index 0000000..efe772d --- /dev/null +++ b/test/Model/OverTheCounterTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OverTheCounterUpdateParametersTest.php b/test/Model/OverTheCounterUpdateParametersTest.php new file mode 100644 index 0000000..612c3e3 --- /dev/null +++ b/test/Model/OverTheCounterUpdateParametersTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaylaterTest.php b/test/Model/PaylaterTest.php new file mode 100644 index 0000000..3574e55 --- /dev/null +++ b/test/Model/PaylaterTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "paylater_type" + */ + public function testPropertyPaylaterType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "should_exclude" + */ + public function testPropertyShouldExclude() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaylaterTypeTest.php b/test/Model/PaylaterTypeTest.php new file mode 100644 index 0000000..38fd38d --- /dev/null +++ b/test/Model/PaylaterTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentChannelAllOfTest.php b/test/Model/PaymentChannelAllOfTest.php new file mode 100644 index 0000000..15b0ff3 --- /dev/null +++ b/test/Model/PaymentChannelAllOfTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_name" + */ + public function testPropertyChannelName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "logo_url" + */ + public function testPropertyLogoUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount_limits" + */ + public function testPropertyAmountLimits() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentChannelListLinksInnerAllOfTest.php b/test/Model/PaymentChannelListLinksInnerAllOfTest.php new file mode 100644 index 0000000..b77f414 --- /dev/null +++ b/test/Model/PaymentChannelListLinksInnerAllOfTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentChannelListLinksInnerTest.php b/test/Model/PaymentChannelListLinksInnerTest.php new file mode 100644 index 0000000..d7061ab --- /dev/null +++ b/test/Model/PaymentChannelListLinksInnerTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentChannelListTest.php b/test/Model/PaymentChannelListTest.php new file mode 100644 index 0000000..39bea76 --- /dev/null +++ b/test/Model/PaymentChannelListTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentChannelTest.php b/test/Model/PaymentChannelTest.php new file mode 100644 index 0000000..75f7517 --- /dev/null +++ b/test/Model/PaymentChannelTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_name" + */ + public function testPropertyChannelName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "logo_url" + */ + public function testPropertyLogoUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount_limits" + */ + public function testPropertyAmountLimits() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodActionTest.php b/test/Model/PaymentMethodActionTest.php new file mode 100644 index 0000000..1d7d54b --- /dev/null +++ b/test/Model/PaymentMethodActionTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url_type" + */ + public function testPropertyUrlType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodAuthParametersTest.php b/test/Model/PaymentMethodAuthParametersTest.php new file mode 100644 index 0000000..7d00b8e --- /dev/null +++ b/test/Model/PaymentMethodAuthParametersTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "auth_code" + */ + public function testPropertyAuthCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodCountryTest.php b/test/Model/PaymentMethodCountryTest.php new file mode 100644 index 0000000..77160a7 --- /dev/null +++ b/test/Model/PaymentMethodCountryTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodExpireParametersTest.php b/test/Model/PaymentMethodExpireParametersTest.php new file mode 100644 index 0000000..cc69e2b --- /dev/null +++ b/test/Model/PaymentMethodExpireParametersTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodListTest.php b/test/Model/PaymentMethodListTest.php new file mode 100644 index 0000000..d9222c9 --- /dev/null +++ b/test/Model/PaymentMethodListTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodParametersTest.php b/test/Model/PaymentMethodParametersTest.php new file mode 100644 index 0000000..55a849c --- /dev/null +++ b/test/Model/PaymentMethodParametersTest.php @@ -0,0 +1,155 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reusability" + */ + public function testPropertyReusability() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "direct_debit" + */ + public function testPropertyDirectDebit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ewallet" + */ + public function testPropertyEwallet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "over_the_counter" + */ + public function testPropertyOverTheCounter() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_account" + */ + public function testPropertyVirtualAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "qr_code" + */ + public function testPropertyQrCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodReusabilityTest.php b/test/Model/PaymentMethodReusabilityTest.php new file mode 100644 index 0000000..77a8703 --- /dev/null +++ b/test/Model/PaymentMethodReusabilityTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodStatusTest.php b/test/Model/PaymentMethodStatusTest.php new file mode 100644 index 0000000..83f81b7 --- /dev/null +++ b/test/Model/PaymentMethodStatusTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodTest.php b/test/Model/PaymentMethodTest.php new file mode 100644 index 0000000..02b5f5f --- /dev/null +++ b/test/Model/PaymentMethodTest.php @@ -0,0 +1,209 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card" + */ + public function testPropertyCard() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "direct_debit" + */ + public function testPropertyDirectDebit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ewallet" + */ + public function testPropertyEwallet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "over_the_counter" + */ + public function testPropertyOverTheCounter() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_account" + */ + public function testPropertyVirtualAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "qr_code" + */ + public function testPropertyQrCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reusability" + */ + public function testPropertyReusability() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodTypeTest.php b/test/Model/PaymentMethodTypeTest.php new file mode 100644 index 0000000..af78d95 --- /dev/null +++ b/test/Model/PaymentMethodTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentMethodUpdateParametersTest.php b/test/Model/PaymentMethodUpdateParametersTest.php new file mode 100644 index 0000000..904039c --- /dev/null +++ b/test/Model/PaymentMethodUpdateParametersTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reusability" + */ + public function testPropertyReusability() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "over_the_counter" + */ + public function testPropertyOverTheCounter() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_account" + */ + public function testPropertyVirtualAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestActionTest.php b/test/Model/PaymentRequestActionTest.php new file mode 100644 index 0000000..85e61cd --- /dev/null +++ b/test/Model/PaymentRequestActionTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "action" + */ + public function testPropertyAction() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url_type" + */ + public function testPropertyUrlType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "qr_code" + */ + public function testPropertyQrCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestAuthParametersTest.php b/test/Model/PaymentRequestAuthParametersTest.php new file mode 100644 index 0000000..6ee2dae --- /dev/null +++ b/test/Model/PaymentRequestAuthParametersTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "auth_code" + */ + public function testPropertyAuthCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestBasketItemTest.php b/test/Model/PaymentRequestBasketItemTest.php new file mode 100644 index 0000000..00e41b6 --- /dev/null +++ b/test/Model/PaymentRequestBasketItemTest.php @@ -0,0 +1,191 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sub_category" + */ + public function testPropertySubCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "quantity" + */ + public function testPropertyQuantity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "price" + */ + public function testPropertyPrice() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payer_charged_currency" + */ + public function testPropertyPayerChargedCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payer_charged_price" + */ + public function testPropertyPayerChargedPrice() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestCaptureMethodTest.php b/test/Model/PaymentRequestCaptureMethodTest.php new file mode 100644 index 0000000..e5fceab --- /dev/null +++ b/test/Model/PaymentRequestCaptureMethodTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestCardVerificationResultsTest.php b/test/Model/PaymentRequestCardVerificationResultsTest.php new file mode 100644 index 0000000..4a31aab --- /dev/null +++ b/test/Model/PaymentRequestCardVerificationResultsTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure" + */ + public function testPropertyThreeDSecure() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cvv_result" + */ + public function testPropertyCvvResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "address_verification_result" + */ + public function testPropertyAddressVerificationResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestCardVerificationResultsThreeDeeSecureTest.php b/test/Model/PaymentRequestCardVerificationResultsThreeDeeSecureTest.php new file mode 100644 index 0000000..d6b9104 --- /dev/null +++ b/test/Model/PaymentRequestCardVerificationResultsThreeDeeSecureTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_flow" + */ + public function testPropertyThreeDSecureFlow() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "eci_code" + */ + public function testPropertyEciCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_result" + */ + public function testPropertyThreeDSecureResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_result_reason" + */ + public function testPropertyThreeDSecureResultReason() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "three_d_secure_version" + */ + public function testPropertyThreeDSecureVersion() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestChannelPropertiesTest.php b/test/Model/PaymentRequestChannelPropertiesTest.php new file mode 100644 index 0000000..d9e0091 --- /dev/null +++ b/test/Model/PaymentRequestChannelPropertiesTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cancel_return_url" + */ + public function testPropertyCancelReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "redeem_points" + */ + public function testPropertyRedeemPoints() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "require_auth" + */ + public function testPropertyRequireAuth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "merchant_id_tag" + */ + public function testPropertyMerchantIdTag() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardonfile_type" + */ + public function testPropertyCardonfileType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestCountryTest.php b/test/Model/PaymentRequestCountryTest.php new file mode 100644 index 0000000..0cd201d --- /dev/null +++ b/test/Model/PaymentRequestCountryTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestCurrencyTest.php b/test/Model/PaymentRequestCurrencyTest.php new file mode 100644 index 0000000..d97c9c8 --- /dev/null +++ b/test/Model/PaymentRequestCurrencyTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestInitiatorTest.php b/test/Model/PaymentRequestInitiatorTest.php new file mode 100644 index 0000000..f929ef9 --- /dev/null +++ b/test/Model/PaymentRequestInitiatorTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestListResponseTest.php b/test/Model/PaymentRequestListResponseTest.php new file mode 100644 index 0000000..cf8bd39 --- /dev/null +++ b/test/Model/PaymentRequestListResponseTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestParametersChannelPropertiesAllOfTest.php b/test/Model/PaymentRequestParametersChannelPropertiesAllOfTest.php new file mode 100644 index 0000000..28df0b2 --- /dev/null +++ b/test/Model/PaymentRequestParametersChannelPropertiesAllOfTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cvv" + */ + public function testPropertyCvv() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestParametersChannelPropertiesTest.php b/test/Model/PaymentRequestParametersChannelPropertiesTest.php new file mode 100644 index 0000000..5c0b166 --- /dev/null +++ b/test/Model/PaymentRequestParametersChannelPropertiesTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "success_return_url" + */ + public function testPropertySuccessReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_return_url" + */ + public function testPropertyFailureReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cancel_return_url" + */ + public function testPropertyCancelReturnUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "redeem_points" + */ + public function testPropertyRedeemPoints() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "require_auth" + */ + public function testPropertyRequireAuth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "merchant_id_tag" + */ + public function testPropertyMerchantIdTag() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardonfile_type" + */ + public function testPropertyCardonfileType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cvv" + */ + public function testPropertyCvv() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestParametersTest.php b/test/Model/PaymentRequestParametersTest.php new file mode 100644 index 0000000..9a486cf --- /dev/null +++ b/test/Model/PaymentRequestParametersTest.php @@ -0,0 +1,200 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_method" + */ + public function testPropertyPaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "capture_method" + */ + public function testPropertyCaptureMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "initiator" + */ + public function testPropertyInitiator() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_method_id" + */ + public function testPropertyPaymentMethodId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "shipping_information" + */ + public function testPropertyShippingInformation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "items" + */ + public function testPropertyItems() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_id" + */ + public function testPropertyCustomerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer" + */ + public function testPropertyCustomer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestShippingInformationTest.php b/test/Model/PaymentRequestShippingInformationTest.php new file mode 100644 index 0000000..923edb8 --- /dev/null +++ b/test/Model/PaymentRequestShippingInformationTest.php @@ -0,0 +1,128 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line1" + */ + public function testPropertyStreetLine1() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "street_line2" + */ + public function testPropertyStreetLine2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "province_state" + */ + public function testPropertyProvinceState() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "postal_code" + */ + public function testPropertyPostalCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestStatusTest.php b/test/Model/PaymentRequestStatusTest.php new file mode 100644 index 0000000..303865c --- /dev/null +++ b/test/Model/PaymentRequestStatusTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PaymentRequestTest.php b/test/Model/PaymentRequestTest.php new file mode 100644 index 0000000..c854d53 --- /dev/null +++ b/test/Model/PaymentRequestTest.php @@ -0,0 +1,281 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "business_id" + */ + public function testPropertyBusinessId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_id" + */ + public function testPropertyCustomerId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer" + */ + public function testPropertyCustomer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_amount" + */ + public function testPropertyMinAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_amount" + */ + public function testPropertyMaxAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_method" + */ + public function testPropertyPaymentMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "capture_method" + */ + public function testPropertyCaptureMethod() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "initiator" + */ + public function testPropertyInitiator() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "card_verification_results" + */ + public function testPropertyCardVerificationResults() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "actions" + */ + public function testPropertyActions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "shipping_information" + */ + public function testPropertyShippingInformation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "items" + */ + public function testPropertyItems() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PayoutAllOfTest.php b/test/Model/PayoutAllOfTest.php new file mode 100644 index 0000000..15372e1 --- /dev/null +++ b/test/Model/PayoutAllOfTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "business_id" + */ + public function testPropertyBusinessId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "estimated_arrival_time" + */ + public function testPropertyEstimatedArrivalTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PayoutTest.php b/test/Model/PayoutTest.php new file mode 100644 index 0000000..160b7aa --- /dev/null +++ b/test/Model/PayoutTest.php @@ -0,0 +1,209 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "receipt_notification" + */ + public function testPropertyReceiptNotification() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "business_id" + */ + public function testPropertyBusinessId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "estimated_arrival_time" + */ + public function testPropertyEstimatedArrivalTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QRCodeChannelCodeTest.php b/test/Model/QRCodeChannelCodeTest.php new file mode 100644 index 0000000..7d3c95b --- /dev/null +++ b/test/Model/QRCodeChannelCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QRCodeChannelPropertiesTest.php b/test/Model/QRCodeChannelPropertiesTest.php new file mode 100644 index 0000000..3ef75f0 --- /dev/null +++ b/test/Model/QRCodeChannelPropertiesTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "qr_string" + */ + public function testPropertyQrString() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QRCodeParametersTest.php b/test/Model/QRCodeParametersTest.php new file mode 100644 index 0000000..2b3aa42 --- /dev/null +++ b/test/Model/QRCodeParametersTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QRCodeTest.php b/test/Model/QRCodeTest.php new file mode 100644 index 0000000..900792d --- /dev/null +++ b/test/Model/QRCodeTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QrCodeTest.php b/test/Model/QrCodeTest.php new file mode 100644 index 0000000..a81b1ca --- /dev/null +++ b/test/Model/QrCodeTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "qr_code_type" + */ + public function testPropertyQrCodeType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/QrCodeTypeTest.php b/test/Model/QrCodeTypeTest.php new file mode 100644 index 0000000..0a69053 --- /dev/null +++ b/test/Model/QrCodeTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ReceiptNotificationTest.php b/test/Model/ReceiptNotificationTest.php new file mode 100644 index 0000000..b102064 --- /dev/null +++ b/test/Model/ReceiptNotificationTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_to" + */ + public function testPropertyEmailTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_cc" + */ + public function testPropertyEmailCc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email_bcc" + */ + public function testPropertyEmailBcc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RefundListTest.php b/test/Model/RefundListTest.php new file mode 100644 index 0000000..f1b62fd --- /dev/null +++ b/test/Model/RefundListTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RefundTest.php b/test/Model/RefundTest.php new file mode 100644 index 0000000..31ba0f0 --- /dev/null +++ b/test/Model/RefundTest.php @@ -0,0 +1,182 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_request_id" + */ + public function testPropertyPaymentRequestId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "failure_code" + */ + public function testPropertyFailureCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "refund_fee_amount" + */ + public function testPropertyRefundFeeAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "metadata" + */ + public function testPropertyMetadata() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RetailOutletNameTest.php b/test/Model/RetailOutletNameTest.php new file mode 100644 index 0000000..21a89ee --- /dev/null +++ b/test/Model/RetailOutletNameTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/RetailOutletTest.php b/test/Model/RetailOutletTest.php new file mode 100644 index 0000000..6bcfb02 --- /dev/null +++ b/test/Model/RetailOutletTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "retail_outlet_name" + */ + public function testPropertyRetailOutletName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payment_code" + */ + public function testPropertyPaymentCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "transfer_amount" + */ + public function testPropertyTransferAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "merchant_name" + */ + public function testPropertyMerchantName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ServerErrorTest.php b/test/Model/ServerErrorTest.php new file mode 100644 index 0000000..c00194b --- /dev/null +++ b/test/Model/ServerErrorTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status_code" + */ + public function testPropertyStatusCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SimulatePaymentRequestTest.php b/test/Model/SimulatePaymentRequestTest.php new file mode 100644 index 0000000..92c35f1 --- /dev/null +++ b/test/Model/SimulatePaymentRequestTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TokenizedCardInformationTest.php b/test/Model/TokenizedCardInformationTest.php new file mode 100644 index 0000000..6041ed5 --- /dev/null +++ b/test/Model/TokenizedCardInformationTest.php @@ -0,0 +1,164 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "token_id" + */ + public function testPropertyTokenId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "masked_card_number" + */ + public function testPropertyMaskedCardNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cardholder_name" + */ + public function testPropertyCardholderName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_month" + */ + public function testPropertyExpiryMonth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expiry_year" + */ + public function testPropertyExpiryYear() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fingerprint" + */ + public function testPropertyFingerprint() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "network" + */ + public function testPropertyNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "issuer" + */ + public function testPropertyIssuer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionResponseTest.php b/test/Model/TransactionResponseTest.php new file mode 100644 index 0000000..ec2d0e8 --- /dev/null +++ b/test/Model/TransactionResponseTest.php @@ -0,0 +1,227 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "product_id" + */ + public function testPropertyProductId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_category" + */ + public function testPropertyChannelCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "account_identifier" + */ + public function testPropertyAccountIdentifier() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reference_id" + */ + public function testPropertyReferenceId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cashflow" + */ + public function testPropertyCashflow() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "settlement_status" + */ + public function testPropertySettlementStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "estimated_settlement_time" + */ + public function testPropertyEstimatedSettlementTime() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "business_id" + */ + public function testPropertyBusinessId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "fee" + */ + public function testPropertyFee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created" + */ + public function testPropertyCreated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated" + */ + public function testPropertyUpdated() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionResponseTypeTest.php b/test/Model/TransactionResponseTypeTest.php new file mode 100644 index 0000000..92fc913 --- /dev/null +++ b/test/Model/TransactionResponseTypeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionStatusesTest.php b/test/Model/TransactionStatusesTest.php new file mode 100644 index 0000000..5829fff --- /dev/null +++ b/test/Model/TransactionStatusesTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionTypesTest.php b/test/Model/TransactionTypesTest.php new file mode 100644 index 0000000..7064876 --- /dev/null +++ b/test/Model/TransactionTypesTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionsResponseTest.php b/test/Model/TransactionsResponseTest.php new file mode 100644 index 0000000..0613a47 --- /dev/null +++ b/test/Model/TransactionsResponseTest.php @@ -0,0 +1,101 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "has_more" + */ + public function testPropertyHasMore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UnauthorizedErrorTest.php b/test/Model/UnauthorizedErrorTest.php new file mode 100644 index 0000000..2d492d9 --- /dev/null +++ b/test/Model/UnauthorizedErrorTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ValidationErrorTest.php b/test/Model/ValidationErrorTest.php new file mode 100644 index 0000000..d056164 --- /dev/null +++ b/test/Model/ValidationErrorTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status_code" + */ + public function testPropertyStatusCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validation" + */ + public function testPropertyValidation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountAllOfTest.php b/test/Model/VirtualAccountAllOfTest.php new file mode 100644 index 0000000..36ec366 --- /dev/null +++ b/test/Model/VirtualAccountAllOfTest.php @@ -0,0 +1,83 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alternative_displays" + */ + public function testPropertyAlternativeDisplays() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountAlternativeDisplayTest.php b/test/Model/VirtualAccountAlternativeDisplayTest.php new file mode 100644 index 0000000..66410d0 --- /dev/null +++ b/test/Model/VirtualAccountAlternativeDisplayTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountChannelCodeTest.php b/test/Model/VirtualAccountChannelCodeTest.php new file mode 100644 index 0000000..5eae79f --- /dev/null +++ b/test/Model/VirtualAccountChannelCodeTest.php @@ -0,0 +1,74 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountChannelPropertiesPatchTest.php b/test/Model/VirtualAccountChannelPropertiesPatchTest.php new file mode 100644 index 0000000..ab16a83 --- /dev/null +++ b/test/Model/VirtualAccountChannelPropertiesPatchTest.php @@ -0,0 +1,92 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "suggested_amount" + */ + public function testPropertySuggestedAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountChannelPropertiesTest.php b/test/Model/VirtualAccountChannelPropertiesTest.php new file mode 100644 index 0000000..ec5007f --- /dev/null +++ b/test/Model/VirtualAccountChannelPropertiesTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "customer_name" + */ + public function testPropertyCustomerName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "virtual_account_number" + */ + public function testPropertyVirtualAccountNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expires_at" + */ + public function testPropertyExpiresAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "suggested_amount" + */ + public function testPropertySuggestedAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountParametersTest.php b/test/Model/VirtualAccountParametersTest.php new file mode 100644 index 0000000..a0fe5d6 --- /dev/null +++ b/test/Model/VirtualAccountParametersTest.php @@ -0,0 +1,137 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_amount" + */ + public function testPropertyMinAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_amount" + */ + public function testPropertyMaxAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alternative_display_types" + */ + public function testPropertyAlternativeDisplayTypes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountTest.php b/test/Model/VirtualAccountTest.php new file mode 100644 index 0000000..a70b420 --- /dev/null +++ b/test/Model/VirtualAccountTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_amount" + */ + public function testPropertyMinAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_amount" + */ + public function testPropertyMaxAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency" + */ + public function testPropertyCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_code" + */ + public function testPropertyChannelCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alternative_display_types" + */ + public function testPropertyAlternativeDisplayTypes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alternative_displays" + */ + public function testPropertyAlternativeDisplays() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/VirtualAccountUpdateParametersTest.php b/test/Model/VirtualAccountUpdateParametersTest.php new file mode 100644 index 0000000..f6ec3fe --- /dev/null +++ b/test/Model/VirtualAccountUpdateParametersTest.php @@ -0,0 +1,119 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "min_amount" + */ + public function testPropertyMinAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "max_amount" + */ + public function testPropertyMaxAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel_properties" + */ + public function testPropertyChannelProperties() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "alternative_display_types" + */ + public function testPropertyAlternativeDisplayTypes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index adb61e8..0000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,160 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -/** - * Class TestCase - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class TestCase extends \PHPUnit\Framework\TestCase -{ - protected $oriApiBase; - protected $oriApiKey; - protected $oriApiVersion; - protected $clientMock; - - /** - * Setting up PHPUnit - * - * @return void - */ - protected function setUp(): void - { - $this->oriApiBase = Xendit::$apiBase; - $this->oriApiKey = 'xnd_development_prHUBDfVuOQTxyWTQSNkpj' - . 'n9OwX9ZSUjdqgF9GenZ6hwhUQkc3NZ9WVexdH'; - - $this->oriApiVersion = Xendit::getLibVersion(); - - $this->clientMock = $this->createMock('\Xendit\HttpClient\ClientInterface'); - - ApiRequestor::setHttpClient(HttpClient\GuzzleClient::instance()); - } - - /** - * Restore original values after tests - * - * @return void - */ - protected function tearDown(): void - { - Xendit::$apiBase = $this->oriApiBase; - Xendit::setApiKey($this->oriApiKey); - Xendit::$libVersion = $this->oriApiVersion; - } - - /** - * Request expectations - * - * @param string $method HTTP method - * @param string $path relative url - * @param array $params user params - * @param array $headers request headers - - * @return void - */ - protected function expectsRequest( - $method, - $path, - $params = [], - $headers = [] - ) { - $this->_prepareRequestMock($method, $path, $params, $headers) - ->will( - $this->returnCallback( - function ($method, $url, $headers, $params) { - $guzzleClient = HttpClient\GuzzleClient::instance(); - ApiRequestor::setHttpClient($guzzleClient); - return $guzzleClient->sendRequest( - $method, - $url, - $headers, - $params - ); - } - ) - ); - } - - /** - * Set up request expectations without actually being emitted - * - * @param string $method HTTP method - * @param string $path relative url - * @param array $params user params - * @param array $headers request headers - * @param array $response response - * @param int $rcode response code - * - * @return void - */ - protected function stubRequest( - $method, - $path, - $params = [], - $headers = [], - $response = [], - $rcode = 200 - ) { - $this->_prepareRequestMock($method, $path, $params, $headers) - ->willReturn([json_encode($response), $rcode, []]); - } - - /** - * Prepares client mocker - * - * @param string $method HTTP method - * @param string $path relative path - * @param array $params user params - * @param array $headers request headers - * - * @return \PHPUnit\Framework\MockObject\Builder\InvocationMocker - */ - private function _prepareRequestMock($method, $path, $params, $headers) - { - ApiRequestor::setHttpClient($this->clientMock); - - Xendit::setApiKey( - <<clientMock - ->expects($this->once()) - ->method('sendRequest') - ->with( - $this->identicalTo(strtoupper($method)), - $this->identicalTo($url), - $headers === [] ? $this->anything() : $this->callback( - function ($array) use ($headers) { - foreach ($headers as $header) { - if (!in_array($header, $array)) { - return false; - } - } - return true; - } - ), - $params === [] ? $this->anything() : $this->identicalTo($params) - ); - } -} diff --git a/tests/Xendit/BalanceTest.php b/tests/Xendit/BalanceTest.php deleted file mode 100644 index 6728aaa..0000000 --- a/tests/Xendit/BalanceTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Balance; -use Xendit\TestCase; - -/** - * Class BalanceTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class BalanceTest extends TestCase -{ - const ACCOUNT_TYPE = 'CASH'; - const AMOUNT = 100000; - - /** - * Get Balance test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsGettable() - { - $this->stubRequest( - 'get', - '/balance?account_type=' . self::ACCOUNT_TYPE, - [], - [], - [ - 'balance' => self::AMOUNT - ] - ); - - $result = Balance::getBalance(self::ACCOUNT_TYPE); - $this->assertEquals($result['balance'], self::AMOUNT); - } - - /** - * Get Balance test - * Should throw ApiException - * - * @return void - * @throws Exceptions\InvalidArgumentException - * @throws Exceptions\ApiException - */ - public function testIsGettableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - - Balance::getBalance(); - } -} diff --git a/tests/Xendit/CardlessCreditTest.php b/tests/Xendit/CardlessCreditTest.php deleted file mode 100644 index 8b99397..0000000 --- a/tests/Xendit/CardlessCreditTest.php +++ /dev/null @@ -1,228 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\CardlessCredit; -use Xendit\TestCase; - -/** - * Class CardlessCreditTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class CardlessCreditTest extends TestCase -{ - const TEST_ID = "TEST-123"; - - /** - * Create Payment test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'cardless_credit_type'=> 'KREDIVO', - 'external_id'=> 'test-cardless-credit-01', - 'amount'=> 800000, - 'payment_type'=> '3_months', - 'items'=> [ - [ - 'id'=> '123123', - 'name'=> 'Phone Case', - 'price'=> 200000, - 'type'=> 'Smartphone', - 'url'=> 'http=>//example.com/phone/phone_case', - 'quantity'=> 2 - ], - [ - 'id'=> '234567', - 'name'=> 'Bluetooth Headset', - 'price'=> 400000, - 'type'=> 'Audio', - 'url'=> 'http=>//example.com/phone/bluetooth_headset', - 'quantity'=> 1 - ] - ], - 'customer_details'=> [ - 'first_name'=> 'customer first name', - 'last_name'=> 'customer last name', - 'email'=> 'customer@yourwebsite.com', - 'phone'=> '081513114262' - ], - 'shipping_address'=> [ - 'first_name'=> 'first name', - 'last_name'=> 'last name', - 'address'=> 'Jalan Teknologi No. 12', - 'city'=> 'Jakarta', - 'postal_code'=> '12345', - 'phone'=> '081513114262', - 'country_code'=> 'IDN' - ], - 'redirect_url'=> 'https://example.com', - 'callback_url'=> 'http://example.com/callback-cardless-credit' - ]; - - $this->stubRequest( - 'POST', - '/cardless-credit', - $params, - [], - $params - ); - - $result = CardlessCredit::create($params); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals( - $result['cardless_credit_type'], - $params['cardless_credit_type'] - ); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['payment_type'], $params['payment_type']); - $this->assertEquals($result['items'], $params['items']); - $this->assertEquals( - $result['customer_details'], - $params['customer_details'] - ); - $this->assertEquals( - $result['shipping_address'], - $params['shipping_address'] - ); - $this->assertEquals($result['redirect_url'], $params['redirect_url']); - $this->assertEquals($result['callback_url'], $params['callback_url']); - } - - /** - * Create payment test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - CardlessCredit::create($params); - } - - /** - * Calculate payment types - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $params = [ - 'cardless_credit_type' => 'KREDIVO', - 'amount' => 2000000, - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 1000000, - 'type' => 'Smartphone', - 'url' => 'http://example.com/phone/phone_case', - 'quantity' => 2 - ] - ] - ]; - - $response = [ - "message" => "Available payment types are listed.", - "payments" => [ - [ - "raw_monthly_installment" => 187534.66680439, - "name" => "Bayar dalam 6 bulan", - "amount" => 1000000, - "installment_amount" => 1125240, - "raw_amount" => 1000000, - "rate" => 2.95, - "down_payment" => 0, - "monthly_installment" => 187540, - "discounted_monthly_installment" => 0, - "tenure" => 6, - "id" => "6_months", - ], - [ - "raw_monthly_installment" => 1020000, - "name" => "Bayar dalam 30 hari", - "amount" => 1020000, - "installment_amount" => 1020000, - "raw_amount" => 1020000, - "rate" => 0, - "down_payment" => 0, - "monthly_installment" => 1020000, - "discounted_monthly_installment" => 0, - "tenure" => 1, - "id" => "30_days", - ], - [ - "raw_monthly_installment" => 356786.46273702, - "name" => "Bayar dalam 3 bulan", - "amount" => 1000000, - "installment_amount" => 1070370, - "raw_amount" => 1000000, - "rate" => 2.95, - "down_payment" => 0, - "monthly_installment" => 356790, - "discounted_monthly_installment" => 0, - "tenure" => 3, - "id" => "3_months", - ], - ], - ]; - - $this->stubRequest( - 'POST', - '/cardless-credit/payment-types', - $params, - [], - $response - ); - - $result = CardlessCredit::calculatePaymentTypes($params); - - $this->assertArrayHasKey('message', $result); - $this->assertArrayHasKey('payments', $result); - } - - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - $params = [ - 'cardless_credit_type' => 'KREDIVO', - 'amount' => 2000000, - 'items' => [ - [ - 'id' => '123123', - 'name' => 'Phone Case', - 'price' => 1000000, - 'type' => 'Smartphone', - 'url' => 'http://example.com/phone/phone_case', - 'quantity' => 2 - ] - ] - ]; - - CardlessCredit::calculatePaymentTypes($params); - } -} diff --git a/tests/Xendit/CardsTest.php b/tests/Xendit/CardsTest.php deleted file mode 100644 index 08c79d9..0000000 --- a/tests/Xendit/CardsTest.php +++ /dev/null @@ -1,268 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Cards; -use Xendit\TestCase; - -/** - * Class CardsTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class CardsTest extends TestCase -{ - const TOKEN_ID = "token123"; - const AUTH_ID = "auth123"; - const CHARGE_ID = "charge123"; - - /** - * Create Charge test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $expected = [ - 'token_id' => self::TOKEN_ID, - 'external_id' => 'card_' . time(), - 'authentication_id' => self::AUTH_ID, - 'amount'=> 100000, - 'card_cvn'=>'123', - 'capture'=> false - ]; - - $this->stubRequest( - 'POST', - '/credit_card_charges', - $expected, - [], - $expected - ); - - $result = Cards::create($expected); - - $this->assertEquals($result['token_id'], $expected['token_id']); - $this->assertEquals($result['external_id'], $expected['external_id']); - $this->assertEquals( - $result['authentication_id'], - $expected['authentication_id'] - ); - $this->assertEquals($result['amount'], $expected['amount']); - $this->assertEquals($result['card_cvn'], $expected['card_cvn']); - $this->assertEquals($result['capture'], $expected['capture']); - } - - /** - * Get Charge test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $expected = [ - 'token_id' => self::TOKEN_ID, - 'authentication_id' => self::AUTH_ID, - ]; - - $this->stubRequest( - 'get', - '/credit_card_charges/' . self::CHARGE_ID, - [], - [], - $expected - ); - - $result = Cards::retrieve( - self::CHARGE_ID - ); - - $this->assertEquals( - $result['token_id'], - self::TOKEN_ID - ); - - $this->assertEquals( - $result['authentication_id'], - self::AUTH_ID - ); - } - - /** - * Capture charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsCaptureable() - { - $expected = [ - 'amount'=> 100000 - ]; - - $this->stubRequest( - 'POST', - '/credit_card_charges/' . self::CHARGE_ID . '/capture', - $expected, - [], - $expected - ); - - $result = Cards::capture(self::CHARGE_ID, $expected); - - $this->assertEquals($result['amount'], $expected['amount']); - } - - /** - * Get refund charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsRefundable() - { - $expected = [ - 'amount'=> 100000, - 'external_id' => 'card_' . time(), - ]; - - $this->stubRequest( - 'POST', - '/credit_card_charges/' . self::CHARGE_ID . '/refunds', - $expected, - [], - $expected - ); - - $result = Cards::createRefund(self::CHARGE_ID, $expected); - - $this->assertEquals($result['amount'], $expected['amount']); - $this->assertEquals($result['external_id'], $expected['external_id']); - } - - /** - * Reverse charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsReversable() - { - $expected = [ - 'external_id' => 'card_' . time() - ]; - - $this->stubRequest( - 'POST', - '/credit_card_charges/' . self::CHARGE_ID . '/auth_reversal', - $expected, - [], - $expected - ); - - $result = Cards::reverseAuthorization(self::CHARGE_ID, $expected); - - $this->assertEquals($result['external_id'], $expected['external_id']); - } - - /** - * Create Charge test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowsException() - { - $expected = [ - 'token_id' => self::TOKEN_ID - ]; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $result = Cards::create($expected); - } - - /** - * Get Charge test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableThrowException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Cards::retrieve(self::CHARGE_ID); - } - - /** - * Capture charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsCaptureableThrowException() - { - $params = [ - 'amount'=> 100000 - ]; - - $this->expectException(\Xendit\Exceptions\ApiException::class); - Cards::capture(self::CHARGE_ID, $params); - } - - /** - * Get refund charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsRefundableThrowException() - { - $params = [ - 'amount'=> 100000, - 'external_id' => 'card_' . time(), - ]; - - $this->expectException(\Xendit\Exceptions\ApiException::class); - Cards::createRefund(self::CHARGE_ID, $params); - } - - /** - * Reverse charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsReversableThrowException() - { - $params = [ - 'external_id' => 'card_' . time() - ]; - - $this->expectException(\Xendit\Exceptions\ApiException::class); - Cards::reverseAuthorization(self::CHARGE_ID, $params); - } -} diff --git a/tests/Xendit/CustomersTest.php b/tests/Xendit/CustomersTest.php deleted file mode 100644 index 50beae9..0000000 --- a/tests/Xendit/CustomersTest.php +++ /dev/null @@ -1,531 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Customers; -use Xendit\TestCase; - -/** - * Class CustomersTest - * - * @category Class - * @package Xendit - * @author Glenda - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class CustomersTest extends TestCase -{ - const CUSTOMER_PARAMS_20200519 = [ - 'reference_id' => 'test-ref-id', - 'given_names' => 'customer 1', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'description' => 'dummy customer', - 'middle_name' => 'middle', - 'surname' => 'surname', - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'Jl. 123', - 'street_line2' => 'Jl. 456', - 'city' => 'Jakarta Selatan', - 'province' => 'DKI Jakarta', - 'state' => '-', - 'postal_code' => '12345' - ] - ], - 'metadata' => [ - 'meta' => 'data' - ] - ]; - - const CUSTOMER_RESPONSE_20200519 = [ - 'id' => '0f2de6f1-2023-403b-aaea-5f0a8a611f7d', - 'reference_id' => 'test-ref-id', - 'given_names' => 'customer 1', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'description' => 'dummy customer', - 'middle_name' => 'middle', - 'surname' => 'surname', - 'phone_number' => null, - 'nationality' => null, - 'date_of_birth' => null, - 'metadata' => [ - 'meta' => 'data' - ], - 'employment' => null, - 'addresses' => [ - [ - 'category' => '', - 'country' => 'ID', - 'state' => '-', - 'province' => 'DKI Jakarta', - 'city' => 'Jakarta Selatan', - 'postal_code' => '12345', - 'street_line1' => 'Jl. 123', - 'street_line2' => 'Jl. 456', - 'is_preferred' => false - ] - ], - 'source_of_wealth' => null - ]; - - const CUSTOMER_PARAMS_20201031 = [ - 'reference_id' => 'test-ref-id', - 'type' => 'INDIVIDUAL', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'phone_number' => '+6289987654321', - 'description' => 'test description', - 'kyc_documents' => [ - [ - 'country' => 'ID', - 'type' => 'IDENTITY_CARD', - 'sub_type' => 'NATIONAL_ID', - 'document_name' => 'KTP', - 'document_number' => '1234567890', - 'expires_at' => '2025-06-02', - 'holder_name' => 'Holder name', - 'document_images' => [ - 'https://file1.jpg', - 'https://file2.jpg' - ] - ] - ], - 'metadata' => [ - 'meta' => 'data' - ], - 'individual_detail' => [ - 'given_names' => 'John', - 'surname' => 'Doe', - 'nationality' => 'ID', - 'date_of_birth' => '1993-12-26', - 'place_of_birth' => 'Cirebon', - 'gender' => 'MALE', - 'employment' => [ - 'employer_name' => 'Employer name', - 'nature_of_business' => 'Business', - 'role_description' => 'Employer' - ] - ], - 'business_detail' => [ - 'business_name' => 'Business name', - 'business_type' => 'NON_PROFIT', - 'nature_of_business' => 'Charity', - 'business_domicile' => 'ID', - 'date_of_registration' => '2005-06-21' - ], - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'street line 1', - 'street_line2' => 'street line 2', - 'city' => 'Cirebon', - 'province_state' => 'Jawa Barat', - 'postal_code' => '21345', - 'category' => 'HOME', - 'is_primary' => true - ] - ], - 'identity_accounts' => [ - [ - 'type' => 'EWALLET', - 'company' => 'GOPAY', - 'description' => 'gopay', - 'country' => 'ID', - 'properties' => [ - 'account_number' => '12345', - 'account_holder_name' => 'John Doe', - 'currency' => 'IDR' - ] - ] - ] - ]; - - const CUSTOMER_RESPONSE_20201031 = [ - 'type' => 'INDIVIDUAL', - 'email' => 'customer@website.com', - 'mobile_number' => '+6281212345678', - 'phone_number' => '+6289987654321', - 'created' => '2021-08-13T12:42:19.476Z', - 'updated' => '2021-08-13T12:42:19.476Z', - 'description' => 'test description', - 'kyc_documents' => [ - [ - 'country' => 'ID', - 'type' => 'IDENTITY_CARD', - 'sub_type' => 'NATIONAL_ID', - 'document_name' => 'KTP', - 'document_number' => '1234567890', - 'expires_at' => '2025-06-02', - 'holder_name' => 'Holder name', - 'document_images' => [ - 'https://file1.jpg', - 'https://file2.jpg' - ] - ] - ], - 'id' => 'cust-db2b4ac3-518b-41bd-873a-4a64f7e18610', - 'reference_id' => 'test-ref-id', - 'metadata' => [ - 'meta' => 'data' - ], - 'individual_detail' => [ - 'given_names' => 'John', - 'surname' => 'Doe', - 'nationality' => 'ID', - 'date_of_birth' => '1993-12-26', - 'place_of_birth' => 'Cirebon', - 'gender' => 'MALE', - 'employment' => [ - 'employer_name' => 'Employer name', - 'role_description' => 'Employer', - 'nature_of_business' => 'Business' - ] - ], - 'business_detail' => null, - 'addresses' => [ - [ - 'country' => 'ID', - 'street_line1' => 'street line 1', - 'street_line2' => 'street line 2', - 'city' => 'Cirebon', - 'province_state' => 'Jawa Barat', - 'postal_code' => '21345', - 'category' => 'HOME', - 'is_primary' => true - ] - ], - 'identity_accounts' => [ - [ - 'type' => 'EWALLET', - 'company' => 'GOPAY', - 'description' => 'gopay', - 'country' => 'ID', - 'properties' => [ - 'currency' => 'IDR', - 'account_number' => '12345', - 'account_holder_name' => 'John Doe' - ] - ] - ] - ]; - - const REFERENCE_ID = 'test-ref-id'; - - const NEW_API_VERSION = array('api-version' => '2020-10-31'); - - /** - * Create customer test 2020-05-19 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerCreatable() - { - $params = self::CUSTOMER_PARAMS_20200519; - - $response = self::CUSTOMER_RESPONSE_20200519; - - $this->stubRequest( - 'POST', - '/customers', - $params, - [], - $response - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test with mobile_number missing 2020-05-19 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerCreatableWithMobileNumberMissing() - { - $params = self::CUSTOMER_PARAMS_20200519; - unset($params['mobile_number']); - - $response = self::CUSTOMER_RESPONSE_20200519; - $response['mobile_number'] = null; - - $this->stubRequest( - 'POST', - '/customers', - $params, - [], - $response - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test with email missing 2020-05-19 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerCreatableWithEmailMissing() - { - $params = self::CUSTOMER_PARAMS_20200519; - unset($params['email']); - - $response = self::CUSTOMER_RESPONSE_20200519; - $response['email'] = null; - - $this->stubRequest( - 'POST', - '/customers', - $params, - [], - $response - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test with headers 2020-05-19 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerCreatableWithHeaders() - { - $params = array_merge( - self::CUSTOMER_PARAMS_20200519, - array('for-user-id' => 'user-id') - ); - - $response = self::CUSTOMER_RESPONSE_20200519; - - $this->stubRequest( - 'POST', - '/customers', - $params, - [], - $response - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test 2020-05-19 version - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'reference_id' => self::REFERENCE_ID - ]; - - Customers::createCustomer($params); - } - - /** - * Get customer test 2020-05-19 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerGettable() - { - $response = [self::CUSTOMER_RESPONSE_20200519]; - - $this->stubRequest( - 'get', - '/customers?reference_id=' . self::REFERENCE_ID, - [], - [], - $response - ); - - $result = Customers::getCustomerByReferenceID( - self::REFERENCE_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Get customer test 2020-05-19 version - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20200519CustomerGettableThrowApiException() - { - - $response = Customers::getCustomerByReferenceID( - self::REFERENCE_ID - ); - $this->assertEquals($response, []); - } - - /** - * Create customer test 2020-10-31 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20201031CustomerCreatable() - { - $params = self::CUSTOMER_PARAMS_20201031; - - $response = self::CUSTOMER_RESPONSE_20201031; - - $this->stubRequest( - 'POST', - '/customers', - $params, - self::NEW_API_VERSION, - $response - ); - - $params = array_merge( - $params, - self::NEW_API_VERSION - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test with headers 2020-10-31 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20201031CustomerCreatableWithHeaders() - { - $params = array_merge( - self::CUSTOMER_PARAMS_20201031, - array('for-user-id' => 'user-id') - ); - - $response = self::CUSTOMER_RESPONSE_20201031; - - $this->stubRequest( - 'POST', - '/customers', - $params, - self::NEW_API_VERSION, - $response - ); - - $params = array_merge( - $params, - self::NEW_API_VERSION - ); - - $result = Customers::createCustomer($params); - - $this->assertEquals($response, $result); - } - - /** - * Create customer test 2020-10-31 version - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20201031CustomerCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'reference_id' => self::REFERENCE_ID, - 'api-version' => '2020-10-31' - ]; - - Customers::createCustomer($params); - } - - /** - * Get customer test 2020-10-31 version - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20201031CustomerGettable() - { - $response = [self::CUSTOMER_RESPONSE_20201031]; - - $this->stubRequest( - 'get', - '/customers?reference_id=' . self::REFERENCE_ID, - [], - self::NEW_API_VERSION, - $response - ); - - $result = Customers::getCustomerByReferenceID( - self::REFERENCE_ID, - self::NEW_API_VERSION - ); - - $this->assertEquals($response, $result); - } - - /** - * Get customer test 2020-10-31 version - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIs20201031CustomerGettableThrowApiException() - { - $response = [ - 'data' => [], - 'has_more' => false - ]; - - $result = Customers::getCustomerByReferenceID( - self::REFERENCE_ID, - self::NEW_API_VERSION - ); - $this->assertEquals($response, $result); - } -} diff --git a/tests/Xendit/DirectDebitTest.php b/tests/Xendit/DirectDebitTest.php deleted file mode 100644 index fc2e7cb..0000000 --- a/tests/Xendit/DirectDebitTest.php +++ /dev/null @@ -1,888 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\DirectDebit; -use Xendit\TestCase; - -/** - * Class DirectDebitTest - * - * @category Class - * @package Xendit - * @author Glenda - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DirectDebitTest extends TestCase -{ - const INITIALIZED_LINKED_ACCOUNT_PARAMS = [ - 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', - 'channel_code' => 'DC_BRI', - 'properties' => [ - 'account_mobile_number' => '+62818555988', - 'card_last_four' => '8888', - 'card_expiry' => '06/24', - 'account_email' => 'test.email@xendit.co' - ], - 'metadata' => [ - 'meta' => 'data' - ] - ]; - - const INITIALIZED_LINKED_ACCOUNT_RESPONSE = [ - 'id' => 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670', - 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', - 'channel_code' => 'DC_BRI', - 'status' => 'PENDING', - 'authorizer_url' => null, - 'metadata' => [ - 'meta' => 'data' - ], - ]; - - const TOKEN_ID = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; - - const VALIDATED_LINKED_ACCOUNT_PARAMS = [ - 'otp_code' => '333000' - ]; - - const VALIDATED_LINKED_ACCOUNT_RESPONSE = [ - 'id' => self::TOKEN_ID, - 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', - 'channel_code' => 'DC_BRI', - 'status' => 'SUCCESS', - 'metadata' => [ - 'meta' => 'data' - ], - ]; - - const ACCESSIBLE_ACCOUNT_RESPONSE = [ - [ - 'channel_code' => 'DC_BRI', - 'id' => 'la-3a1b4458-9f5b-4dfd-8250-f6c3f41f5240', - 'properties' => [ - 'card_expiry' => '06/24', - 'card_last_four' => '8888', - 'currency' => 'IDR', - 'description' => '' - ], - 'type' => 'DEBIT_CARD' - ] - ]; - - const UNBINDED_LINKED_ACCOUNT_RESPONSE = [ - 'id' => self::TOKEN_ID, - 'is_deleted' => true - ]; - - const PAYMENT_METHOD_PARAMS = [ - 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', - 'type' => 'DEBIT_CARD', - 'properties' => [ - 'id' => 'la-55048b41-a7ab-4799-9f33-6ec5cc078db0' - ], - 'metadata' => [ - 'meta' => 'data' - ] - ]; - - const PAYMENT_METHOD_RESPONSE = [ - 'id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', - 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', - 'type' => 'DEBIT_CARD', - 'status' => 'ACTIVE', - 'properties' => [ - 'id' => 'la-55048b41-a7ab-4799-9f33-6ec5cc078db0', - 'currency' => 'IDR', - 'card_expiry' => '11/23', - 'description' => '', - 'channel_code' => 'DC_BRI', - 'card_last_four' => '8888' - ], - 'metadata' => [ - 'meta' => 'data' - ], - 'created' => '2021-07-15T03:17:53.989Z', - 'updated' => '2021-07-15T03:17:53.989Z' - ]; - - const CUSTOMER_ID = '4b7b6050-0830-440a-903b-37d527dbbaa9'; - - const DIRECT_DEBIT_PAYMENT_PARAMS = [ - 'reference_id' => 'test-ref-id', - 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', - 'currency' => 'IDR', - 'amount' => 15000, - 'callback_url' => 'http://webhook.site/', - 'enable_otp' => true, - 'description' => 'test description', - 'basket' => [ - [ - 'reference_id' => 'basket-product-ref-id', - 'name' => 'product name', - 'category' => 'mechanics', - 'market' => 'ID', - 'price' => 50000, - 'quantity' => 5, - 'type' => 'product type', - 'sub_category' => 'product sub category', - 'category' => 'product category', - 'description' => 'product description', - 'url' => 'http://product.url' - ] - ], - 'success_redirect_url' => 'https://success-redirect.url', - 'failure_redirect_url' => 'https://failure-redirect.url', - 'device' => [ - 'id' => 'device-id', - 'ip_address' => '0.0.0.0', - 'user_agent' => 'user-agent', - 'ad_id' => 'ad-id', - 'imei' => '123a456b789c' - ], - 'metadata' => [ - 'meta' => 'data' - ], - 'Idempotency-key' => 'idempotency-keyy' - ]; - - const DIRECT_DEBIT_PAYMENT_RESPONSE = [ - 'id' => 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', - 'reference_id' => 'test-ref-id', - 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', - 'channel_code' => 'DC_BRI', - 'currency' => 'IDR', - 'amount' => 15000, - 'is_otp_required' => true, - 'basket' => [ - [ - 'reference_id' => 'basket-product-ref-id', - 'name' => 'product name', - 'category' => 'mechanics', - 'market' => 'ID', - 'price' => 50000, - 'quantity' => 5, - 'type' => 'product type', - 'sub_category' => 'product sub category', - 'category' => 'product category', - 'description' => 'product description', - 'url' => 'http://product.url' - ] - ], - 'description' => 'test description', - 'status' => 'PENDING', - 'callback_url' => 'http://webhook.site/', - 'enable_otp' => true, - 'metadata' => [ - 'meta' => 'data' - ], - 'created' => '2021-07-16T02:19:07.277466Z', - 'updated' => '2021-07-16T02:19:07.277466Z', - 'device' => [ - 'id' => 'device-id', - 'ip_address' => '0.0.0.0', - 'user_agent' => 'user-agent', - 'ad_id' => 'ad-id', - 'imei' => '123a456b789c' - ], - 'refunded_amount' => 0, - 'refunds' => [ - 'data' => [ - 'a1b', 'c2d', 'e3f', 'g4h' - ], - 'has_more' => false, - 'url' => 'https://ref.unds' - ], - 'failure_code' => 'failure-code', - 'otp_mobile_number' => '+6281234567890', - 'otp_expiration_timestamp' => '2100-07-16T02:19:07.277466Z', - 'success_redirect_url' => 'https://success-redirect.url', - 'checkout_url' => 'https://checkout.url', - 'failure_redirect_url' => 'https://failure-redirect.url', - 'required_action' => 'VALIDATE_OTP' - ]; - - const VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE = [ - 'id' => 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', - 'reference_id' => 'test-ref-id', - 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', - 'channel_code' => 'DC_BRI', - 'currency' => 'IDR', - 'amount' => 15000, - 'is_otp_required' => true, - 'basket' => [ - [ - 'reference_id' => 'basket-product-ref-id', - 'name' => 'product name', - 'category' => 'mechanics', - 'market' => 'ID', - 'price' => 50000, - 'quantity' => 5, - 'type' => 'product type', - 'sub_category' => 'product sub category', - 'category' => 'product category', - 'description' => 'product description', - 'url' => 'http://product.url' - ] - ], - 'description' => 'test description', - 'status' => 'COMPLETED', - 'callback_url' => 'http://webhook.site/', - 'enable_otp' => true, - 'metadata' => [ - 'meta' => 'data' - ], - 'created' => '2021-07-16T02:19:07.277466Z', - 'updated' => '2021-07-16T02:19:07.277466Z', - 'device' => [ - 'id' => 'device-id', - 'ip_address' => '0.0.0.0', - 'user_agent' => 'user-agent', - 'ad_id' => 'ad-id', - 'imei' => '123a456b789c' - ], - 'refunded_amount' => 0, - 'refunds' => [ - 'data' => [ - 'a1b', 'c2d', 'e3f', 'g4h' - ], - 'has_more' => false, - 'url' => 'https://ref.unds' - ], - 'failure_code' => 'failure-code', - 'otp_mobile_number' => '+6281234567890', - 'otp_expiration_timestamp' => '2100-07-16T02:19:07.277466Z', - 'success_redirect_url' => 'https://success-redirect.url', - 'checkout_url' => 'https://checkout.url', - 'failure_redirect_url' => 'https://failure-redirect.url', - 'required_action' => 'VALIDATE_OTP' - ]; - - const DIRECT_DEBIT_PAYMENT_ID = 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c'; - - const VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS = [ - 'otp_code' => '222000' - ]; - - const REFERENCE_ID = 'test-ref-id'; - - /** - * Initialize linked account tokenization test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountTokenizationInitializable() - { - $params = self::INITIALIZED_LINKED_ACCOUNT_PARAMS; - - $response = self::INITIALIZED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'POST', - '/linked_account_tokens/auth', - $params, - [], - $response - ); - - $result = DirectDebit::initializeLinkedAccountTokenization($params); - - $this->assertEquals($response, $result); - } - - /** - * Initialize linked account tokenization with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountTokenizationInitializableWithHeaders() - { - $params = array_merge( - self::INITIALIZED_LINKED_ACCOUNT_PARAMS, - array('for-user-id' => 'user-id') - ); - - $response = self::INITIALIZED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'POST', - '/linked_account_tokens/auth', - $params, - [], - $response - ); - - $result = DirectDebit::initializeLinkedAccountTokenization($params); - - $this->assertEquals($response, $result); - } - - /** - * Initialize linked account tokenization test - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountTokenizationInitializableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = self::INITIALIZED_LINKED_ACCOUNT_PARAMS; - - DirectDebit::initializeLinkedAccountTokenization($params); - } - - /** - * Validate OTP for linked account test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountOTPValidatable() - { - $params = self::VALIDATED_LINKED_ACCOUNT_PARAMS; - - $response = self::VALIDATED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'POST', - '/linked_account_tokens/' . self::TOKEN_ID . '/validate_otp', - $params, - [], - $response - ); - - $result = DirectDebit::validateOTPForLinkedAccount( - self::TOKEN_ID, - $params - ); - - $this->assertEquals($response, $result); - } - - /** - * Validate OTP for linked account test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountOTPValidatableWithHeaders() - { - // $token_id = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; - - $params = array_merge( - self::VALIDATED_LINKED_ACCOUNT_PARAMS, - array('for-user-id' => 'user-id') - ); - - $response = self::VALIDATED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'POST', - '/linked_account_tokens/' . self::TOKEN_ID . '/validate_otp', - $params, - [], - $response - ); - - $result = DirectDebit::validateOTPForLinkedAccount( - self::TOKEN_ID, - $params - ); - - $this->assertEquals($response, $result); - } - - /** - * Validate OTP for linked account test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountOTPValidatableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - // $token_id = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; - - $params = self::VALIDATED_LINKED_ACCOUNT_PARAMS; - - DirectDebit::validateOTPForLinkedAccount( - self::TOKEN_ID, - $params - ); - } - - /** - * Retrieve accessible linked accounts test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsAccessibleLinkedAccountRetrievable() - { - $response = self::ACCESSIBLE_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'GET', - '/linked_account_tokens/' . self::TOKEN_ID . '/accounts', - [], - [], - $response - ); - - $result = DirectDebit::retrieveAccessibleLinkedAccounts( - self::TOKEN_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Retrieve accessible linked accounts test - * Should throw apiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsAccessibleLinkedAccountRetrievableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - DirectDebit::retrieveAccessibleLinkedAccounts( - self::TOKEN_ID - ); - } - - /** - * Unbind linked account token test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountTokenUnbindable() - { - $response = self::UNBINDED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'DELETE', - '/linked_account_tokens/' . self::TOKEN_ID, - [], - [], - $response - ); - - $result = DirectDebit::unbindLinkedAccountToken( - self::TOKEN_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Unbind linked account token test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountUnbindableWithHeaders() - { - $params = [ - 'for-user-id' => 'user-id' - ]; - - $response = self::UNBINDED_LINKED_ACCOUNT_RESPONSE; - - $this->stubRequest( - 'DELETE', - '/linked_account_tokens/' . self::TOKEN_ID, - [], - [], - $response - ); - - $result = DirectDebit::unbindLinkedAccountToken( - self::TOKEN_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Unbind linked account test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsLinkedAccountUnbindableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - DirectDebit::unbindLinkedAccountToken( - self::TOKEN_ID - ); - } - - /** - * Create payment method test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPaymentMethodCreatable() - { - $params = self::PAYMENT_METHOD_PARAMS; - - $response = self::PAYMENT_METHOD_RESPONSE; - - $this->stubRequest( - 'POST', - '/payment_methods', - $params, - [], - $response - ); - - $result = DirectDebit::createPaymentMethod($params); - - $this->assertEquals($response, $result); - } - - /** - * Create payment method test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPaymentMethodCreatableWithHeaders() - { - $params = array_merge( - self::PAYMENT_METHOD_PARAMS, - array('for-user-id' => 'user-id') - ); - - $response = self::PAYMENT_METHOD_RESPONSE; - - $this->stubRequest( - 'POST', - '/payment_methods', - $params, - [], - $response - ); - - $result = DirectDebit::createPaymentMethod($params); - - $this->assertEquals($response, $result); - } - - /** - * Create payment method test - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPaymentMethodCreatableThrowApiException() - { - // $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = self::PAYMENT_METHOD_PARAMS; - - DirectDebit::createPaymentMethod($params); - } - - /** - * Get payment method test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPaymentMethodGettable() - { - $response = [self::PAYMENT_METHOD_RESPONSE]; - - $this->stubRequest( - 'GET', - '/payment_methods?customer_id=' . self::CUSTOMER_ID, - [], - [], - $response - ); - - $result = DirectDebit::getPaymentMethodsByCustomerID( - self::CUSTOMER_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Get payment method test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPaymentMethodGettableButNotFound() - { - $result = DirectDebit::getPaymentMethodsByCustomerID(self::CUSTOMER_ID); - $this->assertEquals($result, []); - } - - /** - * Create direct debit payment test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentCreatable() - { - $params = self::DIRECT_DEBIT_PAYMENT_PARAMS; - - $response = self::DIRECT_DEBIT_PAYMENT_RESPONSE; - - $this->stubRequest( - 'POST', - '/direct_debits', - $params, - [], - $response - ); - - $result = DirectDebit::createDirectDebitPayment($params); - - $this->assertEquals($response, $result); - } - - /** - * Create direct debit payment test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentCreatableWithHeaders() - { - $params = array_merge( - self::DIRECT_DEBIT_PAYMENT_PARAMS, - array('for-user-id' => 'user-id') - ); - - $response = self::DIRECT_DEBIT_PAYMENT_RESPONSE; - - $this->stubRequest( - 'POST', - '/direct_debits', - $params, - [], - $response - ); - - $result = DirectDebit::createDirectDebitPayment($params); - - $this->assertEquals($response, $result); - } - - /** - * Create direct debit payment test - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentCreatableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = self::DIRECT_DEBIT_PAYMENT_PARAMS; - - DirectDebit::createDirectDebitPayment($params); - } - - /** - * Validate OTP for direct debit payment - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentOTPValidatable() - { - $params = self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS; - - $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; - - $this->stubRequest( - 'POST', - '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/validate_otp/', - $params, - [], - $response - ); - - $result = DirectDebit::validateOTPForDirectDebitPayment( - self::DIRECT_DEBIT_PAYMENT_ID, - $params - ); - - $this->assertEquals($response, $result); - } - - /** - * Validate OTP for direct debit payment test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentOTPValidatableWithHeaders() - { - $params = array_merge( - self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS, - array('for-user-id' => 'user-id') - ); - - $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; - - $this->stubRequest( - 'POST', - '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/validate_otp/', - $params, - [], - $response - ); - - $result = DirectDebit::validateOTPForDirectDebitPayment( - self::DIRECT_DEBIT_PAYMENT_ID, - $params - ); - - $this->assertEquals($response, $result); - } - - /** - * Validate OTP for direct debit payment test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentValidatableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - $params = self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS; - - DirectDebit::validateOTPForDirectDebitPayment( - self::DIRECT_DEBIT_PAYMENT_ID, - $params - ); - } - - /** - * Get direct debit payment test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentGettableByID() - { - $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; - - $this->stubRequest( - 'GET', - '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/', - [], - [], - $response - ); - - $result = DirectDebit::getDirectDebitPaymentByID( - self::DIRECT_DEBIT_PAYMENT_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Get direct debit payment test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentGettableByIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - DirectDebit::getDirectDebitPaymentByID(self::DIRECT_DEBIT_PAYMENT_ID); - } - - /** - * Get direct debit payment test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentGettableByReferenceID() - { - $response = [self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE]; - - $this->stubRequest( - 'GET', - '/direct_debits?reference_id=' . self::REFERENCE_ID, - [], - [], - $response - ); - - $result = DirectDebit::getDirectDebitPaymentByReferenceID( - self::REFERENCE_ID - ); - - $this->assertEquals($response, $result); - } - - /** - * Get direct debit payment test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsDirectDebitPaymentGettableByReferenceIDButNotFound() - { - $result = DirectDebit::getDirectDebitPaymentByReferenceID( - self::REFERENCE_ID - ); - $this->assertEquals($result, []); - } -} diff --git a/tests/Xendit/DisbursementsChannelsTest.php b/tests/Xendit/DisbursementsChannelsTest.php deleted file mode 100644 index 1650906..0000000 --- a/tests/Xendit/DisbursementsChannelsTest.php +++ /dev/null @@ -1,217 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\DisbursementChannels; -use Xendit\TestCase; - -/** - * Class DisbursementsChannelsTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DisbursementsChannelsTest extends TestCase -{ - const CHANNEL_CATEGORY = "BANK"; - const CHANNEL_CODE = "PH_CIMB"; - - - /** - * Get Disbursement Channels - * Should pass - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ], [ - * 'channel_code'=> 'PH_CITI', - * 'name'=> 'Citibank, N.A.', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 1, - * 'maximum'=> 999999999, - * 'minimum_increment'=> 1 - * ]] - * @throws Exceptions\ApiException - */ - public function testIsGettableDisbursementChannels() - { - $expectedResponse = [ - [ - 'channel_code' => 'PH_CIMB', - 'name' => 'CIMB Bank Philippines Inc', - 'channel_category' => 'BANK', - 'currency' => 'PHP', - 'minimum' => 50000, - 'maximum' => 200000000, - 'minimum_increment' => 0.01 - ], [ - 'channel_code' => 'PH_CITI', - 'name' => 'Citibank, N.A.', - 'channel_category' => 'BANK', - 'currency' => 'PHP', - 'minimum' => 1, - 'maximum' => 999999999, - 'minimum_increment' => 1 - ] - ]; - $this->stubRequest( - 'GET', - '/disbursement-channels', - [], - [], - $expectedResponse - ); - - $result = DisbursementChannels::getDisbursementChannels(); - $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); - $this->assertEquals($result[1]['channel_code'], $expectedResponse[1]['channel_code']); - $this->assertCount(2, $result); - } - - /** - * Get Disbursement Channels by channel category - * Should pass - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ], [ - * 'channel_code'=> 'PH_CITI', - * 'name'=> 'Citibank, N.A.', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 1, - * 'maximum'=> 999999999, - * 'minimum_increment'=> 1 - * ]] - * @throws Exceptions\ApiException - */ - public function testIsGettableDisbursementChannelsByChannelCategory() - { - $expectedResponse = [ - [ - 'channel_code' => 'PH_CIMB', - 'name' => 'CIMB Bank Philippines Inc', - 'channel_category' => 'BANK', - 'currency' => 'PHP', - 'minimum' => 50000, - 'maximum' => 200000000, - 'minimum_increment' => 0.01 - ], [ - 'channel_code' => 'PH_CITI', - 'name' => 'Citibank, N.A.', - 'channel_category' => 'BANK', - 'currency' => 'PHP', - 'minimum' => 1, - 'maximum' => 999999999, - 'minimum_increment' => 1 - ] - ]; - $this->stubRequest( - 'GET', - '/disbursement-channels?channel_category=' . self::CHANNEL_CATEGORY, - [], - [], - $expectedResponse - ); - - $result = DisbursementChannels::getDisbursementChannelsByChannelCategory(self::CHANNEL_CATEGORY); - $this->assertEquals($result[0]['channel_category'], $expectedResponse[0]['channel_category']); - $this->assertEquals($result[1]['channel_category'], $expectedResponse[1]['channel_category']); - $this->assertCount(2, $result); - } - - /** - * Get Disbursement Channels by Channel Category test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableDisbursementChannelsByChannelCategoryThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - DisbursementChannels::getDisbursementChannelsByChannelCategory(null); - } - - /** - * Get Disbursement Channels by Channel Code - * Should pass - * - * @return array[ - * [ - * 'channel_code'=> 'PH_CIMB', - * 'name'=> 'CIMB Bank Philippines Inc', - * 'channel_category'=> 'BANK', - * 'currency'=> 'PHP', - * 'minimum'=> 50000, - * 'maximum'=> 200000000, - * 'minimum_increment'=> 0.01 - * ]] - * @throws Exceptions\ApiException - */ - public function testIsGettableDisbursementChannelsByChannelCode() - { - $expectedResponse = [ - [ - 'channel_code' => 'PH_CIMB', - 'name' => 'CIMB Bank Philippines Inc', - 'channel_category' => 'BANK', - 'currency' => 'PHP', - 'minimum' => 50000, - 'maximum' => 200000000, - 'minimum_increment' => 0.01 - ] - ]; - $this->stubRequest( - 'GET', - '/disbursement-channels?channel_code=' . self::CHANNEL_CODE, - [], - [], - $expectedResponse - ); - - $result = DisbursementChannels::getDisbursementChannelsByChannelCode(self::CHANNEL_CODE); - $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); - $this->assertCount(1, $result); - } - - /** - * Get Disbursement Channels by Channel Code test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableDisbursementChannelsByChannelCodeThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - DisbursementChannels::getDisbursementChannelsByChannelCode(null); - } -} diff --git a/tests/Xendit/DisbursementsPHPTest.php b/tests/Xendit/DisbursementsPHPTest.php deleted file mode 100644 index ae6b423..0000000 --- a/tests/Xendit/DisbursementsPHPTest.php +++ /dev/null @@ -1,261 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\DisbursementsPHP; -use Xendit\TestCase; - -/** - * Class DisbursementsPHPTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DisbursementsPHPTest extends TestCase -{ - const TEST_ID = "123"; - - /** - * Create PHP Disbursements test - * Should pass - * - * @return array[ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * @throws Exceptions\ApiException - */ - public function testIsCreatablePHPDisbursement() - { - $params = [ - 'xendit-idempotency-key' => 'disb-12345678', - 'reference_id' => 'disb-12345678', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'BCA', - 'account_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' - ]; - - $expectedResponse = $params; - $expectedResponse['id'] = self::TEST_ID; - $this->stubRequest( - 'POST', - '/disbursements', - $params, - [], - $expectedResponse - ); - - $result = DisbursementsPHP::createPHPDisbursement($params); - $this->assertEquals($result['id'], self::TEST_ID); - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['channel_code'], $params['channel_code']); - $this->assertEquals( - $result['account_name'], - $params['account_name'] - ); - $this->assertEquals($result['account_number'], $params['account_number']); - $this->assertEquals($result['description'], $params['description']); - } - - /** - * Create PHP Disbursements test - * Should throw InvalidArgumentException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsCreatePHPDisbThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - DisbursementsPHP::createPHPDisbursement($params); - } - - /** - * Create PHP Disbursements test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsCreatePHPDisbThrowApiException() - { - $params = [ - 'xendit-idempotency-key' => 'disb-12345678', - 'reference_id' => 'disb-12345678', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'BCA', - 'account_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' - ]; - $this->expectException(\Xendit\Exceptions\ApiException::class); - - DisbursementsPHP::createPHPDisbursement($params); - } - - /** - * Get PHP Disbursements by ID test - * Should pass - * - * @return array[ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array - * ] - * @throws Exceptions\ApiException - */ - public function testIsGettableByPHPDisbursementID() - { - $expectedResponse = [ - 'id' => self::TEST_ID, - 'xendit_idempotency_key' => 'disb-12345678', - 'reference_id' => 'disb-12345678', - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'BCA', - 'account_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' - ]; - $this->stubRequest( - 'GET', - '/disbursements/' . self::TEST_ID, - [], - [], - $expectedResponse - ); - - $result = DisbursementsPHP::getPHPDisbursementByID(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - $this->assertEquals($result['reference_id'], $expectedResponse['reference_id']); - $this->assertEquals($result['amount'], $expectedResponse['amount']); - $this->assertEquals($result['channel_code'], $expectedResponse['channel_code']); - $this->assertEquals( - $result['account_name'], - $expectedResponse['account_name'] - ); - $this->assertEquals($result['account_number'], $expectedResponse['account_number']); - $this->assertEquals($result['description'], $expectedResponse['description']); - } - - /** - * Get PHP Disbursements by Disbursement ID test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableByPHPDisbursementIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - DisbursementsPHP::getPHPDisbursementByID(self::TEST_ID); - } - - /** - * Get PHP Disbursements by Reference ID test - * Should pass - * - * @return array[ - * [ - * 'id'=> 'disb-random-id', - * 'reference_id'=> 'random id', - * 'currency'=> 'PHP', - * 'amount'=> float - * 'channel_code'=> 'BRI', - * 'description'=> 'description', - * 'status'=> 'Pending', - * 'created'=> 'Date', - * 'updated'=> 'Date', - * receipt_notification => Array - * beneficiary => Array] - * @throws Exceptions\ApiException - */ - public function testIsGettablePHPDisbursementsByReferenceID() - { - $expectedResponse = [ - [ - 'id' => 'disb-12345678', - 'xendit_idempotency_key' => 'disb-12345678', - 'reference_id' => self::TEST_ID, - 'currency' => 'PHP', - 'amount' => 15000, - 'channel_code' => 'BCA', - 'account_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' - ] - ]; - $this->stubRequest( - 'GET', - '/disbursements?reference_id=' . self::TEST_ID, - [], - [], - $expectedResponse - ); - - $result = DisbursementsPHP::getPHPDisbursementsByReferenceID(self::TEST_ID); - $this->assertEquals($result[0]['id'], $expectedResponse[0]['id']); - $this->assertEquals($result[0]['reference_id'], self::TEST_ID); - $this->assertEquals($result[0]['amount'], $expectedResponse[0]['amount']); - $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); - $this->assertEquals( - $result[0]['account_name'], - $expectedResponse[0]['account_name'] - ); - $this->assertEquals($result[0]['account_number'], $expectedResponse[0]['account_number']); - $this->assertEquals($result[0]['description'], $expectedResponse[0]['description']); - } - - /** - * Get PHP Disbursements by Reference ID test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettablePHPDisbursementsByReferenceIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - $result = DisbursementsPHP::getPHPDisbursementsByReferenceID(null); - var_dump($result); - } -} diff --git a/tests/Xendit/DisbursementsTest.php b/tests/Xendit/DisbursementsTest.php deleted file mode 100644 index b2afdaa..0000000 --- a/tests/Xendit/DisbursementsTest.php +++ /dev/null @@ -1,256 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Disbursements; -use Xendit\TestCase; - -/** - * Class DisbursementsTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class DisbursementsTest extends TestCase -{ - const TEST_ID = "123"; - const CHANNEL_CATEGORY = "BANK"; - const CHANNEL_CODE = "PH_CIMB"; - - /** - * Create Disbursements test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => 'disb-12345678', - 'amount' => 15000, - 'bank_code' => 'BCA', - 'account_holder_name' => 'Joe', - 'account_number' => '1234567890', - 'description' => 'Disbursement from Example' - ]; - - $this->stubRequest( - 'POST', - '/disbursements', - $params, - [], - $params - ); - - $result = Disbursements::create($params); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['bank_code'], $params['bank_code']); - $this->assertEquals( - $result['account_holder_name'], - $params['account_holder_name'] - ); - $this->assertEquals($result['account_number'], $params['account_number']); - $this->assertEquals($result['description'], $params['description']); - } - - /** - * Create Batch Disbursements test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsBatchCreatable() - { - $params = [ - 'reference' => 'disb_batch-12345678', - 'disbursements' => [ - [ - 'amount' => 20000, - 'bank_code' => 'BCA', - 'bank_account_name' => 'Fadlan', - 'bank_account_number' => '1234567890', - 'description' => 'Batch Disbursement', - 'external_id' => 'disbursement-1' - ], - [ - 'amount' => 30000, - 'bank_code' => 'MANDIRI', - 'bank_account_name' => 'Lutfi', - 'bank_account_number' => '1234567891', - 'description' => 'Batch Disbursement with email notifications', - 'external_id' => 'disbursement-2', - 'email_to' => ['test+to@xendit.co'], - 'email_cc' => ['test+cc@xendit.co'], - 'email_bcc' => ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] - ] - ] - ]; - - $this->stubRequest( - 'POST', - '/batch_disbursements', - $params, - [], - $params - ); - - $result = Disbursements::createBatch($params); - $this->assertEquals($result['reference'], $params['reference']); - $this->assertEquals($result['disbursements'], $params['disbursements']); - } - - /** - * Get DisbursementsBanks test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testBanksIsGettable() - { - $expectedResponse = [[ - 'name' => 'Bank Mandiri', - 'code' => 'MANDIRI', - 'can_disburse' => true, - 'can_name_validate' => true - ]]; - $this->stubRequest( - 'GET', - '/available_disbursements_banks', - [], - [], - $expectedResponse - ); - - $result = Disbursements::getAvailableBanks(); - $this->assertEquals($result[0]['name'], $expectedResponse[0]['name']); - $this->assertEquals($result[0]['code'], $expectedResponse[0]['code']); - $this->assertEquals( - $result[0]['can_disburse'], - $expectedResponse[0]['can_disburse'] - ); - $this->assertEquals( - $result[0]['can_name_validate'], - $expectedResponse[0]['can_name_validate'] - ); - } - - /** - * Get Disbursements by ID test - * Should pass - * - * @return void - */ - public function testIsGettableByID() - { - $this->stubRequest( - 'GET', - '/disbursements/' . self::TEST_ID, - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = Disbursements::retrieve(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Get Disbursements by External ID test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableByExternalID() - { - $this->stubRequest( - 'GET', - '/disbursements?external_id=' . self::TEST_ID, - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = Disbursements::retrieveExternal(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Create Disbursements test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - Disbursements::create($params); - } - - /** - * Create Batchs Disbursements test - * Should throw InvalidArgumentException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsBatchCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - Disbursements::createBatch($params); - } - - /** - * Get Disbursements by ID test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableByIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Disbursements::retrieve(self::TEST_ID); - } - - /** - * Get Disbursements by External ID test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableByExtIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Disbursements::retrieveExternal(self::TEST_ID); - } -} diff --git a/tests/Xendit/EWalletsTest.php b/tests/Xendit/EWalletsTest.php deleted file mode 100644 index 85d78f7..0000000 --- a/tests/Xendit/EWalletsTest.php +++ /dev/null @@ -1,720 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\EWallets; -use Xendit\TestCase; - -/** - * Class EWalletsTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class EWalletsTest extends TestCase -{ - const TEST_ID = "123"; - const TEST_TYPE = "DANA"; - const TEST_CHARGE_ID = "ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c"; - const TEST_REFUND_ID = "ewr_532as23lew2321id"; - - /** - * Create EWallet test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => 'demo_' . time(), - 'amount' => 32000, - 'phone' => '081298498259', - 'expiration_date' => '2020-02-20T00:00:00.000Z', - 'callback_url' => 'https://my-shop.com/callbacks', - 'redirect_url' => 'https://my-shop.com/home', - 'ewallet_type' => 'DANA', - ]; - - $this->stubRequest( - 'POST', - '/ewallets', - $params, - [], - $params - ); - - $result = EWallets::create($params); - - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['phone'], $params['phone']); - $this->assertEquals( - $result['ewallet_type'], - $params['ewallet_type'] - ); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals( - $result['callback_url'], - $params['callback_url'] - ); - $this->assertEquals( - $result['redirect_url'], - $params['redirect_url'] - ); - $this->assertEquals( - $result['expiration_date'], - $params['expiration_date'] - ); - } - - /** - * Create EWallet test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsCreatableWithApiVersion() - { - $params = [ - 'external_id' => 'demo_' . time(), - 'amount' => 32000, - 'phone' => '081298498259', - 'expiration_date' => '2020-02-20T00:00:00.000Z', - 'callback_url' => 'https://my-shop.com/callbacks', - 'redirect_url' => 'https://my-shop.com/home', - 'ewallet_type' => 'OVO', - 'x-api-version' => '2019-02-04', - ]; - - $this->stubRequest( - 'POST', - '/ewallets', - $params, - [], - $params - ); - - $result = EWallets::create($params); - - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['phone'], $params['phone']); - $this->assertEquals( - $result['ewallet_type'], - $params['ewallet_type'] - ); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals( - $result['callback_url'], - $params['callback_url'] - ); - $this->assertEquals( - $result['redirect_url'], - $params['redirect_url'] - ); - $this->assertEquals( - $result['expiration_date'], - $params['expiration_date'] - ); - } - - /** - * Get EWallets Payment test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsGettable() - { - $params = [ - 'external_id' => self::TEST_ID, - 'amount' => 32000, - 'phone' => '081298498259', - 'expiration_date' => '2020-02-20T00:00:00.000Z', - 'callback_url' => 'https://my-shop.com/callbacks', - 'redirect_url' => 'https://my-shop.com/home', - 'ewallet_type' => 'DANA' - ]; - - $this->stubRequest( - 'get', - '/ewallets?external_id='.self::TEST_ID. - '&ewallet_type='.self::TEST_TYPE, - [], - [], - $params - ); - - $result = EWallets::getPaymentStatus( - self::TEST_ID, - self::TEST_TYPE - ); - - $this->assertEquals( - $result['ewallet_type'], - self::TEST_TYPE - ); - } - - /** - * Create EWallets test - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - EWallets::create($params); - } - - /** - * Get EWallets Payment test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - EWallets::getPaymentStatus( - self::TEST_ID, - self::TEST_TYPE - ); - } - - /** - * Create EWallet Charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsEWalletChargeCreatable() - { - $params = [ - 'reference_id' => 'test-reference-id', - 'currency' => 'IDR', - 'amount' => 50000, - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'channel_code' => 'ID_SHOPEEPAY', - 'channel_properties' => [ - 'success_redirect_url' => 'https://yourwebsite.com/order/123', - ], - 'metadata' => [ - 'meta' => 'data' - ] - ]; - - $this->stubRequest( - 'POST', - '/ewallets/charges', - $params, - [], - $params - ); - - $result = EWallets::createEWalletCharge($params); - - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['currency'], $params['currency']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals( - $result['checkout_method'], - $params['checkout_method'] - ); - $this->assertEquals( - $result['channel_code'], - $params['channel_code'] - ); - $this->assertEquals( - $result['channel_properties'], - $params['channel_properties'] - ); - $this->assertEquals( - $result['metadata'], - $params['metadata'] - ); - } - - /** - * Create EWallet Charge test with headers - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsEWalletChargeCreatableWithHeaders() - { - $params = [ - 'reference_id' => 'test-reference-id', - 'currency' => 'IDR', - 'amount' => 50000, - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'channel_code' => 'ID_SHOPEEPAY', - 'channel_properties' => [ - 'success_redirect_url' => 'https://yourwebsite.com/order/123', - ], - 'metadata' => [ - 'meta' => 'data' - ], - 'for-user-id' => 'user-id', - 'with-fee-rule' => 'fee-rule' - ]; - - $this->stubRequest( - 'POST', - '/ewallets/charges', - $params, - [], - $params - ); - - $result = EWallets::createEWalletCharge($params); - - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['currency'], $params['currency']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals( - $result['checkout_method'], - $params['checkout_method'] - ); - $this->assertEquals( - $result['channel_code'], - $params['channel_code'] - ); - $this->assertEquals( - $result['channel_properties'], - $params['channel_properties'] - ); - $this->assertEquals( - $result['metadata'], - $params['metadata'] - ); - } - - /** - * Create EWallets Charge test - * Should throw InvalidArgumentException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsEWalletChargeCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'reference_id' => 'test-ref-id' - ]; - - EWallets::createEWalletCharge($params); - } - - /** - * Get EWallets Charge Status test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsEWalletChargeGettable() - { - $params = [ - 'id' => self::TEST_CHARGE_ID, - 'business_id' => 'business_id_example', - 'reference_id' => self::TEST_ID, - 'status' => 'PENDING', - 'currency' => 'IDR', - 'charge_amount' => 50000, - 'capture_amount' => 50000, - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'channel_code' => 'ID_SHOPEEPAY', - 'channel_properties' => [ - 'success_redirect_url' => 'https://yourwebsite.com/order/123' - ], - 'actions' => [ - 'desktop_web_checkout_url' => null, - 'mobile_web_checkout_url' => null, - 'mobile_deeplink_checkout_url' => - 'https://mobile.deeplink.checkout.url', - 'qr_checkout_string' => 'test-qr-string' - ], - 'is_redirect_required' => true, - 'callback_url' => 'https://yourwebsite.com/order/123', - 'created' => '2021-02-09T06:22:35.064408Z', - 'updated' => '2021-02-09T06:22:35.064408Z', - 'voided_at' => null, - 'capture_now' => true, - 'customer_id' => null, - 'payment_method_id' => null, - 'failure_code' => null, - 'basket' => null, - 'metadata' => null - ]; - - $this->stubRequest( - 'get', - '/ewallets/charges/'.self::TEST_CHARGE_ID, - [], - [], - $params - ); - - $result = EWallets::getEWalletChargeStatus( - self::TEST_CHARGE_ID - ); - - $this->assertEquals( - $result['id'], - self::TEST_CHARGE_ID - ); - } - - /** - * Get EWallets Charge Status test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsEWalletChargeGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - EWallets::getEWalletChargeStatus( - self::TEST_CHARGE_ID - ); - } - - /** - * Void eWallet Charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testVoidEwalletChargeCreateable() - { - $response = [ - "id" => "ewc_532as23lew2321id", - "business_id" => "5easfnn23aadlmnaa42", - "reference_id" => "test_reference_id", - "status" => "SUCCEEDED", - "currency" => "IDR", - "charge_amount" => 123456, - "capture_amount" => 123456, - "refunded_amount" => null, - "checkout_method" => "ONE_TIME_PAYMENT", - "channel_code" => "ID_OVO", - "channel_properties" => - [ - "mobile_number" => "+6287777771111" - ], - "actions" => null, - "is_redirect_required" => false, - "callback_url" => "https=>//webhook.me/gethooked", - "created" => "2020-04-20T16:23:52Z", - "updated" => "2020-04-20T16:23:52Z", - "void_status" => "PENDING", - "voided_at" => null, - "capture_now" => true, - "customer_id" => null, - "payment_method_id" => null, - "failure_code" => null, - "basket" => null, - "metadata" => - [ - "branch_code" => "senayan_372" - ] - ]; - - $this->stubRequest( - 'POST', - '/ewallets/charges/'.self::TEST_CHARGE_ID.'/void', - [], - [], - $response - ); - - $result = EWallets::voidEwalletCharge( - self::TEST_CHARGE_ID - ); - - $this->assertEquals( - $result['id'], - 'ewc_532as23lew2321id' - ); - $this->assertEquals( - $result['currency'], - 'IDR' - ); - $this->assertEquals( - $result['status'], - 'SUCCEEDED' - ); - $this->assertEquals( - $result['charge_amount'], - '123456' - ); - $this->assertEquals( - $result['capture_amount'], - '123456' - ); - $this->assertEquals( - $result['refunded_amount'], - null - ); - $this->assertEquals( - $result['checkout_method'], - 'ONE_TIME_PAYMENT' - ); - $this->assertEquals( - $result['channel_code'], - 'ID_OVO' - ); - } - - /** - * Void EWallets Charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testVoidEwalletChargeCreateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - EWallets::voidEwalletCharge( - self::TEST_CHARGE_ID - ); - } - - /** - * Refund eWallet Charge test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testRefundEwalletChargeCreateable() - { - $response = [ - "id" => "ewr_532as23lew2321id", - "charge_id" => self::TEST_CHARGE_ID, - "status" => "PENDING", - "currency" => "IDR", - "channel_code" => "ID_OVO", - "capture_amount" => 123456, - "refund_amount" => 123456, - "reason" => "REQUESTED_BY_CUSTOMER", - "failure_code" => null, - "created" => "2020-04-20T16:23:52Z", - "updated" => "2020-04-20T16:23:52Z" - ]; - - $this->stubRequest( - 'POST', - '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds', - [], - [], - $response - ); - - $result = EWallets::refundEwalletCharge( - self::TEST_CHARGE_ID - ); - - $this->assertEquals( - $result['id'], - "ewr_532as23lew2321id" - ); - $this->assertEquals( - $result['currency'], - 'IDR' - ); - $this->assertEquals( - $result['status'], - 'PENDING' - ); - $this->assertEquals( - $result['capture_amount'], - '123456' - ); - $this->assertEquals( - $result['refund_amount'], - 123456 - ); - $this->assertEquals( - $result['reason'], - 'REQUESTED_BY_CUSTOMER' - ); - $this->assertEquals( - $result['channel_code'], - 'ID_OVO' - ); - } - - /** - * Refund EWallets Charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testRefundEwalletChargeCreateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - EWallets::refundEwalletCharge( - self::TEST_CHARGE_ID - ); - } - - /** - * Get Refund Ewallet test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testGetRefundGettable() - { - $response = [ - "id" => "ewr_532as23lew2321id", - "charge_id" => self::TEST_CHARGE_ID, - "status" => "SUCCEEDED", - "currency" => "IDR", - "channel_code" => "ID_OVO", - "capture_amount" => 123456, - "refund_amount" => 100000, - "reason" => "REQUESTED_BY_CUSTOMER", - "failure_code" => null, - "created" => "2020-04-20T16:23:52Z", - "updated" => "2020-04-20T16:23:52Z" - ]; - - $this->stubRequest( - 'GET', - '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds/'.self::TEST_REFUND_ID, - [], - [], - $response - ); - - $result = EWallets::getRefund( - self::TEST_CHARGE_ID, - self::TEST_REFUND_ID - ); - $this->assertEquals( - $result['status'], - "SUCCEEDED" - ); - $this->assertEquals( - $result['id'], - "ewr_532as23lew2321id" - ); - $this->assertEquals( - $result['currency'], - 'IDR' - ); - $this->assertEquals( - $result['status'], - 'SUCCEEDED' - ); - $this->assertEquals( - $result['capture_amount'], - '123456' - ); - $this->assertEquals( - $result['refund_amount'], - 100000 - ); - $this->assertEquals( - $result['reason'], - 'REQUESTED_BY_CUSTOMER' - ); - $this->assertEquals( - $result['channel_code'], - 'ID_OVO' - ); - } - - /** - * Get Refund EWallets Charge test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testGetRefundGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - EWallets::getRefund( - self::TEST_CHARGE_ID, - self::TEST_REFUND_ID - ); - } - - /** - * Get list of ewallet refund test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testListRefundIsGettable() - { - $expectedResponse = [ - 'has_more' => false - ]; - - $this->stubRequest( - 'GET', - '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds/', - [], - [], - $expectedResponse - ); - - $result = EWallets::listRefund(self::TEST_CHARGE_ID); - $this->assertEquals($result['has_more'], $expectedResponse['has_more']); - } - - /** - * Get Refund list test - * Should throw ApiException - * - * @return void - */ - public function testListRefundIsGettableThrowsException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - EWallets::listRefund(self::TEST_CHARGE_ID); - } - -} diff --git a/tests/Xendit/InvoiceTest.php b/tests/Xendit/InvoiceTest.php deleted file mode 100644 index 0d95b10..0000000 --- a/tests/Xendit/InvoiceTest.php +++ /dev/null @@ -1,176 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Invoice; -use Xendit\TestCase; - -/** - * Class InvoiceTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class InvoiceTest extends TestCase -{ - const TEST_RESOURCE_ID = "123"; - - /** - * Create Invoice test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000 - ]; - - $this->stubRequest( - 'POST', - '/v2/invoices', - $params, - [], - $params - ); - - $resource = Invoice::create($params); - $this->assertEquals($resource['external_id'], $params['external_id']); - $this->assertEquals($resource['payer_email'], $params['payer_email']); - $this->assertEquals($resource['description'], $params['description']); - $this->assertEquals($resource['amount'], $params['amount']); - } - - /** - * Get Invoice test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $this->stubRequest( - 'get', - '/v2/invoices/'.self::TEST_RESOURCE_ID, - [], - [], - [ - 'id' => self::TEST_RESOURCE_ID - ] - ); - - $resource = Invoice::retrieve(self::TEST_RESOURCE_ID); - $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); - } - - /** - * GetAll Invoice test - * Should pass - * - * @return void - */ - public function testIsListable() - { - $this->stubRequest( - 'GET', - '/v2/invoices', - [], - [], - [ - 'id' => self::TEST_RESOURCE_ID - ] - ); - - $resources = Invoice::retrieveAll(); - $this->assertTrue(is_array($resources)); - $this->assertTrue(array_key_exists('id', $resources)); - } - - /** - * Expire Invoice test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsExpirable() - { - $this->stubRequest( - 'POST', - '/invoices/' . self::TEST_RESOURCE_ID . '/expire!', - [], - [], - [ - 'id' => self::TEST_RESOURCE_ID, - 'status' => 'EXPIRED' - ] - ); - - $resources = Invoice::expireInvoice(self::TEST_RESOURCE_ID); - $this->assertEquals($resources['status'], 'EXPIRED'); - $this->assertEquals($resources['id'], self::TEST_RESOURCE_ID); - } - - /** - * Create Invoice test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - ]; - - Invoice::create($params); - } - - /** - * Get Invoice test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Invoice::retrieve(self::TEST_RESOURCE_ID); - } - - /** - * Expire Invoice test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsExpirableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Invoice::expireInvoice(self::TEST_RESOURCE_ID); - } -} diff --git a/tests/Xendit/PayLaterTest.php b/tests/Xendit/PayLaterTest.php deleted file mode 100644 index e45ceb9..0000000 --- a/tests/Xendit/PayLaterTest.php +++ /dev/null @@ -1,511 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\PayLater; -use Xendit\TestCase; - -/** - * Class PayLaterTest - * - * @category Class - * @package Xendit - * @author Asoka Wotulo - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PayLaterTest extends TestCase -{ - public function testIsPayLaterPlanCreateable() - { - $params = [ - 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', - 'channel_code' => 'ID_AKULAKU', - 'currency' => 'IDR', - 'amount' => 6000000, - 'order_items' => [ - [ - 'type' => 'PHYSICAL_PRODUCT', - 'reference_id' => '1533', - 'name' => 'iPhone X - 64 GB - Space Gray', - 'net_unit_amount' => 6000000, - 'quantity' => 1, - 'url' => 'https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533', - 'category' => 'Smartphone' - ] - ] - ]; - - $response = [ - 'id' => 'plp_5b980f6b-0e15-4134-8eb2-4c500b74a7d9', - 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', - 'channel_code' => 'ID_AKULAKU', - 'currency' => 'IDR', - 'amount' => 6000000, - 'order_items' => [ - [ - 'type' => 'PHYSICAL_PRODUCT', - 'reference_id' => '1533', - 'name' => 'iPhone X - 64 GB - Space Gray', - 'net_unit_amount' => 6000000, - 'quantity' => 1, - 'url' => 'https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533', - 'category' => 'Smartphone' - ] - ], - 'options' => [ - [ - 'interval' => 'MONTH', - 'interval_count' => 1, - 'total_recurrence' => 1, - 'total_amount' => 6212000, - 'installment_amount' => 6212000, - 'downpayment_amount' => 0, - 'interest_rate' => 0, - 'description' => '1 month' - ], - [ - 'interval' => 'MONTH', - 'interval_count' => 1, - 'total_recurrence' => 2, - 'total_amount' => 6374000, - 'installment_amount' => 3187000, - 'downpayment_amount' => 0, - 'interest_rate' => 0, - 'description' => '2 months' - ], - [ - 'interval' => 'MONTH', - 'interval_count' => 1, - 'total_recurrence' => 3, - 'total_amount' => 6546000, - 'installment_amount' => 2182000, - 'downpayment_amount' => 0, - 'interest_rate' => 0, - 'description' => '3 months' - ] - ], - 'created' => '2021-10-08T10:08:38.032Z', - ]; - - $this->stubRequest( - 'POST', - '/paylater/plans', - $params, - [], - $response, - ); - - $result = PayLater::initiatePayLaterPlans($params); - - $this->assertArrayHasKey('id', $result); - $this->assertArrayHasKey('created', $result); - $this->assertIsArray($result['options']); - $this->assertEquals($params['order_items'], $result['order_items']); - $this->assertEquals($params['customer_id'], $result['customer_id']); - $this->assertEquals($params['channel_code'], $result['channel_code']); - $this->assertEquals($params['currency'], $result['currency']); - $this->assertEquals($params['amount'], $result['amount']); - } - - public function testIsPayLaterPlanCreateableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = []; - - PayLater::initiatePayLaterPlans($params); - } - - public function testIsPayLaterPlanCreateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = [ - "customer_id" => "14b4bf47-b97a-4c13-bea9-5b1734a46fd1", - "channel_code" => "ID_KREDIVO", - "currency" => "IDR", - "amount" => 6000000, - "order_items" => [ - [ - "type" => "PHYSICAL_PRODUCT", - "reference_id" => "1533", - "name" => "iPhone X - 64 GB - Space Gray", - "net_unit_amount" => 6000000, - "quantity" => 1, - "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", - "category" => "Smartphone" - ] - ] - ]; - - PayLater::initiatePayLaterPlans($params); - } - - public function testIsPayLaterChargeCreateable() - { - $params = [ - 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', - 'reference_id' => 'order_id_234', - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'success_redirect_url' => 'https://google.com', - 'failure_redirect_url' => 'https://twitter.com', - ]; - - $response = [ - 'id' => 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f', - 'business_id' => '603f1c4172bbe840979fd408', - 'reference_id' => 'order_id_234', - 'customer_id' => 'f1172e79-1c9a-4e67-a177-de1bf4c90108', - 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', - 'currency' => 'IDR', - 'amount' => 10000, - 'channel_code' => 'ID_AKULAKU', - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'status' => 'PENDING', - 'actions' => [ - 'desktop_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408', - 'mobile_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408' - ], - 'success_redirect_url' => 'https://google.com', - 'failure_redirect_url' => 'https://twitter.com', - 'callback_url' => 'https://webhook.site/d4478770-60be-4556-a8e5-f0d929e1f8cb', - 'created' => '2021-10-08T05:00:31.413Z', - 'updated' => '2021-10-08T05:00:31.545Z', - 'order_items' => [ - [ - "type" => "PHYSICAL_PRODUCT", - "reference_id" => "1533", - "name" => "iPhone X - 64 GB - Space Gray", - "net_unit_amount" => 6000000, - "quantity" => 1, - "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", - "category" => "Smartphone" - ] - ], - 'voided_at' => null, - 'payment_method_id' => null, - 'metadata' => null, - 'channel_reference' => 'ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1' - ]; - - $this->stubRequest( - 'POST', - '/paylater/charges', - $params, - [], - $response, - ); - - $result = PayLater::createPayLaterCharge($params); - - $this->assertArrayHasKey('id', $result); - $this->assertEquals( - $params['plan_id'], - $result['plan_id'] - ); - $this->assertEquals( - $params['reference_id'], - $result['reference_id'] - ); - $this->assertEquals( - $params['checkout_method'], - $result['checkout_method'] - ); - $this->assertEquals( - $params['success_redirect_url'], - $result['success_redirect_url'] - ); - $this->assertEquals( - $params['failure_redirect_url'], - $result['failure_redirect_url'] - ); - } - - public function testIsPayLaterChargeCreateableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = []; - - PayLater::createPayLaterCharge($params); - } - - public function testIsPayLaterChargeCreateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = [ - 'plan_id' => '', - 'reference_id' => '', - 'checkout_method' => '', - 'success_redirect_url' => '', - ]; - - PayLater::createPayLaterCharge($params); - } - - public function testIsGetPayLaterChargeStatusGettable() - { - $params = []; - $id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; - - $response = [ - 'id' => 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f', - 'business_id' => '603f1c4172bbe840979fd408', - 'reference_id' => 'order_id_234', - 'customer_id' => 'f1172e79-1c9a-4e67-a177-de1bf4c90108', - 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', - 'currency' => 'IDR', - 'amount' => 10000, - 'channel_code' => 'ID_AKULAKU', - 'checkout_method' => 'ONE_TIME_PAYMENT', - 'status' => 'PENDING', - 'actions' => [ - 'desktop_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408', - 'mobile_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408' - ], - 'success_redirect_url' => 'https://google.com', - 'failure_redirect_url' => 'https://twitter.com', - 'callback_url' => 'https://webhook.site/d4478770-60be-4556-a8e5-f0d929e1f8cb', - 'created' => '2021-10-08T05:00:31.413Z', - 'updated' => '2021-10-08T05:00:31.545Z', - 'order_items' => [ - [ - "type" => "PHYSICAL_PRODUCT", - "reference_id" => "1533", - "name" => "iPhone X - 64 GB - Space Gray", - "net_unit_amount" => 6000000, - "quantity" => 1, - "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", - "category" => "Smartphone" - ] - ], - 'voided_at' => null, - 'payment_method_id' => null, - 'metadata' => null, - 'channel_reference' => 'ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1' - ]; - - $this->stubRequest( - 'GET', - '/paylater/charges/'.$id, - $params, - [], - $response, - ); - - $result = PayLater::getPayLaterChargeStatus($id, $params); - - $this->assertArrayHasKey('id', $result); - $this->assertEquals( - 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', - $result['plan_id'] - ); - $this->assertEquals( - 'order_id_234', - $result['reference_id'] - ); - $this->assertEquals( - 'ONE_TIME_PAYMENT', - $result['checkout_method'] - ); - $this->assertEquals( - 'https://google.com', - $result['success_redirect_url'] - ); - $this->assertEquals( - 'https://twitter.com', - $result['failure_redirect_url'] - ); - } - - - public function testIsGetPayLaterChargeStatusGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = []; - $id = 'test'; - PayLater::getPayLaterChargeStatus($id, $params); - } - - public function testCreatePayLaterRefundCreateable() - { - $params = [ - 'amount' => 1234.56, - 'reason' => 'UNFULFILLED_ITEM' - ]; - $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; - - $response = [ - 'id' => 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', - 'charge_id' => 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', - 'channel_code' => 'ID_AKULAKU', - 'amount' => 1234.56, - 'reason' => 'UNFULFILLED_ITEM', - 'status' => 'PENDING', - 'created' => '2021-04-20T16:23:52Z', - 'updated' => null - ]; - - $this->stubRequest( - 'POST', - '/paylater/charges/'.$id.'/refunds', - $params, - [], - $response, - ); - - $result = PayLater::createPayLaterRefund($id, $params); - - $this->assertArrayHasKey('id', $result); - $this->assertEquals( - 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', - $result['id'] - ); - $this->assertEquals( - 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', - $result['charge_id'] - ); - $this->assertEquals( - 'ID_AKULAKU', - $result['channel_code'] - ); - $this->assertEquals( - 1234.56, - $result['amount'] - ); - $this->assertEquals( - 'UNFULFILLED_ITEM', - $result['reason'] - ); - $this->assertEquals( - 'PENDING', - $result['status'] - ); - } - - - public function testIsCreatePayLaterRefundCreateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = []; - $id = 'test'; - PayLater::createPayLaterRefund($id, $params); - } - - public function testIsGetPayLaterRefundGettable() - { - $params = []; - $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; - $refund_id = 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e'; - - $response = [ - 'id' => 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', - 'charge_id' => 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', - 'channel_code' => 'ID_AKULAKU', - 'amount' => 1234.56, - 'reason' => 'UNFULFILLED_ITEM', - 'status' => 'PENDING', - 'created' => '2021-04-20T16:23:52Z', - 'updated' => null - ]; - - $this->stubRequest( - 'GET', - '/paylater/charges/'.$charge_id.'/refunds/'.$refund_id, - $params, - [], - $response, - ); - - $result = PayLater::getPayLaterRefund($charge_id, $refund_id, $params); - - $this->assertArrayHasKey('id', $result); - $this->assertEquals( - 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', - $result['id'] - ); - $this->assertEquals( - 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', - $result['charge_id'] - ); - $this->assertEquals( - 'ID_AKULAKU', - $result['channel_code'] - ); - $this->assertEquals( - 1234.56, - $result['amount'] - ); - $this->assertEquals( - 'UNFULFILLED_ITEM', - $result['reason'] - ); - $this->assertEquals( - 'PENDING', - $result['status'] - ); - } - - - public function testIsGetPayLaterRefundGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $params = []; - $charge_id = 'test'; - $refund_id = 'test'; - PayLater::getPayLaterRefund($charge_id, $refund_id, $params); - } - - /** - * Get list of transactions test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testListPayLaterRefundIsGettable() - { - $expectedResponse = [ - 'has_more' => false - ]; - $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; - $this->stubRequest( - 'GET', - '/paylater/charges/'.$charge_id.'/refunds/', - [], - [], - $expectedResponse - ); - - $result = PayLater::listPayLaterRefund($charge_id); - $this->assertEquals($result['has_more'], $expectedResponse['has_more']); - } - - /** - * Get list of transactions test - * Should throw ApiException - * - * @return void - */ - public function testListPayLaterRefundIsGettableThrowsException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; - PayLater::listPayLaterRefund($charge_id); - } - - /** - * Get detail of transactions test - * Should throw ApiException - * - * @return void - */ - -} diff --git a/tests/Xendit/PaymentChannelsTest.php b/tests/Xendit/PaymentChannelsTest.php deleted file mode 100644 index f6ef8db..0000000 --- a/tests/Xendit/PaymentChannelsTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\PaymentChannels; -use Xendit\TestCase; - -/** - * Class PaymentChannelsTest - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PaymentChannelsTest extends TestCase -{ - /** - * Get list of payment channel test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testListIsGettable() - { - $expectedResponse = [ - 'channel_code' => false - ]; - - $this->stubRequest( - 'GET', - '/payment_channels', - [], - [], - $expectedResponse - ); - - $result = PaymentChannels::list(); - $this->assertEquals($result['channel_code'], $expectedResponse['channel_code']); - } -} diff --git a/tests/Xendit/PayoutsNewTest.php b/tests/Xendit/PayoutsNewTest.php deleted file mode 100644 index 6f6a0d2..0000000 --- a/tests/Xendit/PayoutsNewTest.php +++ /dev/null @@ -1,232 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PayoutsNewTest extends TestCase -{ - const TEST_ID = "123"; - const TEST_REFERENCE_ID = 'ref-XA322'; - const CHANNEL_CODE = "ID_BCA"; - - /** - * Create Payouts test - * Should pass - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'reference_id' => self::TEST_REFERENCE_ID, - 'channel_code' => 'ID_BRI', - 'channel_properties' => [ - 'account_number' => '0000000000', - 'account_holder_name' => 'Yanuar' - ], - 'amount' => 1000, - 'description' => 'Sample Successful Create IDR Payout', - 'currency' => 'IDR', - 'receipt_notification' => [ - 'email_to' => ['someone@example.com'], - 'email_cc' => ['someone1@example.com'], - 'email_bcc' => ['someone2@example.com'], - ], - 'metadata' => [ - 'lotto_outlet' => 24 - ] - ]; - - $this->stubRequest( - 'POST', - '/v2/payouts', - $params, - [], - $params - ); - - $result = PayoutsNew::create($params); - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['channel_code'], $params['channel_code']); - $this->assertEquals( - $result['channel_properties']['account_holder_name'], - $params['channel_properties']['account_holder_name'] - ); - $this->assertEquals( - $result['channel_properties']['account_number'], - $params['channel_properties']['account_number'] - ); - $this->assertEquals($result['currency'], $params['currency']); - $this->assertEquals($result['description'], $params['description']); - } - - /** - * Get Payouts Channel test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testChannelsIsGettable() - { - $expectedResponse = [ - [ - 'channel_code' => 'ID_BSI', - 'channel_category' => 'BANK', - 'currency' => 'IDR', - 'channel_name' => 'Bank Syariah Indonesia', - 'amount_limits' => [ - 'minimum' => 10000, - 'maximum' => 1999999999999, - 'minimum_increment' => 1 - ] - ] - ]; - - $this->stubRequest( - 'GET', - '/payouts_channels', - [], - [], - $expectedResponse - ); - - $result = PayoutsNew::getPayoutsChannels(); - $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); - $this->assertEquals($result[0]['channel_category'], $expectedResponse[0]['channel_category']); - $this->assertEquals( - $result[0]['channel_name'], - $expectedResponse[0]['channel_name'] - ); - $this->assertEquals( - $result[0]['currency'], - $expectedResponse[0]['currency'] - ); - } - - /** - * Get Payouts by ID test - * Should pass - * - * @return void - */ - public function testIsGettableByID() - { - $this->stubRequest( - 'GET', - '/v2/payouts/' . self::TEST_ID, - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = PayoutsNew::retrieve(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Get Disbursements by Reference ID test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableByReferenceID() - { - $this->stubRequest( - 'GET', - '/v2/payouts?reference_id=' . self::TEST_REFERENCE_ID, - [], - [], - [ - 'reference_id' => self::TEST_REFERENCE_ID - ] - ); - - $result = PayoutsNew::retrieveReference(self::TEST_REFERENCE_ID); - $this->assertEquals($result['reference_id'], self::TEST_REFERENCE_ID); - } - - /** - * Create Payouts test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'reference_id' => 'demo_147580196270' - ]; - - PayoutsNew::create($params); - } - - /** - * Void Payouts test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsVoidable() - { - $expectedResponse = [ - 'id' => self::TEST_ID, - 'status' => 'CANCELLED', - 'reference_id' => self::TEST_REFERENCE_ID, - ]; - - $this->stubRequest( - 'GET', - '/v2/payouts/' . self::TEST_ID . '/cancel', - [], - [], - $expectedResponse - ); - - $result = PayoutsNew::cancel(self::TEST_ID); - $this->assertEquals($result['id'], $expectedResponse['id']); - $this->assertEquals($result['status'], $expectedResponse['status']); - $this->assertEquals($result['reference_id'], $expectedResponse['reference_id']); - } - - - /** - * Get Payouts by ID test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableByIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - PayoutsNew::retrieve(self::TEST_ID); - } - - /** - * Get Payouts by Reference ID test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableByReferenceIDThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - PayoutsNew::retrieve(self::TEST_REFERENCE_ID); - } - -} diff --git a/tests/Xendit/PayoutsTest.php b/tests/Xendit/PayoutsTest.php deleted file mode 100644 index f114ee9..0000000 --- a/tests/Xendit/PayoutsTest.php +++ /dev/null @@ -1,150 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Payouts; -use Xendit\TestCase; - -/** - * Class PayoutsTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PayoutsTest extends TestCase -{ - const TEST_ID = "TEST-123"; - - /** - * Create Payout test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id'=> 'payouts-123456789', - 'amount'=> 50000, - 'email'=> 'demo@xendit.co', - ]; - - $this->stubRequest( - 'POST', - '/payouts', - $params, - [], - $params - ); - - $result = Payouts::create($params); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['email'], $params['email']); - } - - /** - * Get Payout test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $params = [ - 'external_id'=> 'payouts-123456789', - 'amount'=> 50000 - ]; - - $this->stubRequest( - 'GET', - '/payouts/' . self::TEST_ID, - [], - [], - $params - ); - - $result = Payouts::retrieve(self::TEST_ID); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['amount'], $params['amount']); - } - - /** - * Void Payout test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsVoidable() - { - $this->stubRequest( - 'POST', - '/payouts/' . self::TEST_ID . '/void', - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = Payouts::void(self::TEST_ID); - - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Create Payout test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - Payouts::create($params); - } - - /** - * Get Payout test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Payouts::retrieve(self::TEST_ID); - } - - /** - * Void Payout test - * Should throw - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsVoidableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Payouts::void(self::TEST_ID); - } -} diff --git a/tests/Xendit/PlatformTest.php b/tests/Xendit/PlatformTest.php deleted file mode 100644 index 5314dc2..0000000 --- a/tests/Xendit/PlatformTest.php +++ /dev/null @@ -1,310 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Platform; -use Xendit\TestCase; - -/** - * Class PlatformTest - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PlatformTest extends TestCase -{ - const ACCOUNT_TYPE = 'OWNED'; - const ACCOUNT_EMAIL = 'customer@website.com'; - const ACCOUNT_BUSINESS_NAME = 'customer company'; - - /** - * Create Account test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testAccountIsCreatable() - { - $expected = [ - 'email' => self::ACCOUNT_EMAIL, - 'type' => self::ACCOUNT_TYPE, - 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME] - ]; - - $this->stubRequest( - 'POST', - '/v2/accounts', - $expected, - [], - $expected - ); - - $result = Platform::createAccount($expected); - - $this->assertEquals($result['email'], $expected['email']); - $this->assertEquals($result['type'], $expected['type']); - } - - /** - * Get Account by ID test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testAccountIsGettable() - { - $expectedResponse = [ - 'id' => '5cafeb170a2b18519b1b8761', - 'created' => '2021-01-01T10:00:00Z', - 'updated' => '2021-01-01T10:00:00Z', - 'type'=> 'OWNED', - 'email'=> 'angie@pinkpanther.com', - 'status'=> 'LIVE', - ]; - $this->stubRequest( - 'GET', - '/v2/accounts/5cafeb170a2b18519b1b8761', - [], - [], - $expectedResponse - ); - - $result = Platform::getAccount('5cafeb170a2b18519b1b8761'); - $this->assertEquals($result['id'], $expectedResponse['id']); - $this->assertEquals($result['type'], $expectedResponse['type']); - } - - /** - * Update Account test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testAccountIsUpdatable() - { - $expected = [ - 'email' => self::ACCOUNT_EMAIL, - 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME.' Updated'] - ]; - - $this->stubRequest( - 'PATCH', - '/v2/accounts/5cafeb170a2b18519b1b8761', - $expected, - [], - $expected - ); - - $result = Platform::updateAccount('5cafeb170a2b18519b1b8761', $expected); - - $this->assertEquals($result['email'], $expected['email']); - } - - /** - * Create Transfer test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testTransferIsCreatable() - { - $expected = [ - 'reference' => ''.time(), - 'amount' => 50000, - 'source_user_id' => '54afeb170a2b18519b1b8768', - 'destination_user_id' => '5cafeb170a2b1851246b8768', - ]; - - $this->stubRequest( - 'POST', - '/transfers', - $expected, - [], - $expected - ); - - $result = Platform::createTransfer($expected); - - $this->assertEquals($result['source_user_id'], $expected['source_user_id']); - $this->assertEquals($result['destination_user_id'], $expected['destination_user_id']); - } - - /** - * Create Fee Rule test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testFeeRuleIsCreatable() - { - $params = [ - 'name' => 'standard_platform_fee', - 'description' => 'Fee charged to insurance agents based in Java', - 'unit' => 'flat', - 'amount' => 6500, - 'currency' => 'IDR' - ]; - - $expected = [ - 'name' => 'standard_platform_fee', - 'description' => 'Fee charged to insurance agents based in Java', - 'routes' => [ - array( - 'unit' => 'flat', - 'amount' => 6500, - 'currency' => 'IDR' - ) - ] - ]; - - $this->stubRequest( - 'POST', - '/fee_rules', - $expected, - [], - $expected - ); - - $result = Platform::createFeeRule($params); - - $this->assertEquals($result['name'], $expected['name']); - } - - /** - * Set Callback URL test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testCallbackUrlIsCreatable() - { - $expected = [ - 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' - ]; - $callbackType = 'invoice'; - - $this->stubRequest( - 'POST', - '/callback_urls/'.$callbackType, - $expected, - [], - $expected - ); - - $result = Platform::setCallbackUrl($callbackType, $expected); - - $this->assertEquals($result['url'], $expected['url']); - } - - /** - * Create Account test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testAccountIsCreatableThrowsException() - { - $expected = [ - 'email' => self::ACCOUNT_EMAIL - ]; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Platform::createAccount($expected); - } - - /** - * Get account by ID test - * Should throw ApiException - * - * @return void - */ - public function testAccountIsGettableThrowsException() - { - $id = '358115033581150335811503358115033581150335811503358115033581150335811503358115033581150335811503358115033581150335811503'; - $this->expectException(\Xendit\Exceptions\ApiException::class); - Platform::getAccount($id); - } - - /** - * Update Account test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testAccountIsUpdatetableThrowsException() - { - $expected = [ - 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME.' Updated'] - ]; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Platform::updateAccount($expected); - } - - /** - * Create Transfer test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testTransferIsCreatableThrowsException() - { - $expected = [ - 'reference' => time() - ]; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Platform::createTransfer($expected); - } - - /** - * Create Fee Rule test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testFeeRuleIsCreatableThrowsException() - { - $expected = [ - 'name' => 'standard_platform_fee' - ]; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Platform::createFeeRule($expected); - } - - /** - * Set Callback URL test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testCallbackurlIsCreatableThrowsException() - { - $expected = []; - $callbackType = 'invoice'; - - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Platform::setCallbackUrl($callbackType, $expected); - } -} diff --git a/tests/Xendit/PromotionTest.php b/tests/Xendit/PromotionTest.php deleted file mode 100644 index f63d963..0000000 --- a/tests/Xendit/PromotionTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @license https::/opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Promotion; - -/** - * Class PromotionTest - * - * @category Class - * @package Xendit - * @author Christian Atilano - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class PromotionTest extends TestCase -{ - /** - * Create Promotion test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'reference_id' => 'reference_123', - 'description' => 'test promotion', - 'currency' => 'IDR', - 'start_time' => '2021-03-02T00:00:00.000Z', - 'end_time' => '2021-04-02T00:00:00.000Z', - 'promo_code' => 'testpromocode', - 'discount_amount' => 5000 - ]; - - $expectedResult = [ - 'id' => '123', - 'business_id' => 'business_123', - 'reference_id' => 'reference_123', - 'start_time' => '2021-03-02T00:00:00.000Z', - 'end_time' => '2021-04-02T00:00:00.000Z', - 'description' => 'test promotion', - 'type' => 'PROMO_CODE', - 'promo_code' => 'testpromocode', - 'discount_amount' => 5000, - 'currency' => 'IDR', - 'created' => '2021-01-01T00:00:00.000Z', - 'status' => 'ACTIVE' - ]; - - $this -> stubRequest( - 'POST', - '/promotions', - $params, - [], - $expectedResult - ); - - $result = Promotion::create($params); - - $this->assertEquals($result['id'], '123'); - $this->assertEquals($result['business_id'], 'business_123'); - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['start_time'], $params['start_time']); - $this->assertEquals($result['end_time'], $params['end_time']); - $this->assertEquals($result['description'], $params['description']); - $this->assertEquals($result['type'], 'PROMO_CODE'); - $this->assertEquals($result['promo_code'], $params['promo_code']); - $this->assertEquals($result['discount_amount'], $params['discount_amount']); - $this->assertEquals($result['currency'], $params['currency']); - $this->assertEquals($result['created'], '2021-01-01T00:00:00.000Z'); - $this->assertEquals($result['status'], 'ACTIVE'); - } - - /** - * Create Promotion - * Should throw InvalidArgumentException when promo_code and bin_list does not exists - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionIfPromoCodeOrBinListDoesNotExists() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = []; - - Promotion::create($params); - } - - /** - * Create Promotion - * Should throw InvalidArgumentExcpetion when discount_amount or discount_percent does not exists - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionIfDiscAmountOrDiscPercentDoesNotExists() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = [ - 'promo_code' => 'testpromocode', - ]; - - Promotion::create($params); - } -} diff --git a/tests/Xendit/QRCodeTest.php b/tests/Xendit/QRCodeTest.php deleted file mode 100644 index 4aed046..0000000 --- a/tests/Xendit/QRCodeTest.php +++ /dev/null @@ -1,259 +0,0 @@ - - * @license https::/opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\QRCode; - -/** - * Class QRCodeTest - * - * @category Class - * @package Xendit - * @author Dave - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class QRCodeTest extends TestCase -{ - const TEST_EXTERNAL_ID = 'external_123'; - - /** - * Create QR Code test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => self::TEST_EXTERNAL_ID, - 'type' => 'DYNAMIC', - 'callback_url' => 'https://webhook.site', - 'amount' => 10000, - ]; - - $expectedResult = [ - 'id' => 'id1', - 'external_id' => self::TEST_EXTERNAL_ID, - 'amount' => 10000, - 'qr_string' => 'this_is_qr_string', - 'callback_url' => 'https://webhook.site', - 'type' => 'DYNAMIC', - 'status' => 'ACTIVE', - 'created' => '2020-01-08T18:18:18.661Z', - 'updated' => '2020-01-08T18:18:18.661Z', - ]; - - $this -> stubRequest( - 'POST', - '/qr_codes', - $params, - ['api-version' => '2020-07-01'], - $expectedResult - ); - - $result = QRCode::create($params); - - $this->assertEquals($result['id'], 'id1'); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['qr_string'], 'this_is_qr_string'); - $this->assertEquals($result['callback_url'], $params['callback_url']); - $this->assertEquals($result['type'], $params['type']); - $this->assertEquals($result['status'], 'ACTIVE'); - $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); - $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); - } - - /** - * Create V2 QR Code test - * Should pass - * - * @return void - */ - public function testIsCreatableV2() - { - $params = [ - 'api_version' => '2022-07-31', - 'reference_id' => self::TEST_EXTERNAL_ID, - 'currency' => 'IDR', - 'type' => 'DYNAMIC', - 'amount' => 10000, - ]; - - $expectedResult = [ - 'id' => 'id1', - 'reference_id' => self::TEST_EXTERNAL_ID, - 'currency' => 'IDR', - 'amount' => 10000, - 'qr_string' => 'this_is_qr_string', - 'type' => 'DYNAMIC', - 'status' => 'ACTIVE', - 'created' => '2020-01-08T18:18:18.661Z', - 'updated' => '2020-01-08T18:18:18.661Z', - ]; - - $expectedParams = $params; - unset($expectedParams['api_version']); - - $this -> stubRequest( - 'POST', - '/qr_codes', - $expectedParams, - ['api-version' => '2022-07-31'], - $expectedResult - ); - - $result = QRCode::create($params); - - $this->assertEquals($result['id'], 'id1'); - $this->assertEquals($result['reference_id'], $params['reference_id']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['qr_string'], 'this_is_qr_string'); - $this->assertEquals($result['type'], $params['type']); - $this->assertEquals($result['status'], 'ACTIVE'); - $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); - $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); - } - - /** - * Create QR Code - * Should throw InvalidArgumentException with type not exist - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionIfTypeDoesntExist() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = []; - - QRCode::create($params); - } - - /** - * Create QR Code - * Should throw InvalidArgumentExcpetion with type not exist - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionOnWrongType() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = [ - 'type' => 'NOT_DYNAMIC', - ]; - - QRCode::create($params); - } - - /** - * Create QR Code - * Should throw InvalidArgumentException with wrong API version - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionOnWrongAPIVersion() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => self::TEST_EXTERNAL_ID, - 'type' => 'DYNAMIC', - 'callback_url' => 'https://webhook.site', - 'amount' => 10000, - 'api_version' => '2022-02-02' - ]; - - QRCode::create($params); - } - - /** - * Create QR Code - * Should throw InvalidArgumentException with wrong parameters for V2 - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionOnMissingReferenceIDForV2() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => self::TEST_EXTERNAL_ID, // expects this to be reference_id instead - 'type' => 'DYNAMIC', - 'amount' => 10000, - 'api_version' => '2022-07-31' - ]; - - QRCode::create($params); - } - - /** - * Create QR Code - * Should throw InvalidArgumentException if callback URL is provided for V2 - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentExceptionOnCallbackURLForV2() - { - $this->expectException(Exceptions\InvalidArgumentException::class); - $params = [ - 'reference_id' => self::TEST_EXTERNAL_ID, - 'type' => 'DYNAMIC', - 'amount' => 10000, - 'callback_url' => 'https://webhook.site', - 'api_version' => '2022-07-31' - ]; - - QRCode::create($params); - } - - /** - * Get QR Code test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $expectedResult = [ - 'id' => 'id1', - 'external_id' => self::TEST_EXTERNAL_ID, - 'amount' => 10000, - 'qr_string' => 'this_is_qr_string', - 'callback_url' => 'https://webhook.site', - 'type' => 'DYNAMIC', - 'status' => 'ACTIVE', - 'created' => '2020-01-08T18:18:18.661Z', - 'updated' => '2020-01-08T18:18:18.661Z', - ]; - - $this -> stubRequest( - 'GET', - '/qr_codes' . '/' . self::TEST_EXTERNAL_ID, - [], - [], - $expectedResult - ); - - $result = QRCode::get(self::TEST_EXTERNAL_ID); - - $this->assertEquals($result['id'], 'id1'); - $this->assertEquals($result['external_id'], self::TEST_EXTERNAL_ID); - $this->assertEquals($result['amount'], 10000); - $this->assertEquals($result['qr_string'], 'this_is_qr_string'); - $this->assertEquals($result['callback_url'], 'https://webhook.site'); - $this->assertEquals($result['type'], 'DYNAMIC'); - $this->assertEquals($result['status'], 'ACTIVE'); - $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); - $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); - } -} diff --git a/tests/Xendit/RecurringTest.php b/tests/Xendit/RecurringTest.php deleted file mode 100644 index 0f10dfc..0000000 --- a/tests/Xendit/RecurringTest.php +++ /dev/null @@ -1,280 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Recurring; -use Xendit\TestCase; - -/** - * Class RecurringTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class RecurringTest extends TestCase -{ - const TEST_ID = "123"; - - /** - * Create Recurring test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - 'amount' => 32000, - 'interval' => 'MONTH', - 'interval_count' => 1 - ]; - - $this->stubRequest( - 'POST', - '/recurring_payments', - $params, - [], - $params - ); - - $result = Recurring::create($params); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals($result['payer_email'], $params['payer_email']); - $this->assertEquals($result['description'], $params['description']); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['interval'], $params['interval']); - $this->assertEquals($result['interval_count'], $params['interval_count']); - } - - /** - * Get Recurring test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $this->stubRequest( - 'get', - '/recurring_payments/'.self::TEST_ID, - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = Recurring::retrieve(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Update Recurring test - * Should pass - * - * @return void - */ - public function testIsUpdateable() - { - $params = [ - 'amount' => 32000, - 'interval' => 'MONTH', - 'interval_count' => 2 - ]; - - $this->stubRequest( - 'PATCH', - '/recurring_payments/' . self::TEST_ID, - $params, - [], - $params - ); - - $result = Recurring::update(self::TEST_ID, $params); - $this->assertEquals($result['amount'], $params['amount']); - $this->assertEquals($result['interval'], $params['interval']); - $this->assertEquals($result['interval_count'], $params['interval_count']); - } - - /** - * Stop Recurring test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsStoppable() - { - $this->stubRequest( - 'post', - '/recurring_payments/'.self::TEST_ID.'/stop!', - [], - [], - [ - 'id' => self::TEST_ID, - 'status' => 'STOPPED' - ] - ); - - $result = Recurring::stop(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - $this->assertEquals($result['status'], 'STOPPED'); - } - - /** - * Pause Recurring test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPausable() - { - $this->stubRequest( - 'post', - '/recurring_payments/'.self::TEST_ID.'/pause!', - [], - [], - [ - 'id' => self::TEST_ID, - 'status' => 'PAUSED' - ] - ); - - $result = Recurring::pause(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - $this->assertEquals($result['status'], 'PAUSED'); - } - - /** - * Resume Recurring test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsResumable() - { - $this->stubRequest( - 'post', - '/recurring_payments/'.self::TEST_ID.'/resume!', - [], - [], - [ - 'id' => self::TEST_ID, - 'status' => 'ACTIVE' - ] - ); - - $result = Recurring::resume(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - $this->assertEquals($result['status'], 'ACTIVE'); - } - - /** - * Create Recurring test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270', - 'payer_email' => 'sample_email@xendit.co', - 'description' => 'Trip to Bali', - ]; - - Recurring::create($params); - } - - /** - * Get Recurring test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Recurring::retrieve(self::TEST_ID); - } - - /** - * Update Recurring test - * Should throw ApiException - * - * @return void - */ - public function testIsUpdateableThrowException() - { - $params = [ - 'amount' => 32000 - ]; - - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Recurring::update(self::TEST_ID, $params); - } - - /** - * Stop Recurring test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsStoppableThrowException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Recurring::stop(self::TEST_ID); - } - - /** - * Pause Recurring test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsPausableThrowException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Recurring::pause(self::TEST_ID); - } - - /** - * Resume Recurring test - * Should throw ApiException - * - * @return void - * @throws Exceptions\ApiException - */ - public function testIsResumableThrowException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - $result = Recurring::resume(self::TEST_ID); - } -} diff --git a/tests/Xendit/ReportTest.php b/tests/Xendit/ReportTest.php deleted file mode 100644 index ebb0b6e..0000000 --- a/tests/Xendit/ReportTest.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Report; -use Xendit\TestCase; - -/** - * Class ReportTest - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class ReportTest extends TestCase -{ - /** - * Generate report test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testReportIsCreatetable() - { - $expectedResponse = [ - 'type' => 'TRANSACTIONS' - ]; - - $this->stubRequest( - 'POST', - '/reports', - $expectedResponse, - [], - $expectedResponse - ); - - $result = Report::generate($expectedResponse); - $this->assertEquals($result['type'], $expectedResponse['type']); - } - - /** - * Get detail of report test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testDetailIsGettable() - { - $expectedResponse = [ - 'id' => 'report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28' - ]; - - $this->stubRequest( - 'GET', - '/reports/report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28', - [], - [], - $expectedResponse - ); - - $result = Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); - $this->assertEquals($result['id'], $expectedResponse['id']); - } - - /** - * Generate report test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testReportIsCreatetableThrowsException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - Report::generate(); - } - - /** - * Get detail of report test - * Should throw ApiException - * - * @return void - */ - public function testDetailIsGettableThrowsException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); - } -} diff --git a/tests/Xendit/RetailTest.php b/tests/Xendit/RetailTest.php deleted file mode 100644 index 4b5730f..0000000 --- a/tests/Xendit/RetailTest.php +++ /dev/null @@ -1,159 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\Retail; -use Xendit\TestCase; - -/** - * Class RetailTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class RetailTest extends TestCase -{ - const TEST_ID = "TEST-123"; - - /** - * Create FPC test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id'=> 'TEST-123456789', - 'retail_outlet_name'=> 'ALFAMART', - 'name'=> 'JOHN DOE', - 'expected_amount'=> 25000 - ]; - - $this->stubRequest( - 'POST', - '/fixed_payment_code', - $params, - [], - $params - ); - - $result = Retail::create($params); - $this->assertEquals($result['external_id'], $params['external_id']); - $this->assertEquals( - $result['retail_outlet_name'], - $params['retail_outlet_name'] - ); - $this->assertEquals($result['name'], $params['name']); - $this->assertEquals( - $result['expected_amount'], - $params['expected_amount'] - ); - } - - /** - * Get FPC test - * Should pass - * - * @return void - */ - public function testIsGettable() - { - $this->stubRequest( - 'GET', - '/fixed_payment_code/'.self::TEST_ID, - [], - [], - [ - 'id' => self::TEST_ID - ] - ); - - $result = Retail::retrieve(self::TEST_ID); - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Update FPC test - * Should pass - * - * @return void - */ - public function testIsUpdateable() - { - $params = [ - 'expected_amount' => 20000 - ]; - - $this->stubRequest( - 'PATCH', - '/fixed_payment_code/'.self::TEST_ID, - $params, - [], - [ - 'id' => self::TEST_ID, - 'suggested_amount' => 20000 - ] - ); - - $result = Retail::update(self::TEST_ID, $params); - - $this->assertEquals($result['id'], self::TEST_ID); - } - - /** - * Create FPC test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - Retail::create($params); - } - - /** - * Get FPC test - * Should throw ApiException - * - * @return void - */ - public function testIsGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - Retail::retrieve(self::TEST_ID); - } - - /** - * Update FPC test - * Should throw - * - * @return void - */ - public function testIsUpdateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - $params = ['suggested_amount' => 10000]; - - Retail::update(self::TEST_ID, $params); - } -} diff --git a/tests/Xendit/TransactionTest.php b/tests/Xendit/TransactionTest.php deleted file mode 100644 index 19759e8..0000000 --- a/tests/Xendit/TransactionTest.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -namespace Xendit; - -use Xendit\Transaction; -use Xendit\TestCase; - -/** - * Class TransactionTest - * - * @category Class - * @package Xendit - * @author David - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class TransactionTest extends TestCase -{ - /** - * Get list of transactions test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testListIsGettable() - { - $expectedResponse = [ - 'has_more' => false - ]; - - $this->stubRequest( - 'GET', - '/transactions', - [], - [], - $expectedResponse - ); - - $result = Transaction::list(); - $this->assertEquals($result['has_more'], $expectedResponse['has_more']); - } - - /** - * Get detail of transactions test - * Should pass - * - * @return void - * @throws Exceptions\ApiException - */ - public function testDetailIsGettable() - { - $expectedResponse = [ - 'id' => 'txn_4b401a5f-47b1-4aab-8136-f7c4440d571f' - ]; - - $this->stubRequest( - 'GET', - '/transactions/txn_4b401a5f-47b1-4aab-8136-f7c4440d571f', - [], - [], - $expectedResponse - ); - - $result = Transaction::detail('txn_4b401a5f-47b1-4aab-8136-f7c4440d571f'); - $this->assertEquals($result['id'], $expectedResponse['id']); - } - - /** - * Get detail of transactions test - * Should throw ApiException - * - * @return void - */ - public function testDetailIsGettableThrowsException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - Transaction::detail('txn_4b401a5f-47b1-4aab-8136-f7c4440d571f'); - } -} diff --git a/tests/Xendit/VirtualAccountTest.php b/tests/Xendit/VirtualAccountTest.php deleted file mode 100644 index 9f72ebf..0000000 --- a/tests/Xendit/VirtualAccountTest.php +++ /dev/null @@ -1,212 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ - -use Xendit\VirtualAccounts; -use Xendit\TestCase; - -/** - * Class VirtualAccountTest - * - * @category Class - * @package Xendit - * @author Ellen - * @license https://opensource.org/licenses/MIT MIT License - * @link https://api.xendit.co - */ -class VirtualAccountTest extends TestCase -{ - const TEST_RESOURCE_ID = "123"; - - /** - * Create VA test - * Should pass - * - * @return void - */ - public function testIsCreatable() - { - $params = [ - 'external_id' => 'VA_fixed-12341234', - 'bank_code' => 'MANDIRI', - 'name' => 'Steve Wozniak' - ]; - - $this->stubRequest( - 'POST', - '/callback_virtual_accounts', - $params, - [], - $params - ); - - $resource = VirtualAccounts::create($params); - $this->assertEquals($resource['external_id'], $params['external_id']); - $this->assertEquals($resource['bank_code'], $params['bank_code']); - $this->assertEquals($resource['name'], $params['name']); - } - - /** - * Get VirtualAccountBanks test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testVABanksIsGettable() - { - $expectedResponse = [[ - 'name' => 'Bank Mandiri', - 'code' => 'MANDIRI' - ]]; - $this->stubRequest( - 'GET', - '/available_virtual_account_banks', - [], - [], - $expectedResponse - ); - - $resource = VirtualAccounts::getVABanks(); - $this->assertEquals($resource[0]['name'], $expectedResponse[0]['name']); - $this->assertEquals($resource[0]['code'], $expectedResponse[0]['code']); - } - - /** - * Get VirtualAccount test - * Should pass - * - * @return void - */ - public function testVAIsGettable() - { - $this->stubRequest( - 'GET', - '/callback_virtual_accounts/'.self::TEST_RESOURCE_ID, - [], - [], - [ - 'id' => self::TEST_RESOURCE_ID - ] - ); - - $resource = VirtualAccounts::retrieve(self::TEST_RESOURCE_ID); - $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); - } - - /** - * Update VA test - * Should pass - * - * @return void - */ - public function testIsUpdateable() - { - $params = [ - 'suggested_amount' => 10000 - ]; - - $this->stubRequest( - 'PATCH', - '/callback_virtual_accounts/'.self::TEST_RESOURCE_ID, - $params, - [], - [ - 'id' => self::TEST_RESOURCE_ID, - 'suggested_amount' => 10000 - ] - ); - - $resource = VirtualAccounts::update(self::TEST_RESOURCE_ID, $params); - - $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); - } - - /** - * Get FVA Payment test - * Should pass - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsGettableFVAPayment() - { - $this->stubRequest( - 'GET', - '/callback_virtual_account_payments/payment_id='.self::TEST_RESOURCE_ID, - [], - [], - [ - 'id' => self::TEST_RESOURCE_ID - ] - ); - - $resource = VirtualAccounts::getFVAPayment(self::TEST_RESOURCE_ID); - $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); - } - - /** - * Create VirtualAccount test - * Should throw InvalidArgumentException - * - * @return void - */ - public function testIsCreatableThrowInvalidArgumentException() - { - $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); - $params = [ - 'external_id' => 'demo_147580196270' - ]; - - VirtualAccounts::create($params); - } - - /** - * Get VirtualAccount test - * Should throw ApiException - * - * @return void - */ - public function testIsVAGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - VirtualAccounts::retrieve(self::TEST_RESOURCE_ID); - } - - /** - * Create VirtualAccount test - * Should throw - * - * @return void - */ - public function testIsUpdateableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - VirtualAccounts::update(self::TEST_RESOURCE_ID); - } - - /** - * Get FVAPayment test - * Should throw ApiException - * - * @return void - * @throws \Xendit\Exceptions\ApiException - */ - public function testIsFVAPaymentGettableThrowApiException() - { - $this->expectException(\Xendit\Exceptions\ApiException::class); - - VirtualAccounts::getFVAPayment(self::TEST_RESOURCE_ID); - } -}