From 2d047a4cfa65ef93dcf9ffdc74b1e0a533fdc004 Mon Sep 17 00:00:00 2001 From: jillingk <93914435+jillingk@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:40:50 +0200 Subject: [PATCH 1/2] Disputes API (#571) * add dipsutes api * update readme and small fixes * Update README.md Co-authored-by: Alessio Zampatti --------- Co-authored-by: system-mr Co-authored-by: Alessio Zampatti --- Makefile | 5 +- README.md | 62 +-- .../Model/Disputes/AcceptDisputeRequest.php | 424 ++++++++++++++ .../Model/Disputes/AcceptDisputeResponse.php | 387 +++++++++++++ .../Model/Disputes/DefendDisputeRequest.php | 461 ++++++++++++++++ .../Model/Disputes/DefendDisputeResponse.php | 387 +++++++++++++ src/Adyen/Model/Disputes/DefenseDocument.php | 461 ++++++++++++++++ .../Model/Disputes/DefenseDocumentType.php | 461 ++++++++++++++++ src/Adyen/Model/Disputes/DefenseReason.php | 458 ++++++++++++++++ .../Model/Disputes/DefenseReasonsRequest.php | 424 ++++++++++++++ .../Model/Disputes/DefenseReasonsResponse.php | 421 ++++++++++++++ .../Disputes/DeleteDefenseDocumentRequest.php | 461 ++++++++++++++++ .../DeleteDefenseDocumentResponse.php | 387 +++++++++++++ .../Model/Disputes/DisputeServiceResult.php | 421 ++++++++++++++ .../DownloadDefenseDocumentRequest.php | 461 ++++++++++++++++ .../DownloadDefenseDocumentResponse.php | 455 +++++++++++++++ src/Adyen/Model/Disputes/ModelInterface.php | 92 ++++ src/Adyen/Model/Disputes/ObjectSerializer.php | 317 +++++++++++ src/Adyen/Model/Disputes/ServiceError.php | 518 ++++++++++++++++++ .../Disputes/SupplyDefenseDocumentRequest.php | 461 ++++++++++++++++ .../SupplyDefenseDocumentResponse.php | 387 +++++++++++++ src/Adyen/Service/DisputesApi.php | 130 +++++ tests/Resources/Disputes/generic-200.json | 5 + tests/Unit/DisputesTest.php | 88 +++ 24 files changed, 8101 insertions(+), 33 deletions(-) create mode 100644 src/Adyen/Model/Disputes/AcceptDisputeRequest.php create mode 100644 src/Adyen/Model/Disputes/AcceptDisputeResponse.php create mode 100644 src/Adyen/Model/Disputes/DefendDisputeRequest.php create mode 100644 src/Adyen/Model/Disputes/DefendDisputeResponse.php create mode 100644 src/Adyen/Model/Disputes/DefenseDocument.php create mode 100644 src/Adyen/Model/Disputes/DefenseDocumentType.php create mode 100644 src/Adyen/Model/Disputes/DefenseReason.php create mode 100644 src/Adyen/Model/Disputes/DefenseReasonsRequest.php create mode 100644 src/Adyen/Model/Disputes/DefenseReasonsResponse.php create mode 100644 src/Adyen/Model/Disputes/DeleteDefenseDocumentRequest.php create mode 100644 src/Adyen/Model/Disputes/DeleteDefenseDocumentResponse.php create mode 100644 src/Adyen/Model/Disputes/DisputeServiceResult.php create mode 100644 src/Adyen/Model/Disputes/DownloadDefenseDocumentRequest.php create mode 100644 src/Adyen/Model/Disputes/DownloadDefenseDocumentResponse.php create mode 100644 src/Adyen/Model/Disputes/ModelInterface.php create mode 100644 src/Adyen/Model/Disputes/ObjectSerializer.php create mode 100644 src/Adyen/Model/Disputes/ServiceError.php create mode 100644 src/Adyen/Model/Disputes/SupplyDefenseDocumentRequest.php create mode 100644 src/Adyen/Model/Disputes/SupplyDefenseDocumentResponse.php create mode 100644 src/Adyen/Service/DisputesApi.php create mode 100644 tests/Resources/Disputes/generic-200.json create mode 100644 tests/Unit/DisputesTest.php diff --git a/Makefile b/Makefile index fbc0be3be..24b71e93a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ openapi-generator-jar:=target/openapi-generator-cli.jar openapi-generator-cli:=java -jar $(openapi-generator-jar) generator:=php -modelGen:=AcsWebhooks BalanceControl BalancePlatform Checkout ConfigurationWebhooks StoredValue Payments Payout Management ManagementWebhooks LegalEntityManagement TransferWebhooks Transfers BinLookup StoredValue POSTerminalManagement Recurring ReportWebhooks +modelGen:=AcsWebhooks BalanceControl BalancePlatform Checkout ConfigurationWebhooks Disputes Payments Payout Management ManagementWebhooks LegalEntityManagement TransferWebhooks Transfers BinLookup StoredValue POSTerminalManagement Recurring ReportWebhooks models:=src/Adyen/Model output:=target/out @@ -15,6 +15,7 @@ BalanceControl: spec=BalanceControlService-v1 BalancePlatform: spec=BalancePlatformService-v2 BinLookup: spec=BinLookupService-v54 Checkout: spec=CheckoutService-v70 +Disputes: spec=DisputeService-v30 DataProtection: spec=DataProtectionService-v1 StoredValue: spec=StoredValueService-v46 POSTerminalManagement: spec=TfmAPIService-v1 @@ -62,7 +63,7 @@ $(modelGen): target/spec $(openapi-generator-jar) # Service Generation; split up in to templates based on the size of the service. That is, some services have no subgroups and are thus generated in one single file, others are grouped in a directory. Services:=BalancePlatform Checkout StoredValue Payments Payout Management LegalEntityManagement Transfers -SingleFileServices:=BalanceControl BinLookup DataProtection StoredValue POSTerminalManagement Recurring +SingleFileServices:=BalanceControl BinLookup DataProtection StoredValue POSTerminalManagement Recurring Disputes all: $(Services) $(SingleFileServices) diff --git a/README.md b/README.md index f0f7da23e..870ca5ae0 100644 --- a/README.md +++ b/README.md @@ -9,40 +9,40 @@ This is the officially supported PHP library for using Adyen's APIs. ## Supported API versions The library supports all APIs under the following services: -| API | Description | Service Name | Supported version | -|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|--------------------------| -| [BIN Lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [Binlookup](src/Adyen/Service/BinLookupApi.php) | **v54** | -| [Capital API](https://docs.adyen.com/api-explorer/capital/3/overview) | Adyen Capital allows you to build an embedded financing offering for your users to serve their operational needs. | [Capital](src/Adyen/Service/CapitalApi.php) | **v3** | -| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including 3D Secure), mobile wallets, and local payment methods (for example, iDEAL and Sofort). | [Checkout](src/Adyen/Service/Checkout) | **v70** | -| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | [BalancePlatform](src/Adyen/Service/BalancePlatform/) | **v2** | -| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | [DataProtection](src/Adyen/Service/DataProtectionApi.php) | **v1** | -| [Management API](https://docs.adyen.com/api-explorer/Management/1/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | [Management](src/Adyen/Service/Management/) | **v1** | -| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview) | A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. | [Payments](src/Adyen/Service/Payments) | **v68** | -| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | The Recurring APIs allow you to manage and remove your tokens or saved payment details. Tokens should be created with validation during a payment request. | [Recurring](src/Adyen/Service/RecurringApi.php) | **v68** | -| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview) | A set of API endpoints that allow you to store payout details, confirm, or decline a payout. | [Payout](src/Adyen/Service/Payout) | **v68** | -| [BinLookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | Endpoints for retrieving information, such as cost estimates, and 3D Secure supported version based on a given BIN. Current supported version | [BinLookup](src/Adyen/Service/BinLookupApi.php) | **v54** | -| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | Manage both online and point-of-sale gift cards and other stored-value cards. | [StoredValue](src/Adyen/Service/StoredValueApi.php) | **v46** | -| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | The Legal Entity Management API enables you to manage legal entities that contain information required for verification | [LegalEntityManagement](src/Adyen/Service/LegalEntityManagement) | **v3** | -| [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) | The Transfers API provides endpoints that you can use to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | [Transfers](src/Adyen/Service/Transfers) | **v3** | -| [Balance Control API](https://docs.adyen.com/api-explorer/BalanceControl/1/overview) | The Balance Control API lets you transfer funds between merchant accounts that belong to the same legal entity and are under the same company account. | [BalanceControl](src/Adyen/Service/BalanceControlApi.php) | **v1** | -| [Hosted Onboarding API](https://docs.adyen.com/api-explorer/Hop/1/overview) | The Hosted onboarding API provides endpoints that you can use to generate links to Adyen-hosted pages, such as an onboarding page or a PCI compliance questionnaire. You can provide these links to your account holders so that they can complete their onboarding. | [HostedOnboardingPages](src/Adyen/Service/Hop.php) | **v1** | -| [Account API](https://docs.adyen.com/api-explorer/Account/5/overview) | The Account API provides endpoints for managing account-related entities on your platform. These related entities include account holders, accounts, bank accounts, shareholders, and verification-related documents. The management operations include actions such as creation, retrieval, updating, and deletion of them. | [Account](src/Adyen/Service/Account.php) | **v5** | -| [Fund API](https://docs.adyen.com/api-explorer/Fund/5/overview) | The Fund API provides endpoints for managing the funds in the accounts on your platform. These management operations include, for example, the transfer of funds from one account to another, the payout of funds to an account holder, and the retrieval of balances in an account. | [Fund](src/Adyen/Service/Fund.php) | **v5** | -| [Terminal API (Cloud communications)](https://docs.adyen.com/point-of-sale/choose-your-architecture/cloud) | Our point-of-sale integration. | [Cloud-based Terminal API](src/Adyen/Service/PosPayment.php) | Cloud-based Terminal API | | -| [Terminal API (Local communications)](https://docs.adyen.com/point-of-sale/choose-your-architecture/local) | Our point-of-sale integration. | [Local-based Terminal API](src/Adyen/Service/PosPayment.php) | Local-based Terminal API | | -| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | This API provides endpoints for managing your point-of-sale (POS) payment terminals. You can use the API to obtain information about a specific terminal, retrieve overviews of your terminals and stores, and assign terminals to a merchant account or store. | [POSTerminalManagement](src/Adyen/Service/POSTerminalManagementApi.php) | **v1** | - +| API | Description | Service Name | Supported version | +|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|--------------------------| +| [BIN Lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [Binlookup](src/Adyen/Service/BinLookupApi.php) | **v54** | +| [Capital API](https://docs.adyen.com/api-explorer/capital/3/overview) | Adyen Capital allows you to build an embedded financing offering for your users to serve their operational needs. | [Capital](src/Adyen/Service/CapitalApi.php) | **v3** | +| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including 3D Secure), mobile wallets, and local payment methods (for example, iDEAL and Sofort). | [Checkout](src/Adyen/Service/Checkout) | **v70** | +| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | [BalancePlatform](src/Adyen/Service/BalancePlatform/) | **v2** | +| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | [DataProtection](src/Adyen/Service/DataProtectionApi.php) | **v1** | +| [Management API](https://docs.adyen.com/api-explorer/Management/1/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | [Management](src/Adyen/Service/Management/) | **v1** | +| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview) | A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. | [Payments](src/Adyen/Service/Payments) | **v68** | +| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | The Recurring APIs allow you to manage and remove your tokens or saved payment details. Tokens should be created with validation during a payment request. | [Recurring](src/Adyen/Service/RecurringApi.php) | **v68** | +| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview) | A set of API endpoints that allow you to store payout details, confirm, or decline a payout. | [Payout](src/Adyen/Service/Payout) | **v68** | +| [BinLookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | Endpoints for retrieving information, such as cost estimates, and 3D Secure supported version based on a given BIN. Current supported version | [BinLookup](src/Adyen/Service/BinLookupApi.php) | **v54** | +| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | Manage both online and point-of-sale gift cards and other stored-value cards. | [StoredValue](src/Adyen/Service/StoredValueApi.php) | **v46** | +| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | The Legal Entity Management API enables you to manage legal entities that contain information required for verification | [LegalEntityManagement](src/Adyen/Service/LegalEntityManagement) | **v3** | +| [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) | The Transfers API provides endpoints that you can use to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | [Transfers](src/Adyen/Service/Transfers) | **v3** | +| [Balance Control API](https://docs.adyen.com/api-explorer/BalanceControl/1/overview) | The Balance Control API lets you transfer funds between merchant accounts that belong to the same legal entity and are under the same company account. | [BalanceControl](src/Adyen/Service/BalanceControlApi.php) | **v1** | +| [Hosted Onboarding API](https://docs.adyen.com/api-explorer/Hop/1/overview) | The Hosted onboarding API provides endpoints that you can use to generate links to Adyen-hosted pages, such as an onboarding page or a PCI compliance questionnaire. You can provide these links to your account holders so that they can complete their onboarding. | [HostedOnboardingPages](src/Adyen/Service/Hop.php) | **v1** | +| [Account API](https://docs.adyen.com/api-explorer/Account/5/overview) | The Account API provides endpoints for managing account-related entities on your platform. These related entities include account holders, accounts, bank accounts, shareholders, and verification-related documents. The management operations include actions such as creation, retrieval, updating, and deletion of them. | [Account](src/Adyen/Service/Account.php) | **v5** | +| [Fund API](https://docs.adyen.com/api-explorer/Fund/5/overview) | The Fund API provides endpoints for managing the funds in the accounts on your platform. These management operations include, for example, the transfer of funds from one account to another, the payout of funds to an account holder, and the retrieval of balances in an account. | [Fund](src/Adyen/Service/Fund.php) | **v5** | +| [Terminal API (Cloud communications)](https://docs.adyen.com/point-of-sale/choose-your-architecture/cloud) | Our point-of-sale integration. | [Cloud-based Terminal API](src/Adyen/Service/PosPayment.php) | Cloud-based Terminal API | | +| [Terminal API (Local communications)](https://docs.adyen.com/point-of-sale/choose-your-architecture/local) | Our point-of-sale integration. | [Local-based Terminal API](src/Adyen/Service/PosPayment.php) | Local-based Terminal API | | +| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | This API provides endpoints for managing your point-of-sale (POS) payment terminals. You can use the API to obtain information about a specific terminal, retrieve overviews of your terminals and stores, and assign terminals to a merchant account or store. | [POSTerminalManagement](src/Adyen/Service/POSTerminalManagementApi.php) | **v1** | +| [Disputes API](https://docs.adyen.com/api-explorer/Disputes/30/overview) | You can use the [Disputes API](https://docs.adyen.com/risk-management/disputes-api) to automate the dispute handling process so that you can respond to disputes and chargebacks as soon as they are initiated. The Disputes API lets you retrieve defense reasons, supply and delete defense documents, and accept or defend disputes. | [Disputes](src/Adyen/Service/DisputesApi.php) | **v30** | ## Supported Webhook versions The library supports all webhooks under the following model directories: -| Webhooks | Description | Model Name | Supported Version | -|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|-------------------| -| [Authentication Webhooks](https://docs.adyen.com/api-explorer/acs-webhook/1/overview) | Adyen sends this webhook when the process of cardholder authentication is finalized, whether it is completed successfully, fails, or expires. | [AcsWebhooks](src/Adyen/Model/AcsWebhooks) | **v1** | -| [Configuration Webhooks](https://docs.adyen.com/api-explorer/balanceplatform-webhooks/1/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update internal statuses when the status of a capability is changed. | [ConfigurationWebhooks](src/Adyen/Model/ConfigurationWebhooks) | **v1** | -| [Transfer Webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/3/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | [TransferWebhooks](src/Adyen/Model/TransferWebhooks) | **v3** | -| [Report Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | [ReportWebhooks](src/Adyen/Model/ReportWebhooks) | **v1** | -| [Management Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/1/overview) | Adyen uses webhooks to inform your system about events that happen with your Adyen company and merchant accounts, stores, payment terminals, and payment methods when using Management API. | [ManagementWebhooks](src/Adyen/Model/ManagementWebhooks) | **v1** | -| [Notification Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | [Notification](src/Adyen/Service/Notification.php) | **v1** | +| Webhooks | Description | Model Name | Supported Version | +|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|-------------------| +| [Authentication Webhooks](https://docs.adyen.com/api-explorer/acs-webhook/1/overview) | Adyen sends this webhook when the process of cardholder authentication is finalized, whether it is completed successfully, fails, or expires. | [AcsWebhooks](src/Adyen/Model/AcsWebhooks) | **v1** | +| [Configuration Webhooks](https://docs.adyen.com/api-explorer/balanceplatform-webhooks/1/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update internal statuses when the status of a capability is changed. | [ConfigurationWebhooks](src/Adyen/Model/ConfigurationWebhooks) | **v1** | +| [Transfer Webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/3/overview) | You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | [TransferWebhooks](src/Adyen/Model/TransferWebhooks) | **v3** | +| [Report Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | [ReportWebhooks](src/Adyen/Model/ReportWebhooks) | **v1** | +| [Management Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/1/overview) | Adyen uses webhooks to inform your system about events that happen with your Adyen company and merchant accounts, stores, payment terminals, and payment methods when using Management API. | [ManagementWebhooks](src/Adyen/Model/ManagementWebhooks) | **v1** | +| [Notification Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | [Notification](src/Adyen/Service/Notification.php) | **v1** | For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/). diff --git a/src/Adyen/Model/Disputes/AcceptDisputeRequest.php b/src/Adyen/Model/Disputes/AcceptDisputeRequest.php new file mode 100644 index 000000000..9fb562274 --- /dev/null +++ b/src/Adyen/Model/Disputes/AcceptDisputeRequest.php @@ -0,0 +1,424 @@ + + */ +class AcceptDisputeRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AcceptDisputeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/AcceptDisputeResponse.php b/src/Adyen/Model/Disputes/AcceptDisputeResponse.php new file mode 100644 index 000000000..7b4048e63 --- /dev/null +++ b/src/Adyen/Model/Disputes/AcceptDisputeResponse.php @@ -0,0 +1,387 @@ + + */ +class AcceptDisputeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AcceptDisputeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefendDisputeRequest.php b/src/Adyen/Model/Disputes/DefendDisputeRequest.php new file mode 100644 index 000000000..9c43e876c --- /dev/null +++ b/src/Adyen/Model/Disputes/DefendDisputeRequest.php @@ -0,0 +1,461 @@ + + */ +class DefendDisputeRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefendDisputeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseReasonCode' => 'string', + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseReasonCode' => null, + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseReasonCode' => false, + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseReasonCode' => 'defenseReasonCode', + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseReasonCode' => 'setDefenseReasonCode', + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseReasonCode' => 'getDefenseReasonCode', + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('defenseReasonCode', $data ?? [], null); + $this->setIfExists('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['defenseReasonCode'] === null) { + $invalidProperties[] = "'defenseReasonCode' can't be null"; + } + if ($this->container['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 defenseReasonCode + * + * @return string + */ + public function getDefenseReasonCode() + { + return $this->container['defenseReasonCode']; + } + + /** + * Sets defenseReasonCode + * + * @param string $defenseReasonCode The defense reason code that was selected to defend this dispute. + * + * @return self + */ + public function setDefenseReasonCode($defenseReasonCode) + { + if (is_null($defenseReasonCode)) { + throw new \InvalidArgumentException('non-nullable defenseReasonCode cannot be null'); + } + $this->container['defenseReasonCode'] = $defenseReasonCode; + + return $this; + } + + /** + * Gets disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefendDisputeResponse.php b/src/Adyen/Model/Disputes/DefendDisputeResponse.php new file mode 100644 index 000000000..7869580b8 --- /dev/null +++ b/src/Adyen/Model/Disputes/DefendDisputeResponse.php @@ -0,0 +1,387 @@ + + */ +class DefendDisputeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefendDisputeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefenseDocument.php b/src/Adyen/Model/Disputes/DefenseDocument.php new file mode 100644 index 000000000..058738fbf --- /dev/null +++ b/src/Adyen/Model/Disputes/DefenseDocument.php @@ -0,0 +1,461 @@ + + */ +class DefenseDocument implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefenseDocument'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => 'string', + 'contentType' => 'string', + 'defenseDocumentTypeCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => 'byte', + 'contentType' => null, + 'defenseDocumentTypeCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'content' => false, + 'contentType' => false, + 'defenseDocumentTypeCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'content' => 'content', + 'contentType' => 'contentType', + 'defenseDocumentTypeCode' => 'defenseDocumentTypeCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'contentType' => 'setContentType', + 'defenseDocumentTypeCode' => 'setDefenseDocumentTypeCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'contentType' => 'getContentType', + 'defenseDocumentTypeCode' => 'getDefenseDocumentTypeCode' + ]; + + /** + * 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('content', $data ?? [], null); + $this->setIfExists('contentType', $data ?? [], null); + $this->setIfExists('defenseDocumentTypeCode', $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['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['contentType'] === null) { + $invalidProperties[] = "'contentType' can't be null"; + } + if ($this->container['defenseDocumentTypeCode'] === null) { + $invalidProperties[] = "'defenseDocumentTypeCode' 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 content + * + * @return string + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string $content The content of the defense document. + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets contentType + * + * @return string + */ + public function getContentType() + { + return $this->container['contentType']; + } + + /** + * Sets contentType + * + * @param string $contentType The content type of the defense document. + * + * @return self + */ + public function setContentType($contentType) + { + if (is_null($contentType)) { + throw new \InvalidArgumentException('non-nullable contentType cannot be null'); + } + $this->container['contentType'] = $contentType; + + return $this; + } + + /** + * Gets defenseDocumentTypeCode + * + * @return string + */ + public function getDefenseDocumentTypeCode() + { + return $this->container['defenseDocumentTypeCode']; + } + + /** + * Sets defenseDocumentTypeCode + * + * @param string $defenseDocumentTypeCode The document type code of the defense document. + * + * @return self + */ + public function setDefenseDocumentTypeCode($defenseDocumentTypeCode) + { + if (is_null($defenseDocumentTypeCode)) { + throw new \InvalidArgumentException('non-nullable defenseDocumentTypeCode cannot be null'); + } + $this->container['defenseDocumentTypeCode'] = $defenseDocumentTypeCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefenseDocumentType.php b/src/Adyen/Model/Disputes/DefenseDocumentType.php new file mode 100644 index 000000000..310d94609 --- /dev/null +++ b/src/Adyen/Model/Disputes/DefenseDocumentType.php @@ -0,0 +1,461 @@ + + */ +class DefenseDocumentType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefenseDocumentType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'available' => 'bool', + 'defenseDocumentTypeCode' => 'string', + 'requirementLevel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'available' => null, + 'defenseDocumentTypeCode' => null, + 'requirementLevel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'available' => false, + 'defenseDocumentTypeCode' => false, + 'requirementLevel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'available' => 'available', + 'defenseDocumentTypeCode' => 'defenseDocumentTypeCode', + 'requirementLevel' => 'requirementLevel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'available' => 'setAvailable', + 'defenseDocumentTypeCode' => 'setDefenseDocumentTypeCode', + 'requirementLevel' => 'setRequirementLevel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'available' => 'getAvailable', + 'defenseDocumentTypeCode' => 'getDefenseDocumentTypeCode', + 'requirementLevel' => 'getRequirementLevel' + ]; + + /** + * 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('available', $data ?? [], null); + $this->setIfExists('defenseDocumentTypeCode', $data ?? [], null); + $this->setIfExists('requirementLevel', $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['available'] === null) { + $invalidProperties[] = "'available' can't be null"; + } + if ($this->container['defenseDocumentTypeCode'] === null) { + $invalidProperties[] = "'defenseDocumentTypeCode' can't be null"; + } + if ($this->container['requirementLevel'] === null) { + $invalidProperties[] = "'requirementLevel' 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 available + * + * @return bool + */ + public function getAvailable() + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param bool $available When **true**, you've successfully uploaded this type of defense document. When **false**, you haven't uploaded this defense document type. + * + * @return self + */ + public function setAvailable($available) + { + if (is_null($available)) { + throw new \InvalidArgumentException('non-nullable available cannot be null'); + } + $this->container['available'] = $available; + + return $this; + } + + /** + * Gets defenseDocumentTypeCode + * + * @return string + */ + public function getDefenseDocumentTypeCode() + { + return $this->container['defenseDocumentTypeCode']; + } + + /** + * Sets defenseDocumentTypeCode + * + * @param string $defenseDocumentTypeCode The document type code of the defense document. + * + * @return self + */ + public function setDefenseDocumentTypeCode($defenseDocumentTypeCode) + { + if (is_null($defenseDocumentTypeCode)) { + throw new \InvalidArgumentException('non-nullable defenseDocumentTypeCode cannot be null'); + } + $this->container['defenseDocumentTypeCode'] = $defenseDocumentTypeCode; + + return $this; + } + + /** + * Gets requirementLevel + * + * @return string + */ + public function getRequirementLevel() + { + return $this->container['requirementLevel']; + } + + /** + * Sets requirementLevel + * + * @param string $requirementLevel Indicates to what extent the defense document is required in the defense process. Possible values: * **Required**: You must supply the document. * **OneOrMore**: You must supply at least one of the documents with this label. * **Optional**: You can choose to supply the document. * **AlternativeRequired**: You must supply a generic defense document. To enable this functionality, contact our Support Team. When enabled, you can supply a generic defense document for all schemes. + * + * @return self + */ + public function setRequirementLevel($requirementLevel) + { + if (is_null($requirementLevel)) { + throw new \InvalidArgumentException('non-nullable requirementLevel cannot be null'); + } + $this->container['requirementLevel'] = $requirementLevel; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefenseReason.php b/src/Adyen/Model/Disputes/DefenseReason.php new file mode 100644 index 000000000..7c84f7921 --- /dev/null +++ b/src/Adyen/Model/Disputes/DefenseReason.php @@ -0,0 +1,458 @@ + + */ +class DefenseReason implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefenseReason'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseDocumentTypes' => '\Adyen\Model\Disputes\DefenseDocumentType[]', + 'defenseReasonCode' => 'string', + 'satisfied' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseDocumentTypes' => null, + 'defenseReasonCode' => null, + 'satisfied' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseDocumentTypes' => false, + 'defenseReasonCode' => false, + 'satisfied' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseDocumentTypes' => 'defenseDocumentTypes', + 'defenseReasonCode' => 'defenseReasonCode', + 'satisfied' => 'satisfied' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseDocumentTypes' => 'setDefenseDocumentTypes', + 'defenseReasonCode' => 'setDefenseReasonCode', + 'satisfied' => 'setSatisfied' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseDocumentTypes' => 'getDefenseDocumentTypes', + 'defenseReasonCode' => 'getDefenseReasonCode', + 'satisfied' => 'getSatisfied' + ]; + + /** + * 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('defenseDocumentTypes', $data ?? [], null); + $this->setIfExists('defenseReasonCode', $data ?? [], null); + $this->setIfExists('satisfied', $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['defenseReasonCode'] === null) { + $invalidProperties[] = "'defenseReasonCode' can't be null"; + } + if ($this->container['satisfied'] === null) { + $invalidProperties[] = "'satisfied' 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 defenseDocumentTypes + * + * @return \Adyen\Model\Disputes\DefenseDocumentType[]|null + */ + public function getDefenseDocumentTypes() + { + return $this->container['defenseDocumentTypes']; + } + + /** + * Sets defenseDocumentTypes + * + * @param \Adyen\Model\Disputes\DefenseDocumentType[]|null $defenseDocumentTypes Array of defense document types for a specific defense reason. Indicates the document types that you can submit to the schemes to defend this dispute, and whether they are required. + * + * @return self + */ + public function setDefenseDocumentTypes($defenseDocumentTypes) + { + if (is_null($defenseDocumentTypes)) { + throw new \InvalidArgumentException('non-nullable defenseDocumentTypes cannot be null'); + } + $this->container['defenseDocumentTypes'] = $defenseDocumentTypes; + + return $this; + } + + /** + * Gets defenseReasonCode + * + * @return string + */ + public function getDefenseReasonCode() + { + return $this->container['defenseReasonCode']; + } + + /** + * Sets defenseReasonCode + * + * @param string $defenseReasonCode The defense reason code that was selected to defend this dispute. + * + * @return self + */ + public function setDefenseReasonCode($defenseReasonCode) + { + if (is_null($defenseReasonCode)) { + throw new \InvalidArgumentException('non-nullable defenseReasonCode cannot be null'); + } + $this->container['defenseReasonCode'] = $defenseReasonCode; + + return $this; + } + + /** + * Gets satisfied + * + * @return bool + */ + public function getSatisfied() + { + return $this->container['satisfied']; + } + + /** + * Sets satisfied + * + * @param bool $satisfied Indicates if sufficient defense material has been supplied. + * + * @return self + */ + public function setSatisfied($satisfied) + { + if (is_null($satisfied)) { + throw new \InvalidArgumentException('non-nullable satisfied cannot be null'); + } + $this->container['satisfied'] = $satisfied; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefenseReasonsRequest.php b/src/Adyen/Model/Disputes/DefenseReasonsRequest.php new file mode 100644 index 000000000..f6d7373ee --- /dev/null +++ b/src/Adyen/Model/Disputes/DefenseReasonsRequest.php @@ -0,0 +1,424 @@ + + */ +class DefenseReasonsRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefenseReasonsRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DefenseReasonsResponse.php b/src/Adyen/Model/Disputes/DefenseReasonsResponse.php new file mode 100644 index 000000000..351ebc2a5 --- /dev/null +++ b/src/Adyen/Model/Disputes/DefenseReasonsResponse.php @@ -0,0 +1,421 @@ + + */ +class DefenseReasonsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DefenseReasonsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseReasons' => '\Adyen\Model\Disputes\DefenseReason[]', + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseReasons' => null, + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseReasons' => false, + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseReasons' => 'defenseReasons', + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseReasons' => 'setDefenseReasons', + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseReasons' => 'getDefenseReasons', + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('defenseReasons', $data ?? [], null); + $this->setIfExists('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 defenseReasons + * + * @return \Adyen\Model\Disputes\DefenseReason[]|null + */ + public function getDefenseReasons() + { + return $this->container['defenseReasons']; + } + + /** + * Sets defenseReasons + * + * @param \Adyen\Model\Disputes\DefenseReason[]|null $defenseReasons The defense reasons that can be used to defend the dispute. + * + * @return self + */ + public function setDefenseReasons($defenseReasons) + { + if (is_null($defenseReasons)) { + throw new \InvalidArgumentException('non-nullable defenseReasons cannot be null'); + } + $this->container['defenseReasons'] = $defenseReasons; + + return $this; + } + + /** + * Gets disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DeleteDefenseDocumentRequest.php b/src/Adyen/Model/Disputes/DeleteDefenseDocumentRequest.php new file mode 100644 index 000000000..1dabe693d --- /dev/null +++ b/src/Adyen/Model/Disputes/DeleteDefenseDocumentRequest.php @@ -0,0 +1,461 @@ + + */ +class DeleteDefenseDocumentRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeleteDefenseDocumentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseDocumentType' => 'string', + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseDocumentType' => null, + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseDocumentType' => false, + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseDocumentType' => 'defenseDocumentType', + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseDocumentType' => 'setDefenseDocumentType', + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseDocumentType' => 'getDefenseDocumentType', + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('defenseDocumentType', $data ?? [], null); + $this->setIfExists('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['defenseDocumentType'] === null) { + $invalidProperties[] = "'defenseDocumentType' can't be null"; + } + if ($this->container['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 defenseDocumentType + * + * @return string + */ + public function getDefenseDocumentType() + { + return $this->container['defenseDocumentType']; + } + + /** + * Sets defenseDocumentType + * + * @param string $defenseDocumentType The document type code of the defense document. + * + * @return self + */ + public function setDefenseDocumentType($defenseDocumentType) + { + if (is_null($defenseDocumentType)) { + throw new \InvalidArgumentException('non-nullable defenseDocumentType cannot be null'); + } + $this->container['defenseDocumentType'] = $defenseDocumentType; + + return $this; + } + + /** + * Gets disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DeleteDefenseDocumentResponse.php b/src/Adyen/Model/Disputes/DeleteDefenseDocumentResponse.php new file mode 100644 index 000000000..4751dd5d1 --- /dev/null +++ b/src/Adyen/Model/Disputes/DeleteDefenseDocumentResponse.php @@ -0,0 +1,387 @@ + + */ +class DeleteDefenseDocumentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeleteDefenseDocumentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DisputeServiceResult.php b/src/Adyen/Model/Disputes/DisputeServiceResult.php new file mode 100644 index 000000000..311c22394 --- /dev/null +++ b/src/Adyen/Model/Disputes/DisputeServiceResult.php @@ -0,0 +1,421 @@ + + */ +class DisputeServiceResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DisputeServiceResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errorMessage' => 'string', + 'success' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errorMessage' => null, + 'success' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'errorMessage' => false, + 'success' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'errorMessage' => 'errorMessage', + 'success' => 'success' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errorMessage' => 'setErrorMessage', + 'success' => 'setSuccess' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errorMessage' => 'getErrorMessage', + 'success' => 'getSuccess' + ]; + + /** + * 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('errorMessage', $data ?? [], null); + $this->setIfExists('success', $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['success'] === null) { + $invalidProperties[] = "'success' 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 errorMessage + * + * @return string|null + */ + public function getErrorMessage() + { + return $this->container['errorMessage']; + } + + /** + * Sets errorMessage + * + * @param string|null $errorMessage The general error message. + * + * @return self + */ + public function setErrorMessage($errorMessage) + { + if (is_null($errorMessage)) { + throw new \InvalidArgumentException('non-nullable errorMessage cannot be null'); + } + $this->container['errorMessage'] = $errorMessage; + + return $this; + } + + /** + * Gets success + * + * @return bool + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool $success Indicates whether the request succeeded. + * + * @return self + */ + public function setSuccess($success) + { + if (is_null($success)) { + throw new \InvalidArgumentException('non-nullable success cannot be null'); + } + $this->container['success'] = $success; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DownloadDefenseDocumentRequest.php b/src/Adyen/Model/Disputes/DownloadDefenseDocumentRequest.php new file mode 100644 index 000000000..dcca98aff --- /dev/null +++ b/src/Adyen/Model/Disputes/DownloadDefenseDocumentRequest.php @@ -0,0 +1,461 @@ + + */ +class DownloadDefenseDocumentRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DownloadDefenseDocumentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseDocumentType' => 'string', + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseDocumentType' => null, + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseDocumentType' => false, + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseDocumentType' => 'defenseDocumentType', + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseDocumentType' => 'setDefenseDocumentType', + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseDocumentType' => 'getDefenseDocumentType', + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('defenseDocumentType', $data ?? [], null); + $this->setIfExists('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['defenseDocumentType'] === null) { + $invalidProperties[] = "'defenseDocumentType' can't be null"; + } + if ($this->container['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 defenseDocumentType + * + * @return string + */ + public function getDefenseDocumentType() + { + return $this->container['defenseDocumentType']; + } + + /** + * Sets defenseDocumentType + * + * @param string $defenseDocumentType The document type code of the defense document. + * + * @return self + */ + public function setDefenseDocumentType($defenseDocumentType) + { + if (is_null($defenseDocumentType)) { + throw new \InvalidArgumentException('non-nullable defenseDocumentType cannot be null'); + } + $this->container['defenseDocumentType'] = $defenseDocumentType; + + return $this; + } + + /** + * Gets disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/DownloadDefenseDocumentResponse.php b/src/Adyen/Model/Disputes/DownloadDefenseDocumentResponse.php new file mode 100644 index 000000000..1951854be --- /dev/null +++ b/src/Adyen/Model/Disputes/DownloadDefenseDocumentResponse.php @@ -0,0 +1,455 @@ + + */ +class DownloadDefenseDocumentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DownloadDefenseDocumentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'content' => 'string', + 'contentType' => 'string', + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'content' => 'byte', + 'contentType' => null, + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'content' => false, + 'contentType' => false, + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'content' => 'content', + 'contentType' => 'contentType', + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent', + 'contentType' => 'setContentType', + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent', + 'contentType' => 'getContentType', + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('content', $data ?? [], null); + $this->setIfExists('contentType', $data ?? [], null); + $this->setIfExists('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 content + * + * @return string|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string|null $content The content of the defense document in Base64 binary format. Must be encoded in the format that is specified in the `contentType` field. + * + * @return self + */ + public function setContent($content) + { + if (is_null($content)) { + throw new \InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets contentType + * + * @return string|null + */ + public function getContentType() + { + return $this->container['contentType']; + } + + /** + * Sets contentType + * + * @param string|null $contentType The content type of the dispute defense document. Possible values: * **image/jpg** * **image/jpeg** * **image/tiff** * **application/pdf** + * + * @return self + */ + public function setContentType($contentType) + { + if (is_null($contentType)) { + throw new \InvalidArgumentException('non-nullable contentType cannot be null'); + } + $this->container['contentType'] = $contentType; + + return $this; + } + + /** + * Gets disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/ModelInterface.php b/src/Adyen/Model/Disputes/ModelInterface.php new file mode 100644 index 000000000..ad34e3398 --- /dev/null +++ b/src/Adyen/Model/Disputes/ModelInterface.php @@ -0,0 +1,92 @@ +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); + } + + /** + * 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 = '\Adyen\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; + } + } +} diff --git a/src/Adyen/Model/Disputes/ServiceError.php b/src/Adyen/Model/Disputes/ServiceError.php new file mode 100644 index 000000000..7a49c53ec --- /dev/null +++ b/src/Adyen/Model/Disputes/ServiceError.php @@ -0,0 +1,518 @@ + + */ +class ServiceError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServiceError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errorCode' => 'string', + 'errorType' => 'string', + 'message' => 'string', + 'pspReference' => 'string', + 'status' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errorCode' => null, + 'errorType' => null, + 'message' => null, + 'pspReference' => null, + 'status' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'errorCode' => false, + 'errorType' => false, + 'message' => false, + 'pspReference' => false, + 'status' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'errorCode' => 'errorCode', + 'errorType' => 'errorType', + 'message' => 'message', + 'pspReference' => 'pspReference', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errorCode' => 'setErrorCode', + 'errorType' => 'setErrorType', + 'message' => 'setMessage', + 'pspReference' => 'setPspReference', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errorCode' => 'getErrorCode', + 'errorType' => 'getErrorType', + 'message' => 'getMessage', + 'pspReference' => 'getPspReference', + '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; + } + + + /** + * 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('errorCode', $data ?? [], null); + $this->setIfExists('errorType', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('pspReference', $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 = []; + + 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 errorCode + * + * @return string|null + */ + public function getErrorCode() + { + return $this->container['errorCode']; + } + + /** + * Sets errorCode + * + * @param string|null $errorCode The error code mapped to the error message. + * + * @return self + */ + public function setErrorCode($errorCode) + { + if (is_null($errorCode)) { + throw new \InvalidArgumentException('non-nullable errorCode cannot be null'); + } + $this->container['errorCode'] = $errorCode; + + return $this; + } + + /** + * Gets errorType + * + * @return string|null + */ + public function getErrorType() + { + return $this->container['errorType']; + } + + /** + * Sets errorType + * + * @param string|null $errorType The category of the error. + * + * @return self + */ + public function setErrorType($errorType) + { + if (is_null($errorType)) { + throw new \InvalidArgumentException('non-nullable errorType cannot be null'); + } + $this->container['errorType'] = $errorType; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message A short explanation of the issue. + * + * @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 pspReference + * + * @return string|null + */ + public function getPspReference() + { + return $this->container['pspReference']; + } + + /** + * Sets pspReference + * + * @param string|null $pspReference The PSP reference of the payment. + * + * @return self + */ + public function setPspReference($pspReference) + { + if (is_null($pspReference)) { + throw new \InvalidArgumentException('non-nullable pspReference cannot be null'); + } + $this->container['pspReference'] = $pspReference; + + return $this; + } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status The HTTP response status. + * + * @return self + */ + public function setStatus($status) + { + // Do nothing for nullable integers + $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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/SupplyDefenseDocumentRequest.php b/src/Adyen/Model/Disputes/SupplyDefenseDocumentRequest.php new file mode 100644 index 000000000..ade9755f8 --- /dev/null +++ b/src/Adyen/Model/Disputes/SupplyDefenseDocumentRequest.php @@ -0,0 +1,461 @@ + + */ +class SupplyDefenseDocumentRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SupplyDefenseDocumentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'defenseDocuments' => '\Adyen\Model\Disputes\DefenseDocument[]', + 'disputePspReference' => 'string', + 'merchantAccountCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'defenseDocuments' => null, + 'disputePspReference' => null, + 'merchantAccountCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'defenseDocuments' => false, + 'disputePspReference' => false, + 'merchantAccountCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'defenseDocuments' => 'defenseDocuments', + 'disputePspReference' => 'disputePspReference', + 'merchantAccountCode' => 'merchantAccountCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'defenseDocuments' => 'setDefenseDocuments', + 'disputePspReference' => 'setDisputePspReference', + 'merchantAccountCode' => 'setMerchantAccountCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'defenseDocuments' => 'getDefenseDocuments', + 'disputePspReference' => 'getDisputePspReference', + 'merchantAccountCode' => 'getMerchantAccountCode' + ]; + + /** + * 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('defenseDocuments', $data ?? [], null); + $this->setIfExists('disputePspReference', $data ?? [], null); + $this->setIfExists('merchantAccountCode', $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['defenseDocuments'] === null) { + $invalidProperties[] = "'defenseDocuments' can't be null"; + } + if ($this->container['disputePspReference'] === null) { + $invalidProperties[] = "'disputePspReference' can't be null"; + } + if ($this->container['merchantAccountCode'] === null) { + $invalidProperties[] = "'merchantAccountCode' 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 defenseDocuments + * + * @return \Adyen\Model\Disputes\DefenseDocument[] + */ + public function getDefenseDocuments() + { + return $this->container['defenseDocuments']; + } + + /** + * Sets defenseDocuments + * + * @param \Adyen\Model\Disputes\DefenseDocument[] $defenseDocuments An array containing a list of the defense documents. + * + * @return self + */ + public function setDefenseDocuments($defenseDocuments) + { + if (is_null($defenseDocuments)) { + throw new \InvalidArgumentException('non-nullable defenseDocuments cannot be null'); + } + $this->container['defenseDocuments'] = $defenseDocuments; + + return $this; + } + + /** + * Gets disputePspReference + * + * @return string + */ + public function getDisputePspReference() + { + return $this->container['disputePspReference']; + } + + /** + * Sets disputePspReference + * + * @param string $disputePspReference The PSP reference assigned to the dispute. + * + * @return self + */ + public function setDisputePspReference($disputePspReference) + { + if (is_null($disputePspReference)) { + throw new \InvalidArgumentException('non-nullable disputePspReference cannot be null'); + } + $this->container['disputePspReference'] = $disputePspReference; + + return $this; + } + + /** + * Gets merchantAccountCode + * + * @return string + */ + public function getMerchantAccountCode() + { + return $this->container['merchantAccountCode']; + } + + /** + * Sets merchantAccountCode + * + * @param string $merchantAccountCode The merchant account identifier, for which you want to process the dispute transaction. + * + * @return self + */ + public function setMerchantAccountCode($merchantAccountCode) + { + if (is_null($merchantAccountCode)) { + throw new \InvalidArgumentException('non-nullable merchantAccountCode cannot be null'); + } + $this->container['merchantAccountCode'] = $merchantAccountCode; + + 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 + ); + } +} diff --git a/src/Adyen/Model/Disputes/SupplyDefenseDocumentResponse.php b/src/Adyen/Model/Disputes/SupplyDefenseDocumentResponse.php new file mode 100644 index 000000000..952baad7e --- /dev/null +++ b/src/Adyen/Model/Disputes/SupplyDefenseDocumentResponse.php @@ -0,0 +1,387 @@ + + */ +class SupplyDefenseDocumentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SupplyDefenseDocumentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeServiceResult' => '\Adyen\Model\Disputes\DisputeServiceResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeServiceResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeServiceResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $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 = [ + 'disputeServiceResult' => 'disputeServiceResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeServiceResult' => 'setDisputeServiceResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeServiceResult' => 'getDisputeServiceResult' + ]; + + /** + * 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('disputeServiceResult', $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['disputeServiceResult'] === null) { + $invalidProperties[] = "'disputeServiceResult' 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 disputeServiceResult + * + * @return \Adyen\Model\Disputes\DisputeServiceResult + */ + public function getDisputeServiceResult() + { + return $this->container['disputeServiceResult']; + } + + /** + * Sets disputeServiceResult + * + * @param \Adyen\Model\Disputes\DisputeServiceResult $disputeServiceResult disputeServiceResult + * + * @return self + */ + public function setDisputeServiceResult($disputeServiceResult) + { + if (is_null($disputeServiceResult)) { + throw new \InvalidArgumentException('non-nullable disputeServiceResult cannot be null'); + } + $this->container['disputeServiceResult'] = $disputeServiceResult; + + 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 + ); + } +} diff --git a/src/Adyen/Service/DisputesApi.php b/src/Adyen/Service/DisputesApi.php new file mode 100644 index 000000000..a4dde8f86 --- /dev/null +++ b/src/Adyen/Service/DisputesApi.php @@ -0,0 +1,130 @@ +baseURL = $this->createBaseUrl("https://ca-test.adyen.com/ca/services/DisputeService/v30"); + } + + /** + * Accept a dispute + * + * @param \Adyen\Model\Disputes\AcceptDisputeRequest $acceptDisputeRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\AcceptDisputeResponse + * @throws AdyenException + */ + public function acceptDispute(\Adyen\Model\Disputes\AcceptDisputeRequest $acceptDisputeRequest, array $requestOptions = null): \Adyen\Model\Disputes\AcceptDisputeResponse + { + $endpoint = $this->baseURL . "/acceptDispute"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $acceptDisputeRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\AcceptDisputeResponse::class); + } + + /** + * Defend a dispute + * + * @param \Adyen\Model\Disputes\DefendDisputeRequest $defendDisputeRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\DefendDisputeResponse + * @throws AdyenException + */ + public function defendDispute(\Adyen\Model\Disputes\DefendDisputeRequest $defendDisputeRequest, array $requestOptions = null): \Adyen\Model\Disputes\DefendDisputeResponse + { + $endpoint = $this->baseURL . "/defendDispute"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $defendDisputeRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\DefendDisputeResponse::class); + } + + /** + * Delete a defense document + * + * @param \Adyen\Model\Disputes\DeleteDefenseDocumentRequest $deleteDefenseDocumentRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\DeleteDefenseDocumentResponse + * @throws AdyenException + */ + public function deleteDisputeDefenseDocument(\Adyen\Model\Disputes\DeleteDefenseDocumentRequest $deleteDefenseDocumentRequest, array $requestOptions = null): \Adyen\Model\Disputes\DeleteDefenseDocumentResponse + { + $endpoint = $this->baseURL . "/deleteDisputeDefenseDocument"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $deleteDefenseDocumentRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\DeleteDefenseDocumentResponse::class); + } + + /** + * Download a defense document + * + * @param \Adyen\Model\Disputes\DownloadDefenseDocumentRequest $downloadDefenseDocumentRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\DownloadDefenseDocumentResponse + * @throws AdyenException + */ + public function downloadDisputeDefenseDocument(\Adyen\Model\Disputes\DownloadDefenseDocumentRequest $downloadDefenseDocumentRequest, array $requestOptions = null): \Adyen\Model\Disputes\DownloadDefenseDocumentResponse + { + $endpoint = $this->baseURL . "/downloadDisputeDefenseDocument"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $downloadDefenseDocumentRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\DownloadDefenseDocumentResponse::class); + } + + /** + * Get applicable defense reasons + * + * @param \Adyen\Model\Disputes\DefenseReasonsRequest $defenseReasonsRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\DefenseReasonsResponse + * @throws AdyenException + */ + public function retrieveApplicableDefenseReasons(\Adyen\Model\Disputes\DefenseReasonsRequest $defenseReasonsRequest, array $requestOptions = null): \Adyen\Model\Disputes\DefenseReasonsResponse + { + $endpoint = $this->baseURL . "/retrieveApplicableDefenseReasons"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $defenseReasonsRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\DefenseReasonsResponse::class); + } + + /** + * Supply a defense document + * + * @param \Adyen\Model\Disputes\SupplyDefenseDocumentRequest $supplyDefenseDocumentRequest + * @param array|null $requestOptions + * @return \Adyen\Model\Disputes\SupplyDefenseDocumentResponse + * @throws AdyenException + */ + public function supplyDefenseDocument(\Adyen\Model\Disputes\SupplyDefenseDocumentRequest $supplyDefenseDocumentRequest, array $requestOptions = null): \Adyen\Model\Disputes\SupplyDefenseDocumentResponse + { + $endpoint = $this->baseURL . "/supplyDefenseDocument"; + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $supplyDefenseDocumentRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\Disputes\SupplyDefenseDocumentResponse::class); + } +} diff --git a/tests/Resources/Disputes/generic-200.json b/tests/Resources/Disputes/generic-200.json new file mode 100644 index 000000000..ef664389c --- /dev/null +++ b/tests/Resources/Disputes/generic-200.json @@ -0,0 +1,5 @@ +{ + "disputeServiceResult": { + "success": true + } +} \ No newline at end of file diff --git a/tests/Unit/DisputesTest.php b/tests/Unit/DisputesTest.php new file mode 100644 index 000000000..0139784c5 --- /dev/null +++ b/tests/Unit/DisputesTest.php @@ -0,0 +1,88 @@ +createMockClientUrl("tests/Resources/Disputes/generic-200.json"); + // initialize service + $service = new \Adyen\Service\DisputesApi($client); + $response = $service->acceptDispute(new \Adyen\Model\Disputes\AcceptDisputeRequest( + json_decode('{ + "disputePspReference": "DZ4DPSHB4WD2WN82", + "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT" + }', true) + )); + + $this->assertNotEmpty(json_encode($response->jsonSerialize())); + $this->assertEquals("AcceptDisputeResponse", $response->getModelName()); + $this->assertTrue($response->getDisputeServiceResult()->getSuccess()); + $this->assertEquals( + 'https://ca-test.adyen.com/ca/services/DisputeService/v30/acceptDispute', + $this->requestUrl + ); + } + + /** + * @throws AdyenException + * @throws \Adyen\AdyenException + */ + public function testDefendDispute() + { + $client = $this->createMockClientUrl("tests/Resources/Disputes/generic-200.json"); + // initialize service + $service = new \Adyen\Service\DisputesApi($client); + $response = $service->defendDispute(new \Adyen\Model\Disputes\DefendDisputeRequest( + json_decode('{ + "defenseReasonCode": "SupplyDefenseMaterial", + "disputePspReference": "DZ4DPSHB4WD2WN82", + "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT" + }', true) + )); + + $this->assertNotEmpty(json_encode($response->jsonSerialize())); + $this->assertEquals("DefendDisputeResponse", $response->getModelName()); + $this->assertTrue($response->getDisputeServiceResult()->getSuccess()); + $this->assertEquals( + 'https://ca-test.adyen.com/ca/services/DisputeService/v30/defendDispute', + $this->requestUrl + ); + } + + /** + * @throws AdyenException + * @throws \Adyen\AdyenException + */ + public function testSupplyDefenseDocuments() + { + $client = $this->createMockClientUrl("tests/Resources/Disputes/generic-200.json"); + // initialize service + $service = new \Adyen\Service\DisputesApi($client); + $response = $service->supplyDefenseDocument(new \Adyen\Model\Disputes\SupplyDefenseDocumentRequest( + json_decode('{ + "defenseDocuments": [ + { + "content": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBv+f/ub0j6JPRX+E3EmC==", + "contentType": "application/pdf", + "defenseDocumentTypeCode": "DefenseMaterial" + } + ], + "disputePspReference": "DZ4DPSHB4WD2WN82", + "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT" + }', true) + )); + + $this->assertNotEmpty(json_encode($response->jsonSerialize())); + $this->assertTrue($response->getDisputeServiceResult()->getSuccess()); + $this->assertEquals( + 'https://ca-test.adyen.com/ca/services/DisputeService/v30/supplyDefenseDocument', + $this->requestUrl + ); + } +} From 683e842ec11c068f19db2f92875bb0654e22ca61 Mon Sep 17 00:00:00 2001 From: Adyen Automation Date: Thu, 19 Oct 2023 14:24:56 +0000 Subject: [PATCH 2/2] chore(release): bump to 15.5.0 --- src/Adyen/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adyen/Client.php b/src/Adyen/Client.php index eeeac8d9c..64a88e5a9 100644 --- a/src/Adyen/Client.php +++ b/src/Adyen/Client.php @@ -7,7 +7,7 @@ class Client { - const LIB_VERSION = "15.4.0"; + const LIB_VERSION = "15.5.0"; const LIB_NAME = "adyen-php-api-library"; const USER_AGENT_SUFFIX = "adyen-php-api-library/"; const ENDPOINT_TEST = "https://pal-test.adyen.com";