From ece801dbc82d3846921da4675d80f59ecff544db Mon Sep 17 00:00:00 2001 From: WorldlineConnect Date: Tue, 19 Mar 2024 09:30:47 +0100 Subject: [PATCH] Release 7.0.0. --- .editorconfig | 12 + .gitattributes | 4 + .github/workflows/api-docs.yml | 56 ++ .gitignore | 10 + README.md | 58 ++ composer.json | 34 + documentation/Migration Guide v6 to v7.md | 197 +++++ lib/Worldline/Connect/Sdk/ApiResource.php | 70 ++ .../Sdk/Authentication/Authenticator.php | 18 + .../Authentication/V1HMACAuthenticator.php | 79 ++ lib/Worldline/Connect/Sdk/BodyHandler.php | 65 ++ lib/Worldline/Connect/Sdk/CallContext.php | 48 ++ .../CommunicatorLoggerHelper.php | 137 ++++ .../Connect/Sdk/Communication/Connection.php | 52 ++ .../Sdk/Communication/ConnectionResponse.php | 112 +++ .../Sdk/Communication/DefaultConnection.php | 462 +++++++++++ .../Communication/ErrorResponseException.php | 52 ++ .../Sdk/Communication/HttpHeaderHelper.php | 79 ++ .../Sdk/Communication/HttpObfuscator.php | 94 +++ .../InvalidResponseException.php | 38 + .../Sdk/Communication/MetadataProvider.php | 48 ++ .../Sdk/Communication/MultipartDataObject.php | 22 + .../Communication/MultipartFormDataObject.php | 98 +++ .../Sdk/Communication/RequestObject.php | 17 + .../Sdk/Communication/ResponseBuilder.php | 59 ++ .../Sdk/Communication/ResponseClassMap.php | 45 ++ .../Sdk/Communication/ResponseFactory.php | 71 ++ .../Communication/ResponseHeaderBuilder.php | 56 ++ .../Sdk/Communication/UuidGenerator.php | 31 + lib/Worldline/Connect/Sdk/Communicator.php | 596 ++++++++++++++ .../Connect/Sdk/CommunicatorConfiguration.php | 263 +++++++ .../Connect/Sdk/Domain/DataObject.php | 60 ++ .../Sdk/Domain/ShoppingCartExtension.php | 84 ++ .../Connect/Sdk/Domain/UploadableFile.php | 84 ++ lib/Worldline/Connect/Sdk/JSON/JSONUtil.php | 57 ++ .../Connect/Sdk/Logging/BodyObfuscator.php | 125 +++ .../Sdk/Logging/CommunicatorLogger.php | 23 + .../Connect/Sdk/Logging/HeaderObfuscator.php | 97 +++ .../Connect/Sdk/Logging/ResourceLogger.php | 46 ++ .../Sdk/Logging/SplFileObjectLogger.php | 49 ++ .../Connect/Sdk/Logging/ValueObfuscator.php | 72 ++ .../Connect/Sdk/ProxyConfiguration.php | 65 ++ .../Webhooks/ApiVersionMismatchException.php | 45 ++ .../Sdk/Webhooks/InMemorySecretKeyStore.php | 70 ++ .../SecretKeyNotAvailableException.php | 34 + .../Connect/Sdk/Webhooks/SecretKeyStore.php | 18 + .../Webhooks/SignatureValidationException.php | 22 + .../Sdk/Webhooks/SignatureValidator.php | 76 ++ phpunit.xml.dist | 13 + src/Worldline/Connect/Sdk/Client.php | 83 ++ src/Worldline/Connect/Sdk/V1/ApiException.php | 15 + .../Connect/Sdk/V1/AuthorizationException.php | 15 + .../Sdk/V1/DeclinedPaymentException.php | 32 + .../Sdk/V1/DeclinedPayoutException.php | 32 + .../Sdk/V1/DeclinedRefundException.php | 32 + .../Connect/Sdk/V1/Domain/APIError.php | 112 +++ ...BankTransferPaymentMethodSpecificInput.php | 45 ++ ...AbstractCardPaymentMethodSpecificInput.php | 206 +++++ ...AbstractCashPaymentMethodSpecificInput.php | 34 + ...ractEInvoicePaymentMethodSpecificInput.php | 45 ++ .../Sdk/V1/Domain/AbstractIndicator.php | 57 ++ .../Sdk/V1/Domain/AbstractOrderStatus.php | 46 ++ .../AbstractPaymentMethodSpecificInput.php | 46 ++ .../AbstractPaymentMethodSpecificOutput.php | 46 ++ .../AbstractPayoutMethodSpecificInput.php | 35 + ...ractRedirectPaymentMethodSpecificInput.php | 89 +++ ...edirectPaymentProduct4101SpecificInput.php | 35 + ...RedirectPaymentProduct840SpecificInput.php | 46 ++ ...aDirectDebitPaymentMethodSpecificInput.php | 34 + ...ectDebitPaymentProduct771SpecificInput.php | 47 ++ .../Sdk/V1/Domain/AbstractThreeDSecure.php | 146 ++++ .../Connect/Sdk/V1/Domain/AbstractToken.php | 46 ++ .../Sdk/V1/Domain/AccountFundingRecipient.php | 109 +++ .../Connect/Sdk/V1/Domain/AccountOnFile.php | 95 +++ .../Sdk/V1/Domain/AccountOnFileAttribute.php | 56 ++ .../V1/Domain/AccountOnFileDisplayHints.php | 69 ++ .../Sdk/V1/Domain/AdditionalOrderInput.php | 165 ++++ .../AdditionalOrderInputAirlineData.php | 65 ++ .../Connect/Sdk/V1/Domain/Address.php | 123 +++ .../Connect/Sdk/V1/Domain/AddressPersonal.php | 49 ++ .../Connect/Sdk/V1/Domain/AfrName.php | 57 ++ .../Connect/Sdk/V1/Domain/AirlineData.php | 335 ++++++++ .../Sdk/V1/Domain/AirlineFlightLeg.php | 256 ++++++ .../Sdk/V1/Domain/AirlinePassenger.php | 79 ++ .../Connect/Sdk/V1/Domain/AmountBreakdown.php | 57 ++ .../Connect/Sdk/V1/Domain/AmountOfMoney.php | 57 ++ ...PaymentCardPaymentMethodSpecificOutput.php | 46 ++ ...tDirectDebitPaymentMethodSpecificInput.php | 34 + ...ymentMobilePaymentMethodSpecificOutput.php | 46 ++ ...aDirectDebitPaymentMethodSpecificInput.php | 34 + ...provePaymentPaymentMethodSpecificInput.php | 57 ++ .../Sdk/V1/Domain/ApprovePaymentRequest.php | 91 +++ ...aDirectDebitPaymentMethodSpecificInput.php | 34 + .../Sdk/V1/Domain/ApprovePayoutRequest.php | 46 ++ .../Sdk/V1/Domain/ApproveRefundRequest.php | 46 ++ .../Sdk/V1/Domain/ApproveTokenRequest.php | 34 + .../Sdk/V1/Domain/AuthenticationIndicator.php | 34 + .../Connect/Sdk/V1/Domain/BankAccount.php | 46 ++ .../Connect/Sdk/V1/Domain/BankAccountBban.php | 100 +++ .../Sdk/V1/Domain/BankAccountBbanRefund.php | 67 ++ .../Connect/Sdk/V1/Domain/BankAccountIban.php | 45 ++ .../Connect/Sdk/V1/Domain/BankData.php | 79 ++ .../Connect/Sdk/V1/Domain/BankDetails.php | 65 ++ .../Sdk/V1/Domain/BankDetailsRequest.php | 34 + .../Sdk/V1/Domain/BankDetailsResponse.php | 95 +++ .../Domain/BankRefundMethodSpecificInput.php | 76 ++ ...BankTransferPaymentMethodSpecificInput.php | 34 + ...TransferPaymentMethodSpecificInputBase.php | 34 + ...ankTransferPaymentMethodSpecificOutput.php | 49 ++ .../BankTransferPayoutMethodSpecificInput.php | 113 +++ .../BoletoBancarioRequirednessValidator.php | 46 ++ .../Connect/Sdk/V1/Domain/BrowserData.php | 112 +++ .../Domain/CancelApprovalPaymentResponse.php | 50 ++ ...PaymentCardPaymentMethodSpecificOutput.php | 46 ++ ...ymentMobilePaymentMethodSpecificOutput.php | 46 ++ .../Sdk/V1/Domain/CancelPaymentResponse.php | 80 ++ .../Connect/Sdk/V1/Domain/Capture.php | 75 ++ .../Connect/Sdk/V1/Domain/CaptureOutput.php | 213 +++++ .../Sdk/V1/Domain/CapturePaymentRequest.php | 57 ++ .../Connect/Sdk/V1/Domain/CaptureResponse.php | 34 + .../Sdk/V1/Domain/CaptureStatusOutput.php | 80 ++ .../Sdk/V1/Domain/CapturesResponse.php | 58 ++ src/Worldline/Connect/Sdk/V1/Domain/Card.php | 56 ++ .../Connect/Sdk/V1/Domain/CardEssentials.php | 68 ++ .../Sdk/V1/Domain/CardFraudResults.php | 86 ++ .../Domain/CardPaymentMethodSpecificInput.php | 129 +++ .../CardPaymentMethodSpecificInputBase.php | 49 ++ .../CardPaymentMethodSpecificOutput.php | 123 +++ .../Domain/CardPayoutMethodSpecificInput.php | 86 ++ .../Sdk/V1/Domain/CardRecurrenceDetails.php | 68 ++ .../Connect/Sdk/V1/Domain/CardWithoutCvv.php | 45 ++ .../Domain/CashPaymentMethodSpecificInput.php | 140 ++++ .../CashPaymentMethodSpecificInputBase.php | 34 + .../CashPaymentMethodSpecificOutput.php | 49 ++ .../CashPaymentProduct1503SpecificInput.php | 48 ++ .../CashPaymentProduct1504SpecificInput.php | 34 + .../CashPaymentProduct1521SpecificInput.php | 34 + .../CashPaymentProduct1522SpecificInput.php | 34 + .../CashPaymentProduct1523SpecificInput.php | 34 + .../CashPaymentProduct1524SpecificInput.php | 34 + .../CashPaymentProduct1526SpecificInput.php | 34 + ...ntProductWithRedirectSpecificInputBase.php | 46 ++ .../Sdk/V1/Domain/CompanyInformation.php | 57 ++ ...ePaymentCardPaymentMethodSpecificInput.php | 50 ++ .../Sdk/V1/Domain/CompletePaymentRequest.php | 80 ++ .../Sdk/V1/Domain/CompletePaymentResponse.php | 34 + .../Connect/Sdk/V1/Domain/ContactDetails.php | 78 ++ .../Sdk/V1/Domain/ContactDetailsBase.php | 57 ++ .../Domain/ContactDetailsRiskAssessment.php | 46 ++ .../Sdk/V1/Domain/ContactDetailsToken.php | 34 + .../Connect/Sdk/V1/Domain/ConvertAmount.php | 46 ++ .../Sdk/V1/Domain/CreateDisputeRequest.php | 94 +++ .../V1/Domain/CreateHostedCheckoutRequest.php | 200 +++++ .../Domain/CreateHostedCheckoutResponse.php | 101 +++ .../CreateHostedMandateManagementRequest.php | 65 ++ .../CreateHostedMandateManagementResponse.php | 68 ++ .../Sdk/V1/Domain/CreateMandateBase.php | 116 +++ .../Sdk/V1/Domain/CreateMandateRequest.php | 34 + .../Sdk/V1/Domain/CreateMandateResponse.php | 65 ++ .../V1/Domain/CreateMandateWithReturnUrl.php | 45 ++ .../CreatePaymentProductSessionRequest.php | 50 ++ .../CreatePaymentProductSessionResponse.php | 50 ++ .../Sdk/V1/Domain/CreatePaymentRequest.php | 226 ++++++ .../Sdk/V1/Domain/CreatePaymentResponse.php | 34 + .../Sdk/V1/Domain/CreatePaymentResult.php | 80 ++ .../Sdk/V1/Domain/CreatePayoutRequest.php | 211 +++++ .../Sdk/V1/Domain/CreateTokenRequest.php | 117 +++ .../Sdk/V1/Domain/CreateTokenResponse.php | 68 ++ .../Sdk/V1/Domain/CreatedPaymentOutput.php | 125 +++ .../Connect/Sdk/V1/Domain/Creditor.php | 156 ++++ .../Connect/Sdk/V1/Domain/Customer.php | 180 +++++ .../Connect/Sdk/V1/Domain/CustomerAccount.php | 179 +++++ .../Domain/CustomerAccountAuthentication.php | 68 ++ .../Domain/CustomerAccountRiskAssessment.php | 57 ++ .../Sdk/V1/Domain/CustomerApprovePayment.php | 46 ++ .../Connect/Sdk/V1/Domain/CustomerBase.php | 73 ++ .../Connect/Sdk/V1/Domain/CustomerDevice.php | 127 +++ .../Domain/CustomerDeviceRiskAssessment.php | 57 ++ .../Sdk/V1/Domain/CustomerPaymentActivity.php | 68 ++ .../Sdk/V1/Domain/CustomerRiskAssessment.php | 159 ++++ .../Connect/Sdk/V1/Domain/CustomerToken.php | 64 ++ .../CustomerTokenWithContactDetails.php | 49 ++ .../Connect/Sdk/V1/Domain/Debtor.php | 156 ++++ .../Sdk/V1/Domain/DecryptedPaymentData.php | 124 +++ .../V1/Domain/DeviceFingerprintDetails.php | 57 ++ .../V1/Domain/DeviceFingerprintRequest.php | 46 ++ .../V1/Domain/DeviceFingerprintResponse.php | 57 ++ .../Sdk/V1/Domain/DeviceRenderOptions.php | 80 ++ .../Connect/Sdk/V1/Domain/Directory.php | 58 ++ .../Connect/Sdk/V1/Domain/DirectoryEntry.php | 90 +++ .../Connect/Sdk/V1/Domain/DisplayedData.php | 80 ++ .../Connect/Sdk/V1/Domain/Dispute.php | 98 +++ .../Sdk/V1/Domain/DisputeCreationDetail.php | 68 ++ .../Connect/Sdk/V1/Domain/DisputeOutput.php | 158 ++++ .../Sdk/V1/Domain/DisputeReference.php | 90 +++ .../Connect/Sdk/V1/Domain/DisputeResponse.php | 34 + .../Sdk/V1/Domain/DisputeStatusOutput.php | 79 ++ .../Sdk/V1/Domain/DisputesResponse.php | 58 ++ .../EInvoicePaymentMethodSpecificInput.php | 60 ++ ...EInvoicePaymentMethodSpecificInputBase.php | 34 + .../EInvoicePaymentMethodSpecificOutput.php | 64 ++ ...InvoicePaymentProduct9000SpecificInput.php | 61 ++ ...nvoicePaymentProduct9000SpecificOutput.php | 46 ++ .../Connect/Sdk/V1/Domain/EmptyValidator.php | 35 + .../Connect/Sdk/V1/Domain/ErrorResponse.php | 69 ++ .../Connect/Sdk/V1/Domain/ExemptionOutput.php | 68 ++ .../ExternalCardholderAuthenticationData.php | 157 ++++ .../Sdk/V1/Domain/FindPaymentsResponse.php | 91 +++ .../Sdk/V1/Domain/FindPayoutsResponse.php | 91 +++ .../Sdk/V1/Domain/FindRefundsResponse.php | 91 +++ .../Sdk/V1/Domain/FixedListValidator.php | 57 ++ .../Connect/Sdk/V1/Domain/FraudFields.php | 264 +++++++ .../V1/Domain/FraudFieldsShippingDetails.php | 72 ++ .../Connect/Sdk/V1/Domain/FraudResults.php | 76 ++ .../V1/Domain/FraudResultsRetailDecisions.php | 68 ++ .../Sdk/V1/Domain/FraugsterResults.php | 57 ++ .../Connect/Sdk/V1/Domain/Frequency.php | 57 ++ .../Sdk/V1/Domain/GPayThreeDSecure.php | 94 +++ .../V1/Domain/GetCustomerDetailsRequest.php | 69 ++ .../V1/Domain/GetCustomerDetailsResponse.php | 145 ++++ .../V1/Domain/GetHostedCheckoutResponse.php | 61 ++ .../GetHostedMandateManagementResponse.php | 61 ++ .../Sdk/V1/Domain/GetIINDetailsRequest.php | 61 ++ .../Sdk/V1/Domain/GetIINDetailsResponse.php | 91 +++ .../Sdk/V1/Domain/GetInstallmentRequest.php | 83 ++ .../Sdk/V1/Domain/GetMandateResponse.php | 50 ++ .../V1/Domain/GetPrivacyPolicyResponse.php | 46 ++ .../Sdk/V1/Domain/GiftCardPurchase.php | 61 ++ .../V1/Domain/HostedCheckoutSpecificInput.php | 153 ++++ .../Domain/HostedCheckoutSpecificOutput.php | 57 ++ .../Connect/Sdk/V1/Domain/HostedFile.php | 79 ++ .../Sdk/V1/Domain/HostedMandateInfo.php | 105 +++ .../HostedMandateManagementSpecificInput.php | 79 ++ .../Connect/Sdk/V1/Domain/IINDetail.php | 57 ++ .../Connect/Sdk/V1/Domain/InAuth.php | 90 +++ .../Sdk/V1/Domain/InstallmentDisplayHints.php | 68 ++ .../Sdk/V1/Domain/InstallmentOptions.php | 84 ++ .../V1/Domain/InstallmentOptionsResponse.php | 58 ++ .../Connect/Sdk/V1/Domain/Installments.php | 109 +++ .../InvoicePaymentMethodSpecificInput.php | 45 ++ .../InvoicePaymentMethodSpecificOutput.php | 49 ++ .../Connect/Sdk/V1/Domain/KeyValuePair.php | 57 ++ .../Sdk/V1/Domain/LabelTemplateElement.php | 57 ++ .../Connect/Sdk/V1/Domain/LengthValidator.php | 57 ++ .../Sdk/V1/Domain/Level3SummaryData.php | 72 ++ .../Connect/Sdk/V1/Domain/LineItem.php | 96 +++ .../Sdk/V1/Domain/LineItemInvoiceData.php | 90 +++ .../LineItemLevel3InterchangeInformation.php | 123 +++ .../Connect/Sdk/V1/Domain/LoanRecipient.php | 96 +++ .../Connect/Sdk/V1/Domain/LodgingCharge.php | 68 ++ .../Connect/Sdk/V1/Domain/LodgingData.php | 235 ++++++ .../Connect/Sdk/V1/Domain/LodgingRoom.php | 134 ++++ .../Connect/Sdk/V1/Domain/MandateAddress.php | 90 +++ .../Connect/Sdk/V1/Domain/MandateApproval.php | 68 ++ .../Sdk/V1/Domain/MandateContactDetails.php | 46 ++ .../Connect/Sdk/V1/Domain/MandateCustomer.php | 106 +++ .../Sdk/V1/Domain/MandateMerchantAction.php | 61 ++ .../V1/Domain/MandateNonSepaDirectDebit.php | 65 ++ .../V1/Domain/MandatePersonalInformation.php | 61 ++ .../Sdk/V1/Domain/MandatePersonalName.php | 57 ++ .../Sdk/V1/Domain/MandateRedirectData.php | 34 + .../Connect/Sdk/V1/Domain/MandateResponse.php | 105 +++ .../Sdk/V1/Domain/MandateSepaDirectDebit.php | 49 ++ .../MandateSepaDirectDebitWithMandateId.php | 45 ++ .../MandateSepaDirectDebitWithoutCreditor.php | 113 +++ .../Connect/Sdk/V1/Domain/Merchant.php | 83 ++ .../Connect/Sdk/V1/Domain/MerchantAction.php | 148 ++++ .../Sdk/V1/Domain/MerchantRiskAssessment.php | 46 ++ .../Sdk/V1/Domain/MicrosoftFraudResults.php | 112 +++ .../Sdk/V1/Domain/MobilePaymentData.php | 57 ++ .../MobilePaymentMethodSpecificInput.php | 119 +++ ...ymentMethodSpecificInputHostedCheckout.php | 108 +++ .../MobilePaymentMethodSpecificOutput.php | 101 +++ ...tProduct302SpecificInputHostedCheckout.php | 46 ++ .../MobilePaymentProduct320SpecificInput.php | 61 ++ ...tProduct320SpecificInputHostedCheckout.php | 72 ++ ...ePaymentProductSession302SpecificInput.php | 68 ++ ...PaymentProductSession302SpecificOutput.php | 46 ++ .../MobileThreeDSecureChallengeParameters.php | 79 ++ ...aDirectDebitPaymentMethodSpecificInput.php | 141 ++++ ...DirectDebitPaymentMethodSpecificOutput.php | 49 ++ ...ectDebitPaymentProduct705SpecificInput.php | 72 ++ ...ectDebitPaymentProduct730SpecificInput.php | 50 ++ src/Worldline/Connect/Sdk/V1/Domain/Order.php | 165 ++++ .../Sdk/V1/Domain/OrderApprovePayment.php | 80 ++ .../Sdk/V1/Domain/OrderInvoiceData.php | 90 +++ .../Sdk/V1/Domain/OrderLineDetails.php | 167 ++++ .../Connect/Sdk/V1/Domain/OrderOutput.php | 65 ++ .../Connect/Sdk/V1/Domain/OrderReferences.php | 105 +++ .../Domain/OrderReferencesApprovePayment.php | 46 ++ .../Sdk/V1/Domain/OrderRiskAssessment.php | 95 +++ .../Sdk/V1/Domain/OrderStatusOutput.php | 136 ++++ .../Sdk/V1/Domain/OrderTypeInformation.php | 79 ++ .../Connect/Sdk/V1/Domain/Payment.php | 90 +++ .../Sdk/V1/Domain/PaymentAccountOnFile.php | 57 ++ .../Sdk/V1/Domain/PaymentApprovalResponse.php | 96 +++ .../Connect/Sdk/V1/Domain/PaymentContext.php | 83 ++ .../Sdk/V1/Domain/PaymentCreationOutput.php | 78 ++ .../V1/Domain/PaymentCreationReferences.php | 57 ++ .../Sdk/V1/Domain/PaymentErrorResponse.php | 84 ++ .../Connect/Sdk/V1/Domain/PaymentOutput.php | 213 +++++ .../Connect/Sdk/V1/Domain/PaymentProduct.php | 354 +++++++++ .../Domain/PaymentProduct302SpecificData.php | 57 ++ .../PaymentProduct3201SpecificOutput.php | 50 ++ .../Domain/PaymentProduct320SpecificData.php | 68 ++ .../PaymentProduct771SpecificOutput.php | 46 ++ .../PaymentProduct806SpecificOutput.php | 65 ++ .../PaymentProduct836SpecificOutput.php | 46 ++ .../PaymentProduct840CustomerAccount.php | 145 ++++ .../PaymentProduct840SpecificOutput.php | 95 +++ .../Domain/PaymentProduct863SpecificData.php | 57 ++ .../PaymentProduct863ThirdPartyData.php | 112 +++ .../V1/Domain/PaymentProductDisplayHints.php | 68 ++ .../Sdk/V1/Domain/PaymentProductField.php | 98 +++ .../PaymentProductFieldDataRestrictions.php | 61 ++ .../PaymentProductFieldDisplayElement.php | 79 ++ .../PaymentProductFieldDisplayHints.php | 153 ++++ .../Domain/PaymentProductFieldFormElement.php | 69 ++ .../V1/Domain/PaymentProductFieldTooltip.php | 57 ++ .../Domain/PaymentProductFieldValidators.php | 200 +++++ .../Sdk/V1/Domain/PaymentProductFilter.php | 79 ++ .../PaymentProductFiltersClientSession.php | 65 ++ .../PaymentProductFiltersHostedCheckout.php | 76 ++ .../Sdk/V1/Domain/PaymentProductGroup.php | 129 +++ .../V1/Domain/PaymentProductGroupResponse.php | 34 + .../Sdk/V1/Domain/PaymentProductGroups.php | 58 ++ .../Domain/PaymentProductNetworksResponse.php | 57 ++ .../Sdk/V1/Domain/PaymentProductResponse.php | 34 + .../Connect/Sdk/V1/Domain/PaymentProducts.php | 58 ++ .../Sdk/V1/Domain/PaymentReferences.php | 112 +++ .../Connect/Sdk/V1/Domain/PaymentResponse.php | 34 + .../Sdk/V1/Domain/PaymentStatusOutput.php | 67 ++ .../Connect/Sdk/V1/Domain/PayoutCustomer.php | 106 +++ .../Connect/Sdk/V1/Domain/PayoutDetails.php | 80 ++ .../Sdk/V1/Domain/PayoutErrorResponse.php | 84 ++ .../Connect/Sdk/V1/Domain/PayoutMerchant.php | 46 ++ .../Connect/Sdk/V1/Domain/PayoutRecipient.php | 68 ++ .../Sdk/V1/Domain/PayoutReferences.php | 68 ++ .../Connect/Sdk/V1/Domain/PayoutResponse.php | 34 + .../Connect/Sdk/V1/Domain/PayoutResult.php | 75 ++ .../Sdk/V1/Domain/PersonalIdentification.php | 68 ++ .../Sdk/V1/Domain/PersonalInformation.php | 87 ++ .../PersonalInformationRiskAssessment.php | 50 ++ .../V1/Domain/PersonalInformationToken.php | 50 ++ .../Connect/Sdk/V1/Domain/PersonalName.php | 45 ++ .../Sdk/V1/Domain/PersonalNameBase.php | 68 ++ .../V1/Domain/PersonalNameRiskAssessment.php | 34 + .../Sdk/V1/Domain/PersonalNameToken.php | 34 + .../Sdk/V1/Domain/ProtectionEligibility.php | 57 ++ .../Connect/Sdk/V1/Domain/RangeValidator.php | 57 ++ .../Sdk/V1/Domain/RecurringPaymentsData.php | 65 ++ .../Connect/Sdk/V1/Domain/RedirectData.php | 34 + .../Sdk/V1/Domain/RedirectDataBase.php | 57 ++ .../RedirectPaymentMethodSpecificInput.php | 192 +++++ ...RedirectPaymentMethodSpecificInputBase.php | 64 ++ .../RedirectPaymentMethodSpecificOutput.php | 161 ++++ ...edirectPaymentProduct4101SpecificInput.php | 68 ++ ...ectPaymentProduct4101SpecificInputBase.php | 45 ++ ...RedirectPaymentProduct809SpecificInput.php | 58 ++ ...RedirectPaymentProduct816SpecificInput.php | 50 ++ ...RedirectPaymentProduct840SpecificInput.php | 57 ++ ...rectPaymentProduct840SpecificInputBase.php | 34 + ...RedirectPaymentProduct861SpecificInput.php | 46 ++ ...RedirectPaymentProduct863SpecificInput.php | 57 ++ ...RedirectPaymentProduct869SpecificInput.php | 68 ++ ...RedirectPaymentProduct882SpecificInput.php | 46 ++ .../Connect/Sdk/V1/Domain/RedirectionData.php | 57 ++ .../Domain/RefundBankMethodSpecificOutput.php | 34 + .../Domain/RefundCardMethodSpecificOutput.php | 60 ++ .../Domain/RefundCashMethodSpecificOutput.php | 34 + .../Connect/Sdk/V1/Domain/RefundCustomer.php | 91 +++ .../RefundEInvoiceMethodSpecificOutput.php | 34 + .../RefundEWalletMethodSpecificOutput.php | 49 ++ .../Sdk/V1/Domain/RefundErrorResponse.php | 84 ++ .../V1/Domain/RefundMethodSpecificOutput.php | 68 ++ .../RefundMobileMethodSpecificOutput.php | 45 ++ .../Connect/Sdk/V1/Domain/RefundOutput.php | 146 ++++ ...RefundPaymentProduct840CustomerAccount.php | 68 ++ .../RefundPaymentProduct840SpecificOutput.php | 50 ++ .../Sdk/V1/Domain/RefundReferences.php | 46 ++ .../Connect/Sdk/V1/Domain/RefundRequest.php | 106 +++ .../Connect/Sdk/V1/Domain/RefundResponse.php | 34 + .../Connect/Sdk/V1/Domain/RefundResult.php | 75 ++ .../Connect/Sdk/V1/Domain/RefundsResponse.php | 58 ++ .../V1/Domain/RegularExpressionValidator.php | 46 ++ .../Sdk/V1/Domain/ResultDoRiskAssessment.php | 87 ++ .../RetailDecisionsCCFraudCheckOutput.php | 68 ++ .../Connect/Sdk/V1/Domain/RiskAssessment.php | 91 +++ .../V1/Domain/RiskAssessmentBankAccount.php | 64 ++ .../Sdk/V1/Domain/RiskAssessmentCard.php | 49 ++ .../Sdk/V1/Domain/RiskAssessmentResponse.php | 58 ++ .../Connect/Sdk/V1/Domain/SchemeTokenData.php | 90 +++ .../Connect/Sdk/V1/Domain/SdkDataInput.php | 116 +++ .../Connect/Sdk/V1/Domain/SdkDataOutput.php | 46 ++ .../Connect/Sdk/V1/Domain/Seller.php | 171 ++++ ...aDirectDebitPaymentMethodSpecificInput.php | 126 +++ ...ectDebitPaymentMethodSpecificInputBase.php | 49 ++ ...DirectDebitPaymentMethodSpecificOutput.php | 75 ++ ...ectDebitPaymentProduct771SpecificInput.php | 60 ++ ...ebitPaymentProduct771SpecificInputBase.php | 60 ++ .../Connect/Sdk/V1/Domain/SessionRequest.php | 72 ++ .../Connect/Sdk/V1/Domain/SessionResponse.php | 112 +++ .../Connect/Sdk/V1/Domain/Shipping.php | 127 +++ .../Sdk/V1/Domain/ShippingRiskAssessment.php | 72 ++ .../Connect/Sdk/V1/Domain/ShoppingCart.php | 129 +++ src/Worldline/Connect/Sdk/V1/Domain/Swift.php | 145 ++++ .../Connect/Sdk/V1/Domain/TestConnection.php | 46 ++ .../Connect/Sdk/V1/Domain/ThirdPartyData.php | 50 ++ .../V1/Domain/ThirdPartyStatusResponse.php | 46 ++ .../Connect/Sdk/V1/Domain/ThreeDSecure.php | 64 ++ .../Sdk/V1/Domain/ThreeDSecureBase.php | 34 + .../Sdk/V1/Domain/ThreeDSecureData.php | 68 ++ .../Sdk/V1/Domain/ThreeDSecureResults.php | 194 +++++ .../Connect/Sdk/V1/Domain/TokenCard.php | 64 ++ .../Connect/Sdk/V1/Domain/TokenCardData.php | 72 ++ .../Connect/Sdk/V1/Domain/TokenEWallet.php | 64 ++ .../Sdk/V1/Domain/TokenEWalletData.php | 46 ++ .../Sdk/V1/Domain/TokenNonSepaDirectDebit.php | 64 ++ ...rectDebitPaymentProduct705SpecificData.php | 61 ++ ...rectDebitPaymentProduct730SpecificData.php | 50 ++ .../Connect/Sdk/V1/Domain/TokenResponse.php | 128 +++ .../Sdk/V1/Domain/TokenSepaDirectDebit.php | 64 ++ .../TokenSepaDirectDebitWithoutCreditor.php | 64 ++ .../Sdk/V1/Domain/TokenizePaymentRequest.php | 46 ++ .../Sdk/V1/Domain/TrialInformation.php | 102 +++ .../Connect/Sdk/V1/Domain/TrialPeriod.php | 57 ++ .../Sdk/V1/Domain/TrustlyBankAccount.php | 79 ++ .../Sdk/V1/Domain/UpdateTokenRequest.php | 106 +++ .../V1/Domain/UploadDisputeFileResponse.php | 57 ++ .../V1/Domain/ValidationBankAccountCheck.php | 68 ++ .../V1/Domain/ValidationBankAccountOutput.php | 102 +++ .../Sdk/V1/Domain/ValueMappingElement.php | 81 ++ .../Connect/Sdk/V1/Domain/WebhooksEvent.php | 165 ++++ .../Connect/Sdk/V1/ExceptionFactory.php | 100 +++ .../Connect/Sdk/V1/IdempotenceException.php | 57 ++ .../V1/Merchant/Captures/CapturesClient.php | 122 +++ .../V1/Merchant/Disputes/DisputesClient.php | 199 +++++ .../Merchant/Disputes/UploadFileRequest.php | 33 + .../Sdk/V1/Merchant/Files/FilesClient.php | 76 ++ .../Hostedcheckouts/HostedcheckoutsClient.php | 156 ++++ .../HostedmandatemanagementsClient.php | 118 +++ .../Installments/InstallmentsClient.php | 78 ++ .../V1/Merchant/Mandates/MandatesClient.php | 279 +++++++ .../Sdk/V1/Merchant/MerchantClient.php | 187 +++++ .../Merchant/Payments/FindPaymentsParams.php | 42 + .../V1/Merchant/Payments/PaymentsClient.php | 741 ++++++++++++++++++ .../V1/Merchant/Payouts/FindPayoutsParams.php | 37 + .../Sdk/V1/Merchant/Payouts/PayoutsClient.php | 278 +++++++ .../Productgroups/FindProductgroupsParams.php | 52 ++ .../Productgroups/GetProductgroupParams.php | 52 ++ .../Productgroups/ProductgroupsClient.php | 160 ++++ .../V1/Merchant/Products/DirectoryParams.php | 27 + .../Merchant/Products/FindProductsParams.php | 52 ++ .../V1/Merchant/Products/GetProductParams.php | 57 ++ .../V1/Merchant/Products/NetworksParams.php | 37 + .../V1/Merchant/Products/ProductsClient.php | 328 ++++++++ .../V1/Merchant/Refunds/FindRefundsParams.php | 42 + .../Sdk/V1/Merchant/Refunds/RefundsClient.php | 235 ++++++ .../Riskassessments/RiskassessmentsClient.php | 118 +++ .../Merchant/Services/ConvertAmountParams.php | 32 + .../Merchant/Services/PrivacypolicyParams.php | 27 + .../V1/Merchant/Services/ServicesClient.php | 235 ++++++ .../V1/Merchant/Sessions/SessionsClient.php | 78 ++ .../V1/Merchant/Tokens/DeleteTokenParams.php | 22 + .../Sdk/V1/Merchant/Tokens/TokensClient.php | 239 ++++++ .../Connect/Sdk/V1/PlatformException.php | 15 + .../Connect/Sdk/V1/ReferenceException.php | 15 + .../Connect/Sdk/V1/ResponseException.php | 104 +++ src/Worldline/Connect/Sdk/V1/V1Client.php | 28 + .../Connect/Sdk/V1/ValidationException.php | 15 + .../Sdk/V1/Webhooks/V1WebhooksFactory.php | 21 + .../Sdk/V1/Webhooks/WebhooksHelper.php | 75 ++ .../Connect/Sdk/Webhooks/Webhooks.php | 27 + .../V1HMACAuthenticatorTest.php | 51 ++ .../Connect/Sdk/ClientLoggingTest.php | 41 + .../Worldline/Connect/Sdk/ClientTestCase.php | 47 ++ .../CommunicatorLoggerHelperTest.php | 56 ++ ...tionResponseGetDispositionFilenameTest.php | 52 ++ .../DefaultConnectionResponseTest.php | 27 + .../Communication/DefaultConnectionTest.php | 169 ++++ .../Communication/HttpHeaderHelperTest.php | 106 +++ .../Sdk/Communication/HttpObfuscatorTest.php | 132 ++++ .../Sdk/Communication/UuidGeneratorTest.php | 18 + .../Connect/Sdk/CommunicatorLoggingTest.php | 302 +++++++ .../Sdk/CommunicatorRequestHeaderTest.php | 206 +++++ .../Connect/Sdk/CommunicatorTest.php | 145 ++++ .../Connect/Sdk/GeneratedCodeTest.php | 28 + .../Connect/Sdk/It/ConvertAmountTest.php | 34 + .../Connect/Sdk/It/MultipartFormDataTest.php | 251 ++++++ .../Connect/Sdk/It/ProductGroupTest.php | 36 + .../Worldline/Connect/Sdk/It/ProductTest.php | 52 ++ tests/Worldline/Connect/Sdk/It/ProxyTest.php | 34 + .../Connect/Sdk/It/RiskAssessmentTest.php | 56 ++ tests/Worldline/Connect/Sdk/It/TokenTest.php | 56 ++ .../Worldline/Connect/Sdk/JsonValuesStore.php | 73 ++ .../Sdk/Logging/BodyObfuscatorTest.php | 257 ++++++ .../Sdk/Logging/HeaderObfuscatorTest.php | 113 +++ .../Sdk/Logging/ResourceLoggerTest.php | 37 + .../Sdk/Logging/SplFileObjectLoggerTest.php | 44 ++ .../Sdk/Logging/ValueObfuscatorTest.php | 51 ++ tests/Worldline/Connect/Sdk/TestCase.php | 138 ++++ .../Sdk/TestUtil/AppendingBodyHandler.php | 25 + .../Sdk/TestUtil/TestingConnection.php | 39 + .../Connect/Sdk/V1/ExceptionTest.php | 99 +++ .../Connect/Sdk/V1/IdempotenceTest.php | 169 ++++ .../Sdk/V1/Webhooks/WebhooksHelperTest.php | 272 +++++++ tests/bootstrap.php | 3 + tests/config.json.dist | 11 + 508 files changed, 41651 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/workflows/api-docs.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 composer.json create mode 100644 documentation/Migration Guide v6 to v7.md create mode 100644 lib/Worldline/Connect/Sdk/ApiResource.php create mode 100644 lib/Worldline/Connect/Sdk/Authentication/Authenticator.php create mode 100644 lib/Worldline/Connect/Sdk/Authentication/V1HMACAuthenticator.php create mode 100644 lib/Worldline/Connect/Sdk/BodyHandler.php create mode 100644 lib/Worldline/Connect/Sdk/CallContext.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelper.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/Connection.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ConnectionResponse.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/DefaultConnection.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ErrorResponseException.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/HttpHeaderHelper.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/HttpObfuscator.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/InvalidResponseException.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/MetadataProvider.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/MultipartDataObject.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/MultipartFormDataObject.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/RequestObject.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ResponseBuilder.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ResponseClassMap.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ResponseFactory.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/ResponseHeaderBuilder.php create mode 100644 lib/Worldline/Connect/Sdk/Communication/UuidGenerator.php create mode 100644 lib/Worldline/Connect/Sdk/Communicator.php create mode 100644 lib/Worldline/Connect/Sdk/CommunicatorConfiguration.php create mode 100644 lib/Worldline/Connect/Sdk/Domain/DataObject.php create mode 100644 lib/Worldline/Connect/Sdk/Domain/ShoppingCartExtension.php create mode 100644 lib/Worldline/Connect/Sdk/Domain/UploadableFile.php create mode 100644 lib/Worldline/Connect/Sdk/JSON/JSONUtil.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/BodyObfuscator.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/CommunicatorLogger.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/HeaderObfuscator.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/ResourceLogger.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/SplFileObjectLogger.php create mode 100644 lib/Worldline/Connect/Sdk/Logging/ValueObfuscator.php create mode 100644 lib/Worldline/Connect/Sdk/ProxyConfiguration.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/ApiVersionMismatchException.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/InMemorySecretKeyStore.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/SecretKeyNotAvailableException.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/SecretKeyStore.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/SignatureValidationException.php create mode 100644 lib/Worldline/Connect/Sdk/Webhooks/SignatureValidator.php create mode 100644 phpunit.xml.dist create mode 100644 src/Worldline/Connect/Sdk/Client.php create mode 100644 src/Worldline/Connect/Sdk/V1/ApiException.php create mode 100644 src/Worldline/Connect/Sdk/V1/AuthorizationException.php create mode 100644 src/Worldline/Connect/Sdk/V1/DeclinedPaymentException.php create mode 100644 src/Worldline/Connect/Sdk/V1/DeclinedPayoutException.php create mode 100644 src/Worldline/Connect/Sdk/V1/DeclinedRefundException.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/APIError.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractBankTransferPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractCardPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractCashPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractEInvoicePaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractIndicator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractOrderStatus.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractPayoutMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentProduct4101SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentProduct840SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractSepaDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractSepaDirectDebitPaymentProduct771SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractThreeDSecure.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AbstractToken.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AccountFundingRecipient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AccountOnFile.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileAttribute.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileDisplayHints.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInputAirlineData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Address.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AddressPersonal.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AfrName.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AirlineData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AirlineFlightLeg.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AirlinePassenger.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AmountBreakdown.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AmountOfMoney.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentCardPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentMobilePaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApprovePayoutRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApproveRefundRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ApproveTokenRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/AuthenticationIndicator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankAccountBban.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankAccountBbanRefund.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankAccountIban.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankDetailsRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankDetailsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankRefundMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BankTransferPayoutMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BoletoBancarioRequirednessValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/BrowserData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CancelApprovalPaymentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentCardPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentMobilePaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Capture.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CaptureOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CapturePaymentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CaptureResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CaptureStatusOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CapturesResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Card.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardEssentials.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardFraudResults.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardPayoutMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardRecurrenceDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CardWithoutCvv.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1503SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1504SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1521SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1522SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1523SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1524SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1526SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProductWithRedirectSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CompanyInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentCardPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ContactDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsToken.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ConvertAmount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateDisputeRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateMandateBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateMandateRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateMandateResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateMandateWithReturnUrl.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentResult.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatePayoutRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateTokenRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreateTokenResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CreatedPaymentOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Creditor.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Customer.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountAuthentication.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerApprovePayment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerDevice.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerDeviceRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerPaymentActivity.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerToken.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/CustomerTokenWithContactDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Debtor.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DecryptedPaymentData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DeviceRenderOptions.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Directory.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DirectoryEntry.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisplayedData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Dispute.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputeCreationDetail.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputeOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputeReference.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputeResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputeStatusOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/DisputesResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/EmptyValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ErrorResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ExemptionOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ExternalCardholderAuthenticationData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FindPaymentsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FindPayoutsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FindRefundsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FixedListValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FraudFields.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FraudFieldsShippingDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FraudResults.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FraudResultsRetailDecisions.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/FraugsterResults.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Frequency.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GPayThreeDSecure.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetHostedCheckoutResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetHostedMandateManagementResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetInstallmentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetMandateResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GetPrivacyPolicyResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/GiftCardPurchase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/HostedFile.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/HostedMandateInfo.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/HostedMandateManagementSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/IINDetail.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InAuth.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InstallmentDisplayHints.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptions.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptionsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Installments.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/KeyValuePair.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LabelTemplateElement.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LengthValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Level3SummaryData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LineItem.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LineItemInvoiceData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LineItemLevel3InterchangeInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LoanRecipient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LodgingCharge.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LodgingData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/LodgingRoom.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateAddress.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateApproval.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateContactDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateCustomer.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateMerchantAction.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateNonSepaDirectDebit.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalName.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateRedirectData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebit.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithMandateId.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithoutCreditor.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Merchant.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MerchantAction.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MerchantRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MicrosoftFraudResults.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInputHostedCheckout.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct302SpecificInputHostedCheckout.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInputHostedCheckout.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/MobileThreeDSecureChallengeParameters.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct705SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct730SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Order.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderApprovePayment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderInvoiceData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderLineDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderReferences.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderReferencesApprovePayment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderStatusOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/OrderTypeInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Payment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentAccountOnFile.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentApprovalResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentContext.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationReferences.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentErrorResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct302SpecificData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct3201SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct320SpecificData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct771SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct806SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct836SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840CustomerAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863SpecificData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863ThirdPartyData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductDisplayHints.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductField.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDataRestrictions.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayElement.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayHints.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldFormElement.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldTooltip.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldValidators.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFilter.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersClientSession.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersHostedCheckout.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroup.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroupResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroups.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductNetworksResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProductResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentProducts.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentReferences.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PaymentStatusOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutCustomer.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutDetails.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutErrorResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutMerchant.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutRecipient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutReferences.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PayoutResult.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalIdentification.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationToken.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalName.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalNameBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalNameRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/PersonalNameToken.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ProtectionEligibility.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RangeValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RecurringPaymentsData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectDataBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct809SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct816SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct861SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct863SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct869SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct882SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RedirectionData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundBankMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundCardMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundCashMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundCustomer.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundEInvoiceMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundEWalletMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundErrorResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundMobileMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840CustomerAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840SpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundReferences.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundResult.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RefundsResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RegularExpressionValidator.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ResultDoRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RetailDecisionsCCFraudCheckOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentBankAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentCard.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SchemeTokenData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SdkDataInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SdkDataOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Seller.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInputBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SessionRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/SessionResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Shipping.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ShippingRiskAssessment.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ShoppingCart.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/Swift.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TestConnection.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyStatusResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecure.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureBase.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureResults.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenCard.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenCardData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenEWallet.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenEWalletData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebit.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct705SpecificData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct730SpecificData.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebit.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebitWithoutCreditor.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TokenizePaymentRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TrialInformation.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TrialPeriod.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/TrustlyBankAccount.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/UpdateTokenRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/UploadDisputeFileResponse.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountCheck.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountOutput.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/ValueMappingElement.php create mode 100644 src/Worldline/Connect/Sdk/V1/Domain/WebhooksEvent.php create mode 100644 src/Worldline/Connect/Sdk/V1/ExceptionFactory.php create mode 100644 src/Worldline/Connect/Sdk/V1/IdempotenceException.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Captures/CapturesClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Disputes/DisputesClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Disputes/UploadFileRequest.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Files/FilesClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Hostedcheckouts/HostedcheckoutsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Hostedmandatemanagements/HostedmandatemanagementsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Installments/InstallmentsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Mandates/MandatesClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/MerchantClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Payments/FindPaymentsParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Payments/PaymentsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Payouts/FindPayoutsParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Payouts/PayoutsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/FindProductgroupsParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/GetProductgroupParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/ProductgroupsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Products/DirectoryParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Products/FindProductsParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Products/GetProductParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Products/NetworksParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Products/ProductsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Refunds/FindRefundsParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Refunds/RefundsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Riskassessments/RiskassessmentsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Services/ConvertAmountParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Services/PrivacypolicyParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Services/ServicesClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Sessions/SessionsClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Tokens/DeleteTokenParams.php create mode 100644 src/Worldline/Connect/Sdk/V1/Merchant/Tokens/TokensClient.php create mode 100644 src/Worldline/Connect/Sdk/V1/PlatformException.php create mode 100644 src/Worldline/Connect/Sdk/V1/ReferenceException.php create mode 100644 src/Worldline/Connect/Sdk/V1/ResponseException.php create mode 100644 src/Worldline/Connect/Sdk/V1/V1Client.php create mode 100644 src/Worldline/Connect/Sdk/V1/ValidationException.php create mode 100644 src/Worldline/Connect/Sdk/V1/Webhooks/V1WebhooksFactory.php create mode 100644 src/Worldline/Connect/Sdk/V1/Webhooks/WebhooksHelper.php create mode 100644 src/Worldline/Connect/Sdk/Webhooks/Webhooks.php create mode 100644 tests/Worldline/Connect/Sdk/Authentication/V1HMACAuthenticatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/ClientLoggingTest.php create mode 100644 tests/Worldline/Connect/Sdk/ClientTestCase.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelperTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/ConnectionResponseGetDispositionFilenameTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/DefaultConnectionResponseTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/DefaultConnectionTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/HttpHeaderHelperTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/HttpObfuscatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/Communication/UuidGeneratorTest.php create mode 100644 tests/Worldline/Connect/Sdk/CommunicatorLoggingTest.php create mode 100644 tests/Worldline/Connect/Sdk/CommunicatorRequestHeaderTest.php create mode 100644 tests/Worldline/Connect/Sdk/CommunicatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/GeneratedCodeTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/ConvertAmountTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/MultipartFormDataTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/ProductGroupTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/ProductTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/ProxyTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/RiskAssessmentTest.php create mode 100644 tests/Worldline/Connect/Sdk/It/TokenTest.php create mode 100644 tests/Worldline/Connect/Sdk/JsonValuesStore.php create mode 100644 tests/Worldline/Connect/Sdk/Logging/BodyObfuscatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/Logging/HeaderObfuscatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/Logging/ResourceLoggerTest.php create mode 100644 tests/Worldline/Connect/Sdk/Logging/SplFileObjectLoggerTest.php create mode 100644 tests/Worldline/Connect/Sdk/Logging/ValueObfuscatorTest.php create mode 100644 tests/Worldline/Connect/Sdk/TestCase.php create mode 100644 tests/Worldline/Connect/Sdk/TestUtil/AppendingBodyHandler.php create mode 100644 tests/Worldline/Connect/Sdk/TestUtil/TestingConnection.php create mode 100644 tests/Worldline/Connect/Sdk/V1/ExceptionTest.php create mode 100644 tests/Worldline/Connect/Sdk/V1/IdempotenceTest.php create mode 100644 tests/Worldline/Connect/Sdk/V1/Webhooks/WebhooksHelperTest.php create mode 100644 tests/bootstrap.php create mode 100644 tests/config.json.dist diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..779f99a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..59e5462 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +.gitattributes export-ignore +.gitignore export-ignore + +* text eol=lf diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml new file mode 100644 index 0000000..0410c08 --- /dev/null +++ b/.github/workflows/api-docs.yml @@ -0,0 +1,56 @@ +name: API docs + +on: + push: + tags: ['[0-9]+.[0-9]+*'] + +permissions: + contents: write + +jobs: + api-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + path: code + persist-credentials: false + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '5.6' + - name: Install apigen + run: composer global require apigen/apigen + - name: Build API docs + run: apigen generate -s lib,src -d docs --deprecated --no-source-code --title 'Worldline Connect PHP SDK' + working-directory: code + - name: Checkout pages + uses: actions/checkout@v3 + with: + ref: gh-pages + path: pages + - name: Deploy pages + run: | + SDK_VERSION_FOLDER=`echo "$SDK_VERSION" | awk --field-separator '.' '{print $1".x";}'` + + # Create .nojekyll if it doesn't exist yet + touch .nojekyll + + mkdir -p "apidoc/$SDK_VERSION_FOLDER" + rsync --quiet --archive --checksum --delete --exclude .git ../code/docs/ "apidoc/$SDK_VERSION_FOLDER/" + if [ -e apidoc/latest ]; then rm -r apidoc/latest; fi + pushd apidoc && ln -s "$SDK_VERSION_FOLDER" latest && popd + + git config user.email "$USER_EMAIL" + git config user.name "$USER_NAME" + git add --all . + # Only commit when there are changes + git diff --quiet && git diff --staged --quiet || git commit --message "Generated API docs for version ${SDK_VERSION}" + git push + shell: bash + working-directory: pages + env: + SDK_VERSION: ${{ github.ref_name }} + USER_EMAIL: ${{ github.event.pusher.email }} + USER_NAME: ${{ github.event.pusher.name }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4cf2663 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.idea +.buildpath +.project +.settings +*.pyc +doc +/composer.lock +/phpunit.xml +/tests/config.json +/vendor/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..238426d --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Worldline Connect PHP SDK + +## Introduction + +The Worldline Connect PHP SDK helps you to communicate with the [Worldline Connect](https://docs.connect.worldline-solutions.com/) Server API. Its primary features are: + +* convenient PHP wrapper around the API calls and responses: + * marshalls PHP request objects to HTTP requests + * unmarshalls HTTP responses to PHP response objects or PHP exceptions +* handling of all the details concerning authentication +* handling of required metadata + +Its use is demonstrated by an example for most calls. The examples execute a call using the provided API keys. + +See the [Worldline Connect Developer Hub](https://docs.connect.worldline-solutions.com/documentation/sdk/server/php/) for more information on how to use the SDK. + +## Structure of this repository + +This repository consists out of the following components: + +1. The source code of the SDK itself: `/src` and `/lib` +2. The source code of the unit and integration tests (including the examples): `/tests` + +## Requirements + +PHP 5.4 or above is required. In addition, to support streaming uploads, package [robtimus/multipart](https://packagist.org/packages/robtimus/multipart) is required. + +## Installation via Composer + +1. Initialize [Composer](https://getcomposer.org/download/) in your project, if this is not already done, by executing the following command: + + ``` + composer init + ``` + +2. Add a requirement to the SDK to your `composer.json` file by executing the following command: + + ``` + composer require worldline-global-collect/connect-sdk-php + ``` +3. Add `vendor/autoload.php` to your project, if this is not already done, by adding the following line of code: + + ``` + require __DIR__ . '/vendor/autoload.php'; + ``` + +## Manual installation + +1. Download the latest version of the PHP SDK from GitHub. Choose the `connect-sdk-php-x.y.z.tar.gz` file from the [releases](https://github.com/Worldline-Global-Collect/connect-sdk-php/releases) page, where `x.y.z` is the version number. +2. Add the contents of the `tar.gz` file to your project. The content of the `/src` and `/lib` folders may be combined, if this is required by the project. +3. Add all classes from the `/src` and `/lib` folders to your autoloader; all classes inside these folders are compliant with [PSR-4](http://www.php-fig.org/psr/psr-4/). + +## Development and testing + +1. Install [Composer](https://getcomposer.org/download/) +2. From the root of the sdk-php project, run `composer install` +3. Copy `tests/config.json.dist` to `tests/config.json` and replace the template values by actual values +4. From the root of the sdk-php project, `vendor/phpunit/phpunit/phpunit` (or just `phpunit` when it is already installed on your local machine) diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..52000ff --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "worldline-global-collect/connect-sdk-php", + "type": "library", + "description": "PHP SDK to communicate with the Worldline Global Collect platform server-to-server API", + "homepage": "https://worldline.com/", + "keywords": ["SDK"], + "license": "MIT", + "authors": [ + { + "name": "Worldline Global Collect", + "homepage": "https://worldline.com/" + } + ], + "require": { + "php": ">=5.4", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "robtimus/multipart": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4" + }, + "autoload": { + "psr-4": { + "Worldline\\Connect\\Sdk\\": ["src/Worldline/Connect/Sdk", "lib/Worldline/Connect/Sdk"] + } + }, + "autoload-dev": { + "psr-4": { + "Worldline\\Connect\\Sdk\\": ["tests/Worldline/Connect/Sdk"] + } + } +} diff --git a/documentation/Migration Guide v6 to v7.md b/documentation/Migration Guide v6 to v7.md new file mode 100644 index 0000000..fab8322 --- /dev/null +++ b/documentation/Migration Guide v6 to v7.md @@ -0,0 +1,197 @@ +# Migrating from version 6.x.x to 7.0.0 + +## Dependency + +The Composer project name has changed to `worldline-global-collect/connect-sdk-php`. You need to update the dependencies in your `composer.json` file: + +```json + "require": { + "worldline-global-collect/connect-sdk-php": "~7.0.0" + } +``` + +## Use statements + +All namespaces have been renamed, and some classes and interfaces have moved to different namespaces. Each API version now has its own namespace structure that contains all classes specific for that version, including classes like `APIError`, exceptions and webhooks classes. + +You need to change your use statements as follows: + +| Previous namespace | Class / interface | New namespace | Notes | +|--------------------------------------|------------------------------|--------------------------------------|-------| +| Ingenico\Connect\Sdk | ApiException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | AuthorizationException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | BodyObfuscator | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | CommunicatorLogger | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | CommunicatorLoggerHelper | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | Connection | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ConnectionResponse | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | DataObject | Worldline\Connect\Sdk\Domain | +| Ingenico\Connect\Sdk | DeclinedPaymentException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | DeclinedPayoutException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | DeclinedRefundException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | DefaultConnection | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | GlobalCollectException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | HeaderObfuscator | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | HttpHeaderHelper | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | HttpObfuscator | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | IdempotenceException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | InvalidResponseException | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | MultipartDataObject | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | MultipartFormDataObject | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ReferenceException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | RequestObject | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ResourceLogger | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | ResponseBuilder | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ResponseClassMap | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ResponseException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | ResponseExceptionFactory | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | ResponseFactory | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ResponseHeaderBuilder | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | SplFileObjectLogger | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | UploadableFile | Worldline\Connect\Sdk\Domain | +| Ingenico\Connect\Sdk | UuidGenerator | Worldline\Connect\Sdk\Communication | +| Ingenico\Connect\Sdk | ValidationException | Worldline\Connect\Sdk\V1 | +| Ingenico\Connect\Sdk | ValueObfuscator | Worldline\Connect\Sdk\Logging | +| Ingenico\Connect\Sdk | All other classes | Worldline\Connect\Sdk | +| Ingenico\Connect\Sdk\Domain\MetaData | ShoppingCartExtension | Worldline\Connect\Sdk\Domain | +| Ingenico\Connect\Sdk\Domain\* | All other domain classes | Worldline\Connect\Sdk\V1\Domain | All domain classes for version 1 of the API are now in the same namespace | +| Ingenico\Connect\Sdk\Merchant\* | All classes | Worldline\Connect\Sdk\V1\Merchant\* | The same namespace structure is used | +| Ingenico\Connect\Sdk\Webhooks | WebhooksHelper | Worldline\Connect\Sdk\V1\Webhooks | +| Ingenico\Connect\Sdk\Webhooks | All other classes | Worldline\Connect\Sdk\Webhooks | + +## API calls + +Method `merchant` of class `Client` has moved to new class `V1Client`. Instances of this class are available through method `v1` of class `Client`. You need to replace all occurrences of `->merchant` with `->v1()->merchant` in your code. For instance: + +```php +$response = $client->v1()->merchant($merchantId)->services()->testconnection(); +``` + +## API version + +Constant `API_VERSION` of class `Client` has been removed. You need to replace all occurrences in your code with string literal `'v1'`. + +## Communicator + +The constructor of class `Communicator` now takes a required `CommunicatorConfiguration` and an optional `Authenticator` and `Connection`. If the `Authenticator` or `Connection` is not provided a new instance will be created using the given `CommunicatorConfiguration`. That means you only need to provide an `Authenticator` or `Connection` if the defaults aren't sufficient. You need to change all calls to the constructor in your code with one of the following: + +* To use a `DefaultConnection` instance, provide only the `CommunicatorConfiguration`: + ```php + $communicator = new Communicator($communicatorConfiguration); + ``` + +* To use a custom `Connection` implementation, provide the `CommunicatorConfiguration`, `null` for the `Authenticator`, and the `Connection`: + ```php + $communicator = new Communicator($connection, null, $communicatorConfiguration); + ``` + +### Accessing fields + +The `getConnection`, `setConnection`, `getCommunicatorConfiguration` and `setCommunicatorConfiguration` methods have been removed. You need to capture the constructor arguments in your code instead of calling the `getConnection` and `getCommunicatorConfiguration` methods, and you need to create a new `Communicator` instance in your code instead of calling the `setConnection` and `setCommunicatorConfiguration` methods. + +### HTTP methods + +The HTTP methods of class `Communicator` no longer use a `ResponseExceptionFactory` but instead throw instances of new class `ErrorResponseException`. Mapping these to other exceptions is now the response of the calling class. The SDK's own client classes will take care of this for you, but if you use these methods directly you need to change all occurrences in your code. For instance: + +```php +try { + return $communicator->get($responseClassMap, $uri, $clientMetaInfo, null, $callContext); +} catch (ErrorResponseException $e) { + throw $responseExceptionFactory->createException($e->getHttpStatusCode(), $e->getErrorResponse(), $callContext); +} +``` + +The `getResponseExceptionFactory` method has been removed, as it is no longer necessary. + +### HTTP methods with binary responses + +The `BodyHandler` parameter of methods `getWithBinaryResponse`, `deleteWithBinaryResponse`, `postWithBinaryResponse` and `putWithBinaryResponse` is required and is therefore now the first parameter. You need to move the argument from the end to the start of the argument list in all occurrences in your code. + +## CommunicatorConfiguration + +The integrator is now required. You need to make sure a non-empty integrator is set on any `CommunicatorConfiguration` instance you create. + +## DeclinedPaymentException + +Method `getPaymentResult` of class `DeclinedPaymentException` has been renamed to `getCreatePaymentResult` to match the return type. You need to change all occurrences in your code with the new name. + +## GlobalCollectException + +Class `GlobalCollectException` has been renamed to `PlatformException`. You need to replace all occurrences in your code with the new name. + +## Resource + +Class `Resource` has been renamed to `ApiResource`, to avoid IDEs confusing it with the built-in `resource` type. You need to replace all occurrences in your code with the new name. + +## Client classes + +All client classes have been renamed to end with `Client`. For instance, class `Merchant` is renamed to `MerchantClient`, and class `Payments` is renamed to `PaymentsClient`. You need to replace all occurrences in your code with the new names. + +## Communication + +### Connection + +The `ProxyConfiguration` parameter has been removed from methods of interface `Connection`. This should instead be provided when creating instances of implementing classes. You need to change all custom implementations to remove the parameter from the implemented methods and store an optional `ProxyConfiguration` in a field instead. + +### ConnectionResponse and DefaultConnectionResponse + +Interface `ConnectionResponse` and class `DefaultConnectionResponse` have been combined into class `ConnectionResponse`. You need to replace all occurrences of class `DefaultConnectionResponse` in your code with `ConnectionResponse`. You need also need to change all custom implementations of interface `ConnectionResponse` to extend the combined class instead of implement it. + +### DefaultConnection + +The constructor of class `DefaultConnection` now takes an optional `CommunicatorConfiguration` instead of optional connect and read timeouts. You need to replace all occurrences in your code that set a connect or read timeout to use the `CommunicatorConfiguration` instead. For instance: + +```php +$communicatorConfiguration->setConnectTimeout($connectTimeout); +$communicatorConfiguration->setReadTimeout($readTimeout); +$connection = new DefaultConnection($communicatorConfiguration); +``` + +Alternatively, you can omit the `DefaultConnection` and let the `Communicator` create it: + +```php +$communicatorConfiguration->setConnectTimeout($connectTimeout); +$communicatorConfiguration->setReadTimeout($readTimeout); +$communicator = new Communicator($communicatorConfiguration); +``` + +### HttpHeaderHelper + +Class `HttpHeaderHelper` has been turned into a utility class. Its methods are now static and it can no longer be instantiated. You need to replace all occurrences in your code with static method calls, and remove any instance. + +### InvalidResponseException + +Field `response` of class `InvalidResponseException` has been made private. You need to replace all occurrences in your code with calls to the `getResponse` method. + +### RequestHeaderGenerator + +Class `RequestHeaderGenerator` has been replaced with new interface `Authenticator`, new classes `V1HMACAuthenticator` and `MetadataProvider`, and new methods in class `Communicator`. + +* To get values for the `X-GCS-ServerMetaInfo` header you need to change your code to use instances of class `MetaDataProvider` and its `getServerMetaInfoValue` method. +* To get values for the `X-GCS-Idempotence-Key` header you need to change your code to use the result of calling `getIdempotenceKey` on the `CallContext` instance. +* To get values for the `Authorization` header you need to change your code to use instances of class `V1HMACAuthenticator` and its `getAuthorization` method. +* To get values for the `Date` header you need to change your code to use `gmdate('D, d M Y H:i:s T')`. + +### ResponseClassMap + +Field `responseClassNamesByHttpStatusCode` of class `ResponseClassMap` has been made private. You need to replace all occurrences in your code with the `addResponseClassName` and `getResponseClassName` methods. + +### ResponseExceptionFactory + +Class `ResponseExceptionFactory` has been renamed to `ExceptionFactory`. You need to replace all occurrences in your code with the new name. + +### ResponseFactory + +Since class `ErrorResponse` is specific for version 1 of the API, class `ResponseFactory` no longer defaults to it. The `ResponseClassMap` argument must have a value for its `defaultErrorResponseClassName` field instead. + +## JSON marshalling + +### DataObject + +Method `getLastJsonDecodeErrorString` of class `DataObject` has moved to new class `JSONUtil`. You need to change all occurrences in custom `DataObject` sub classes to call the method on `JSONUtil` instead. + +## Webhooks + +### WebhooksHelper + +Method `validate` of class `WebhooksHelper` has been removed. You need to replace all occurrences in your code with a `SignatureValidator`. diff --git a/lib/Worldline/Connect/Sdk/ApiResource.php b/lib/Worldline/Connect/Sdk/ApiResource.php new file mode 100644 index 0000000..6f04999 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/ApiResource.php @@ -0,0 +1,70 @@ +parent = $parent; + $this->context = $context; + } + + /** + * Returns the connection associated with this resource. + * + * @return Communicator + */ + protected function getCommunicator() + { + return $this->parent->getCommunicator(); + } + + /** + * Returns the client headers with this resource. + * + * @return string + */ + protected function getClientMetaInfo() + { + return $this->parent->getClientMetaInfo(); + } + + /** + * Converts a URI template to a fully qualified URI by replacing + * URI parameters ('{...}') by their corresponding value in + * $this->context. + * + * @param string $template The URL template to instantiate. + * @return string The URL in which the URI parameters have been replaced. + */ + protected function instantiateUri($template) + { + // We assume that API URLs follow the recommendations in + // RFC 1738, and therefore do not use unencoded { and }. + foreach ($this->context as $name => $value) { + $template = str_replace('{' . $name . '}', $value, $template); + } + return $template; + } +} diff --git a/lib/Worldline/Connect/Sdk/Authentication/Authenticator.php b/lib/Worldline/Connect/Sdk/Authentication/Authenticator.php new file mode 100644 index 0000000..7eb70dd --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Authentication/Authenticator.php @@ -0,0 +1,18 @@ +apiKeyId = $communicatorConfiguration->getApiKeyId(); + $this->apiSecret = $communicatorConfiguration->getApiSecret(); + } + + /** + * @param string $httpMethod + * @param string $uriPath + * @param string[] $requestHeaders + * @return string + */ + public function getAuthorization($httpMethod, $uriPath, $requestHeaders) + { + $signature = base64_encode( + hash_hmac( + 'sha256', + $this->getSignData($httpMethod, $uriPath, $requestHeaders), + $this->apiSecret, + true + ) + ); + return sprintf('GCS v1HMAC:%s:%s', $this->apiKeyId, $signature); + } + + /** + * @param string[] $requestHeaders + * @return string + */ + private function getSignData($httpMethod, $uriPath, $requestHeaders) + { + $signData = $httpMethod . "\n"; + if (isset($requestHeaders['Content-Type'])) { + $signData .= $requestHeaders['Content-Type'] . "\n"; + } else { + $signData .= "\n"; + } + if (isset($requestHeaders['Date'])) { + $signData .= $requestHeaders['Date'] . "\n"; + } else { + $signData .= "\n"; + } + $gcsHeaders = array(); + foreach ($requestHeaders as $headerKey => $headerValue) { + if (preg_match('/X-GCS/i', $headerKey)) { + $gcsHeaders[$headerKey] = $headerValue; + } + } + ksort($gcsHeaders); + foreach ($gcsHeaders as $gcsHeaderKey => $gcsHeaderValue) { + $gcsEncodedHeaderValue = trim(preg_replace('/\r?\n[\h]*/', ' ', $gcsHeaderValue)); + + $signData .= strtolower($gcsHeaderKey) . ':' . $gcsEncodedHeaderValue . "\n"; + } + $signData .= $uriPath . "\n"; + return $signData; + } +} diff --git a/lib/Worldline/Connect/Sdk/BodyHandler.php b/lib/Worldline/Connect/Sdk/BodyHandler.php new file mode 100644 index 0000000..1ace8b4 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/BodyHandler.php @@ -0,0 +1,65 @@ +initialized) { + $this->initialize($headers); + $this->initialized = true; + } + $this->doHandleBodyPart($bodyPart); + } + + /** + * Calls doCleanup, then marks this body handler as not initialized. + * Afterwards this instance can be reused again. + */ + public final function close() + { + $this->doCleanup(); + $this->initialized = false; + } + + /** + * Can be used to initialize this body handler based on the given headers. + * The default implementation does nothing. + * @param array $headers + */ + protected function initialize($headers) + { + } + + /** + * Can be used to handle a single body part. + * The default implementation does nothing. + * @param string $bodyPart + */ + protected function doHandleBodyPart($bodyPart) + { + } + + /** + * Can be used to do cleanup resources allocated by this body handler. + * The default implementation does nothing. + */ + protected function doCleanup() + { + } +} diff --git a/lib/Worldline/Connect/Sdk/CallContext.php b/lib/Worldline/Connect/Sdk/CallContext.php new file mode 100644 index 0000000..d202091 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/CallContext.php @@ -0,0 +1,48 @@ +idempotenceKey; + } + + /** + * @param string $idempotenceKey + */ + public function setIdempotenceKey($idempotenceKey) + { + $this->idempotenceKey = $idempotenceKey; + } + + /** + * @return string + */ + public function getIdempotenceRequestTimestamp() + { + return $this->idempotenceRequestTimestamp; + } + + /** + * @param string $idempotenceRequestTimestamp + */ + public function setIdempotenceRequestTimestamp($idempotenceRequestTimestamp) + { + $this->idempotenceRequestTimestamp = $idempotenceRequestTimestamp; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelper.php b/lib/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelper.php new file mode 100644 index 0000000..ebb6017 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelper.php @@ -0,0 +1,137 @@ +log(sprintf( + "Outgoing request to %s (requestId='%s')\n%s", + $this->getEndpoint($requestUri), + $requestId, + $this->getHttpObfuscator()->getRawObfuscatedRequest( + $requestMethod, + $this->getRelativeUriPathWithRequestParameters($requestUri), + $requestHeaders, + $requestBody + ) + )); + } + + /** + * @param CommunicatorLogger $communicatorLogger + * @param string $requestId + * @param string $requestUri + * @param ConnectionResponse $response + */ + public function logResponse(CommunicatorLogger $communicatorLogger, $requestId, $requestUri, ConnectionResponse $response) + { + $communicatorLogger->log(sprintf( + "Incoming response from %s (requestId='%s')\n%s", + $this->getEndpoint($requestUri), + $requestId, + $this->getHttpObfuscator()->getRawObfuscatedResponse($response) + )); + } + + /** + * @param CommunicatorLogger $communicatorLogger + * @param string $requestId + * @param string $requestUri + * @param Exception $exception + */ + public function logException(CommunicatorLogger $communicatorLogger, $requestId, $requestUri, Exception $exception) + { + $communicatorLogger->logException(sprintf( + "Error occurred while executing request to %s (requestId='%s')", + $this->getEndpoint($requestUri), + $requestId + ), $exception); + } + + /** @return HttpObfuscator */ + protected function getHttpObfuscator() + { + if (is_null($this->httpObfuscator)) { + $this->httpObfuscator = new HttpObfuscator(); + } + return $this->httpObfuscator; + } + + /** + * @param BodyObfuscator $bodyObfuscator + */ + public function setBodyObfuscator(BodyObfuscator $bodyObfuscator) + { + $this->getHttpObfuscator()->setBodyObfuscator($bodyObfuscator); + } + + /** + * @param HeaderObfuscator $headerObfuscator + */ + public function setHeaderObfuscator(HeaderObfuscator $headerObfuscator) + { + $this->getHttpObfuscator()->setHeaderObfuscator($headerObfuscator); + } + + /** + * @param string $requestUri + * @return string + */ + public function getEndpoint($requestUri) + { + $index = strpos($requestUri, '://'); + if ($index !== FALSE) { + $index = strpos($requestUri, '/', $index + 3); + // $index === FALSE means there's no / after the host; there is no relative URI + return $index !== FALSE ? substr($requestUri, 0, $index) : $requestUri; + } else { + // not an absolute URI + return ''; + } + } + + /** + * @param string $requestUri + * @return string + */ + public function getRelativeUriPathWithRequestParameters($requestUri) + { + $index = strpos($requestUri, '://'); + if ($index !== FALSE) { + $index = strpos($requestUri, '/', $index + 3); + // $index === FALSE means there's no / after the host; there is no relative URI + return $index !== FALSE ? substr($requestUri, $index) : ''; + } else { + // not an absolute URI + return $requestUri; + } + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/Connection.php b/lib/Worldline/Connect/Sdk/Communication/Connection.php new file mode 100644 index 0000000..aa538f0 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/Connection.php @@ -0,0 +1,52 @@ +httpStatusCode = $httpStatusCode; + $this->headers = $headers; + $this->lowerCasedHeaderKeyMap = array(); + foreach (array_keys($headers) as $headerKey) { + $this->lowerCasedHeaderKeyMap[strtolower($headerKey)] = $headerKey; + } + $this->body = $body; + } + + /** + * @return int + */ + public function getHttpStatusCode() + { + return $this->httpStatusCode; + } + + /** + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * @param string $name + * @return string|array + */ + public function getHeaderValue($name) + { + $lowerCasedName = strtolower($name); + if (array_key_exists($lowerCasedName, $this->lowerCasedHeaderKeyMap)) { + return $this->headers[$this->lowerCasedHeaderKeyMap[$lowerCasedName]]; + } + return ''; + } + + /** + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * @param array $headers + * @return string|null The value of the filename parameter of the Content-Disposition header from the given headers, + * or null if there was no such header or parameter. + */ + public static function getDispositionFilename($headers) + { + $headerValue = null; + foreach ($headers as $key => $value) + { + if (strtolower($key) === 'content-disposition') { + $headerValue = $value; + break; + } + } + if (!$headerValue) { + return null; + } + if (preg_match('/(?i)(?:^|;)\s*fileName\s*=\s*(.*?)\s*(?:;|$)/', $headerValue, $matches)) { + $filename = $matches[1]; + return self::trimQuotes($filename); + } + return null; + } + + private static function trimQuotes($filename) { + $len = strlen($filename); + if ($len < 2) { + return $filename; + } + if ((strrpos($filename, '"', -$len) === 0 && strpos($filename, '"', $len - 1) === $len - 1) + || (strrpos($filename, "'", -$len) === 0 && strpos($filename, "'", $len - 1) === $len - 1)) { + return substr($filename, 1, $len - 2); + } + return $filename; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/DefaultConnection.php b/lib/Worldline/Connect/Sdk/Communication/DefaultConnection.php new file mode 100644 index 0000000..47ce559 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/DefaultConnection.php @@ -0,0 +1,462 @@ +connectTimeout = $communicatorConfiguration->getConnectTimeout(); + $this->readTimeout = $communicatorConfiguration->getReadTimeout(); + $this->proxyConfiguration = $communicatorConfiguration->getProxyConfiguration(); + } + } + + /** + * + */ + public function __destruct() + { + if (!is_null($this->multiHandle)) { + curl_multi_close($this->multiHandle); + $this->multiHandle = null; + } + } + + /** + * @param string $requestUri + * @param string[] $requestHeaders + * @param callable $responseHandler Callable accepting the response status code, a response body chunk and the response headers + */ + public function get($requestUri, $requestHeaders, callable $responseHandler) + { + $requestId = UuidGenerator::generatedUuid(); + $this->logRequest($requestId, 'GET', $requestUri, $requestHeaders); + try { + $response = $this->executeRequest('GET', $requestUri, $requestHeaders, '', $responseHandler); + if ($response) { + $this->logResponse($requestId, $requestUri, $response); + } + } catch (Exception $exception) { + $this->logException($requestId, $requestUri, $exception); + throw $exception; + } + } + + /** + * @param string $requestUri + * @param string[] $requestHeaders + * @param callable $responseHandler Callable accepting the response status code, a response body chunk and the response headers + */ + public function delete($requestUri, $requestHeaders, callable $responseHandler) + { + $requestId = UuidGenerator::generatedUuid(); + $this->logRequest($requestId, 'DELETE', $requestUri, $requestHeaders); + try { + $response = $this->executeRequest('DELETE', $requestUri, $requestHeaders, '', $responseHandler); + if ($response) { + $this->logResponse($requestId, $requestUri, $response); + } + } catch (Exception $exception) { + $this->logException($requestId, $requestUri, $exception); + throw $exception; + } + } + + /** + * @param string $requestUri + * @param string[] $requestHeaders + * @param string|MultipartFormDataObject $body + * @param callable $responseHandler Callable accepting the response status code, a response body chunk and the response headers + */ + public function post($requestUri, $requestHeaders, $body, callable $responseHandler) + { + $requestId = UuidGenerator::generatedUuid(); + $bodyToLog = is_string($body) ? $body : ''; + $this->logRequest($requestId, 'POST', $requestUri, $requestHeaders, $bodyToLog); + try { + $response = $this->executeRequest('POST', $requestUri, $requestHeaders, $body, $responseHandler); + if ($response) { + $this->logResponse($requestId, $requestUri, $response); + } + } catch (Exception $exception) { + $this->logException($requestId, $requestUri, $exception); + throw $exception; + } + } + + /** + * @param string $requestUri + * @param string[] $requestHeaders + * @param string $body + * @param callable $responseHandler Callable accepting the response status code, a response body chunk and the response headers + */ + public function put($requestUri, $requestHeaders, $body, callable $responseHandler) + { + $requestId = UuidGenerator::generatedUuid(); + $bodyToLog = is_string($body) ? $body : ''; + $this->logRequest($requestId, 'PUT', $requestUri, $requestHeaders, $bodyToLog); + try { + $response = $this->executeRequest('PUT', $requestUri, $requestHeaders, $body, $responseHandler); + if ($response) { + $this->logResponse($requestId, $requestUri, $response); + } + } catch (Exception $exception) { + $this->logException($requestId, $requestUri, $exception); + throw $exception; + } + } + + /** + * @param CommunicatorLogger $communicatorLogger + */ + public function enableLogging(CommunicatorLogger $communicatorLogger) + { + $this->communicatorLogger = $communicatorLogger; + } + + /** + * + */ + public function disableLogging() + { + $this->communicatorLogger = null; + } + + /** + * @param string $httpMethod + * @param string $requestUri + * @param string[] $requestHeaders + * @param string|MultipartFormDataObject $body + * @param callable $responseHandler Callable accepting the response status code, a response body chunk and the response headers + * @throws ErrorException + */ + protected function executeRequest( + $httpMethod, + $requestUri, + $requestHeaders, + $body, + callable $responseHandler + ) + { + if (!in_array($httpMethod, array('GET', 'DELETE', 'POST', 'PUT'))) { + throw new UnexpectedValueException(sprintf('Http method \'%s\' is not supported', $httpMethod)); + } + $curlHandle = $this->getCurlHandle(); + $this->setCurlOptions($curlHandle, $httpMethod, $requestUri, $requestHeaders, $body); + return $this->executeCurlHandle($curlHandle, $responseHandler); + } + + /** + * @return resource + * @throws ErrorException + */ + protected function getCurlHandle() + { + if (!$curlHandle = curl_init()) { + throw new ErrorException('Cannot initialize cUrl curlHandle'); + } + return $curlHandle; + } + + /** + * @param resource $multiHandle + * @param resource $curlHandle + * @throws ErrorException + */ + private function executeCurlHandleShared($multiHandle, $curlHandle) + { + $running = 0; + do { + $status = curl_multi_exec($multiHandle, $running); + if ($status > CURLM_OK) { + $errorMessage = 'cURL error ' . $status; + if (function_exists('curl_multi_strerror')) { + $errorMessage .= ' (' . curl_multi_strerror($status) . ')'; + } + throw new ErrorException($errorMessage); + } + $info = curl_multi_info_read($multiHandle); + if ($info && isset($info['result']) && $info['result'] != CURLE_OK) { + $errorMessage = 'cURL error ' . $info['result']; + if (function_exists('curl_strerror')) { + $errorMessage .= ' (' . curl_strerror($info['result']) . ')'; + } + throw new ErrorException($errorMessage); + } + curl_multi_select($multiHandle); + } while ($running > 0); + } + + /** + * @param resource $curlHandle + * @param callable $responseHandler + * @return ConnectionResponse|null + * @throws Exception + */ + private function executeCurlHandle($curlHandle, callable $responseHandler) + { + $multiHandle = $this->getCurlMultiHandle(); + curl_multi_add_handle($multiHandle, $curlHandle); + + $headerBuilder = new ResponseHeaderBuilder(); + $headerFunction = function ($ch, $data) use ($headerBuilder) { + $headerBuilder->append($data); + return strlen($data); + }; + + $responseBuilder = $this->communicatorLogger ? new ResponseBuilder() : null; + $writeFunction = function ($ch, $data) use ($headerBuilder, $responseBuilder, $responseHandler) { + $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $headers = $headerBuilder->getHeaders(); + call_user_func($responseHandler, $httpStatusCode, $data, $headers); + if ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + if ($this->isBinaryResponse($headerBuilder)) { + $responseBuilder->setBody(''); + } else { + $responseBuilder->appendBody($data); + } + } + return strlen($data); + }; + + curl_setopt($curlHandle, CURLOPT_HEADERFUNCTION, $headerFunction); + curl_setopt($curlHandle, CURLOPT_WRITEFUNCTION, $writeFunction); + + try { + $this->executeCurlHandleShared($multiHandle, $curlHandle); + + // always emit an empty chunk, to make sure that the status code and headers are sent, + // even if there is no response body + call_user_func($writeFunction, $curlHandle, ''); + + curl_multi_remove_handle($multiHandle, $curlHandle); + + return $responseBuilder ? $responseBuilder->getResponse() : null; + } catch (Exception $e) { + curl_multi_remove_handle($multiHandle, $curlHandle); + + throw $e; + } + } + + /** + * @param resource $curlHandle + * @param string $httpMethod + * @param string $requestUri + * @param string[] $requestHeaders + * @param string|MultipartFormDataObject $body + */ + protected function setCurlOptions( + $curlHandle, + $httpMethod, + $requestUri, + $requestHeaders, + $body + ) + { + if (!is_array($requestHeaders)) { + throw new UnexpectedValueException('Invalid request headers; expected array'); + } + curl_setopt($curlHandle, CURLOPT_HEADER, false); + curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, $httpMethod); + curl_setopt($curlHandle, CURLOPT_URL, $requestUri); + + if ($this->connectTimeout > 0) { + curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); + } + if ($this->readTimeout > 0) { + curl_setopt($curlHandle, CURLOPT_TIMEOUT, $this->readTimeout); + } + + if (in_array($httpMethod, array('PUT', 'POST')) && $body) { + if (is_string($body)) { + curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $body); + } else if ($body instanceof MultipartFormDataObject) { + $multipart = new MultipartFormData($body->getBoundary()); + foreach ($body->getValues() as $name => $value) { + $multipart->addValue($name, $value); + } + foreach ($body->getFiles() as $name => $file) { + $multipart->addFile($name, $file->getFileName(), $file->getContent(), $file->getContentType(), $file->getContentLength()); + } + $multipart->finish(); + + $contentLength = $multipart->getContentLength(); + if ($contentLength >= 0) { + $requestHeaders[] = 'Content-Length: ' . $contentLength; + } + curl_setopt($curlHandle, CURLOPT_READFUNCTION, array($multipart, 'curl_read')); + curl_setopt($curlHandle, CURLOPT_UPLOAD, true); + } else { + $type = is_object($body) ? get_class($body) : gettype($body); + throw new UnexpectedValueException('Unsupported body type: ' . $type); + } + } + + if (count($requestHeaders) > 0) { + curl_setopt($curlHandle, CURLOPT_HTTPHEADER, HttpHeaderHelper::generateRawHeaders($requestHeaders)); + } + + if (!is_null($this->proxyConfiguration)) { + $curlProxy = $this->proxyConfiguration->getCurlProxy(); + if (!empty($curlProxy)) { + curl_setopt($curlHandle, CURLOPT_PROXY, $curlProxy); + } + $curlProxyUserPwd = $this->proxyConfiguration->getCurlProxyUserPwd(); + if (!empty($curlProxyUserPwd)) { + curl_setopt($curlHandle, CURLOPT_PROXYUSERPWD, $curlProxyUserPwd); + } + } + } + + /** + * @return resource + * @throws Exception + */ + private function getCurlMultiHandle() + { + if (is_null($this->multiHandle)) { + $multiHandle = curl_multi_init(); + if ($multiHandle === false) { + throw new Exception('Failed to initialize cURL multi curlHandle'); + } + $this->multiHandle = $multiHandle; + } + return $this->multiHandle; + } + + /** + * @return bool + */ + private function isBinaryResponse($headerBuilder) + { + $contentType = $headerBuilder->getContentType(); + return $contentType + // does not start with text/ + && strrpos($contentType, 'text/', -strlen($contentType)) === false + // does not contain json + && strrpos($contentType, 'json') === false + // does not contain xml + && strrpos($contentType, 'xml') === false; + } + + /** + * @param string $requestId + * @param string $requestMethod + * @param string $requestUri + * @param array $requestHeaders + * @param string $requestBody + */ + protected function logRequest($requestId, $requestMethod, $requestUri, array $requestHeaders, $requestBody = '') + { + if ($this->communicatorLogger) { + $this->getCommunicatorLoggerHelper()->logRequest( + $this->communicatorLogger, + $requestId, + $requestMethod, + $requestUri, + $requestHeaders, + $requestBody + ); + } + } + + /** + * @param string $requestId + * @param string $requestUri + * @param ConnectionResponse $response + */ + protected function logResponse($requestId, $requestUri, ConnectionResponse $response) + { + if ($this->communicatorLogger) { + $this->getCommunicatorLoggerHelper()->logResponse( + $this->communicatorLogger, + $requestId, + $requestUri, + $response + ); + } + } + + /** + * @param string $requestId + * @param string $requestUri + * @param Exception $exception + */ + protected function logException($requestId, $requestUri, Exception $exception) + { + if ($this->communicatorLogger) { + $this->getCommunicatorLoggerHelper()->logException( + $this->communicatorLogger, + $requestId, + $requestUri, + $exception + ); + } + } + + /** @return CommunicatorLoggerHelper */ + protected function getCommunicatorLoggerHelper() + { + if (is_null($this->communicatorLoggerHelper)) { + $this->communicatorLoggerHelper = new CommunicatorLoggerHelper; + } + return $this->communicatorLoggerHelper; + } + + /** + * @param BodyObfuscator $bodyObfuscator + */ + public function setBodyObfuscator(BodyObfuscator $bodyObfuscator) + { + $this->getCommunicatorLoggerHelper()->setBodyObfuscator($bodyObfuscator); + } + + /** + * @param HeaderObfuscator $headerObfuscator + */ + public function setHeaderObfuscator(HeaderObfuscator $headerObfuscator) + { + $this->getCommunicatorLoggerHelper()->setHeaderObfuscator($headerObfuscator); + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/ErrorResponseException.php b/lib/Worldline/Connect/Sdk/Communication/ErrorResponseException.php new file mode 100644 index 0000000..f7bd24e --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/ErrorResponseException.php @@ -0,0 +1,52 @@ +httpStatusCode = $httpStatusCode; + $this->errorResponse = $errorResponse; + } + + /** + * @return int + */ + public function getHttpStatusCode() + { + return $this->httpStatusCode; + } + + /** + * @return DataObject + */ + public function getErrorResponse() + { + return $this->errorResponse; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/HttpHeaderHelper.php b/lib/Worldline/Connect/Sdk/Communication/HttpHeaderHelper.php new file mode 100644 index 0000000..9d3f6a9 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/HttpHeaderHelper.php @@ -0,0 +1,79 @@ + 0) { + if (!$key) { + $headers[0] = trim($rawHeaderLineParts[0]); + } elseif (in_array(substr($rawHeaderLineParts[0], 0, 1), array(' ', "\t"))) { + if (is_array($headers[$key])) { + $lastValue = array_pop($headers[$key]); + $headers[$key][] = $lastValue . "\r\n" . rtrim($rawHeaderLineParts[0]); + } else { + $headers[$key] .= "\r\n" . rtrim($rawHeaderLineParts[0]); + } + } + } + } + return $headers; + } + + /** + * Generates an array of raw headers from an associative array of headers with the same structure as the output + * of the get_headers method using the $format = 1 parameter + * @param array $headers + * @return string[] + */ + public static function generateRawHeaders(array $headers) + { + $rawHeaders = array(); + foreach ($headers as $key => $values) { + if (!is_array($values)) { + $values = array($values); + } + foreach ($values as $value) { + if ($key !== 0) { + $rawHeader = $key . ': ' . $value; + } else { + $rawHeader = $value; + } + foreach (explode("\r\n", $rawHeader) as $singleLineRawHeader) { + $rawHeaders[] = $singleLineRawHeader; + } + } + } + return $rawHeaders; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/HttpObfuscator.php b/lib/Worldline/Connect/Sdk/Communication/HttpObfuscator.php new file mode 100644 index 0000000..ddf3a79 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/HttpObfuscator.php @@ -0,0 +1,94 @@ +headerObfuscator = new HeaderObfuscator(); + $this->bodyObfuscator = new BodyObfuscator(); + } + + /** + * @param BodyObfuscator $bodyObfuscator + */ + public function setBodyObfuscator(BodyObfuscator $bodyObfuscator) + { + $this->bodyObfuscator = $bodyObfuscator; + } + + /** + * @param HeaderObfuscator $headerObfuscator + */ + public function setHeaderObfuscator(HeaderObfuscator $headerObfuscator) + { + $this->headerObfuscator = $headerObfuscator; + } + + /** + * @param string $requestMethod + * @param string $relativeRequestUri + * @param array $requestHeaders + * @param string $requestBody + * @return string + */ + public function getRawObfuscatedRequest( + $requestMethod, + $relativeRequestUri, + array $requestHeaders, + $requestBody = '' + ) { + $rawObfuscatedRequest = $requestMethod . ' ' . $relativeRequestUri . ' ' . static::HTTP_VERSION; + if ($requestHeaders) { + $rawObfuscatedRequest .= PHP_EOL . implode(PHP_EOL, HttpHeaderHelper::generateRawHeaders( + $this->headerObfuscator->obfuscateHeaders($requestHeaders) + )); + } + if (strlen($requestBody) > 0) { + $rawObfuscatedRequest .= PHP_EOL . PHP_EOL . $this->bodyObfuscator->obfuscateBody( + array_key_exists('Content-Type', $requestHeaders) ? $requestHeaders['Content-Type'] : '', + $requestBody + ); + } + return $rawObfuscatedRequest; + } + + /** + * @param ConnectionResponse $response + * @return string + */ + public function getRawObfuscatedResponse(ConnectionResponse $response) + { + $rawObfuscatedResponse = ''; + $responseHeaders = $response->getHeaders(); + if ($responseHeaders) { + $rawObfuscatedResponse .= implode(PHP_EOL, HttpHeaderHelper::generateRawHeaders( + $this->headerObfuscator->obfuscateHeaders($responseHeaders) + )); + } + $responseBody = $response->getBody(); + if (strlen($responseBody) > 0) { + $rawObfuscatedResponse .= PHP_EOL . PHP_EOL . $this->bodyObfuscator->obfuscateBody( + $response->getHeaderValue('Content-Type'), + $responseBody + ); + } + return $rawObfuscatedResponse; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/InvalidResponseException.php b/lib/Worldline/Connect/Sdk/Communication/InvalidResponseException.php new file mode 100644 index 0000000..ad37dbf --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/InvalidResponseException.php @@ -0,0 +1,38 @@ +response = $response; + } + + /** + * @return ConnectionResponse + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/MetadataProvider.php b/lib/Worldline/Connect/Sdk/Communication/MetadataProvider.php new file mode 100644 index 0000000..f74f187 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/MetadataProvider.php @@ -0,0 +1,48 @@ +integrator = $communicatorConfiguration->getIntegrator(); + $this->shoppingCartExtension = $communicatorConfiguration->getShoppingCartExtension(); + } + + /** + * @return string + */ + public function getServerMetaInfoValue() + { + // use a stdClass instead of specific class to keep out null properties + $serverMetaInfo = new stdClass(); + $serverMetaInfo->platformIdentifier = sprintf('%s; php version %s', php_uname(), phpversion()); + $serverMetaInfo->sdkIdentifier = 'PHPServerSDK/v' . static::SDK_VERSION; + $serverMetaInfo->sdkCreator = 'Worldline'; + $serverMetaInfo->integrator = $this->integrator; + if (!is_null($this->shoppingCartExtension)) { + $serverMetaInfo->shoppingCartExtension = $this->shoppingCartExtension->toObject(); + } + // the sdkIdentifier contains a /. Without the JSON_UNESCAPED_SLASHES, this is turned to \/ in JSON. + return base64_encode(json_encode($serverMetaInfo, JSON_UNESCAPED_SLASHES)); + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/MultipartDataObject.php b/lib/Worldline/Connect/Sdk/Communication/MultipartDataObject.php new file mode 100644 index 0000000..75a794c --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/MultipartDataObject.php @@ -0,0 +1,22 @@ +boundary = UuidGenerator::generatedUuid(); + $this->contentType = 'multipart/form-data; boundary=' . $this->boundary; + $this->values = []; + $this->files = []; + } + + /** + * @return string + */ + public function getBoundary() + { + return $this->boundary; + } + + /** + * @return string + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * @return array + */ + public function getValues() + { + return $this->values; + } + + /** + * @return array + */ + public function getFiles() + { + return $this->files; + } + + /** + * @param string $parameterName + * @param string $value + */ + public function addValue($parameterName, $value) + { + if (is_null($parameterName) || strlen(trim($parameterName)) == 0) { + throw new UnexpectedValueException("boundary is required"); + } + if (is_null($value)) { + throw new UnexpectedValueException("value is required"); + } + if (array_key_exists($parameterName, $this->values) || array_key_exists($parameterName, $this->files)) { + throw new UnexpectedValueException('Duplicate parameter name: ' . $parameterName); + } + $this->values[$parameterName] = $value; + } + + /** + * @param string $parameterName + * @param UploadableFile $file + */ + public function addFile($parameterName, UploadableFile $file) + { + if (is_null($parameterName) || strlen(trim($parameterName)) == 0) { + throw new UnexpectedValueException("boundary is required"); + } + if (array_key_exists($parameterName, $this->values) || array_key_exists($parameterName, $this->files)) { + throw new UnexpectedValueException('Duplicate parameter name: ' . $parameterName); + } + $this->files[$parameterName] = $file; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/RequestObject.php b/lib/Worldline/Connect/Sdk/Communication/RequestObject.php new file mode 100644 index 0000000..4758587 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/RequestObject.php @@ -0,0 +1,17 @@ +httpStatusCode = $httpStatusCode; + } + + /** + * @param array $headers + */ + public function setHeaders(array $headers) + { + $this->headers = $headers; + } + + /** + * @param string $data + */ + public function appendBody($data) + { + $this->body .= $data; + } + + /** + * @param string $body + */ + public function setBody($body) + { + $this->body = $body; + } + + /** + * @return ConnectionResponse + */ + public function getResponse() + { + return new ConnectionResponse($this->httpStatusCode, $this->headers, $this->body); + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/ResponseClassMap.php b/lib/Worldline/Connect/Sdk/Communication/ResponseClassMap.php new file mode 100644 index 0000000..f644e0e --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/ResponseClassMap.php @@ -0,0 +1,45 @@ +responseClassNamesByHttpStatusCode[$httpStatusCode] = $responseClassName; + return $this; + } + + /** + * @param int $httpStatusCode + * @return string + */ + public function getResponseClassName($httpStatusCode) + { + if (array_key_exists($httpStatusCode, $this->responseClassNamesByHttpStatusCode)) { + return $this->responseClassNamesByHttpStatusCode[$httpStatusCode]; + } + if ($httpStatusCode < 400) { + return $this->defaultSuccessResponseClassName; + } + return $this->defaultErrorResponseClassName; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/ResponseFactory.php b/lib/Worldline/Connect/Sdk/Communication/ResponseFactory.php new file mode 100644 index 0000000..36c317f --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/ResponseFactory.php @@ -0,0 +1,71 @@ +getResponseObject($response, $responseClassMap); + } catch (UnexpectedValueException $e) { + throw new InvalidResponseException($response, $e->getMessage()); + } + } + + /** + * @param ConnectionResponse $response + * @param ResponseClassMap $responseClassMap + * @return DataObject|null + */ + protected function getResponseObject(ConnectionResponse $response, ResponseClassMap $responseClassMap) + { + $httpStatusCode = $response->getHttpStatusCode(); + if (!$httpStatusCode) { + throw new UnexpectedValueException('HTTP status code is missing'); + } + $contentType = $response->getHeaderValue('Content-Type'); + if (!$contentType && $httpStatusCode !== 204) { + throw new UnexpectedValueException('Content type is missing or empty'); + } + if (!$this->isJsonContentType($contentType) && $httpStatusCode !== 204) { + throw new UnexpectedValueException( + "Invalid content type; got '$contentType', expected '" . static::MIME_APPLICATION_JSON . "'" + ); + } + $responseClassName = $responseClassMap->getResponseClassName($httpStatusCode); + if (empty($responseClassName)) { + if ($httpStatusCode < 400) { + return null; + } + throw new UnexpectedValueException('No default error response class name defined'); + } + if (!class_exists($responseClassName)) { + throw new UnexpectedValueException("class '$responseClassName' does not exist"); + } + $responseObject = new $responseClassName(); + if (!$responseObject instanceof DataObject) { + throw new UnexpectedValueException("class '$responseClassName' is not a 'DataObject'"); + } + return $responseObject->fromJson($response->getBody()); + } + + private function isJsonContentType($contentType) { + return $contentType === static::MIME_APPLICATION_JSON + || substr($contentType, 0, strlen(static::MIME_APPLICATION_JSON)) === static::MIME_APPLICATION_JSON; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/ResponseHeaderBuilder.php b/lib/Worldline/Connect/Sdk/Communication/ResponseHeaderBuilder.php new file mode 100644 index 0000000..04cca98 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/ResponseHeaderBuilder.php @@ -0,0 +1,56 @@ +headerString .= $data; + $this->headers = null; + } + + /** + * @return array + */ + public function getHeaders() + { + if (is_null($this->headers)) { + $this->headers = HttpHeaderHelper::parseRawHeaders(explode("\r\n", $this->headerString)); + } + return $this->headers; + } + + /** + * @return string|null + */ + public function getContentType() + { + if (is_null($this->contentType)) { + $headers = $this->getHeaders(); + foreach ($headers as $headerKey => $headerValue) { + if (strtolower($headerKey) === 'content-type') { + $this->contentType = $headerValue; + break; + } + } + } + return $this->contentType; + } +} diff --git a/lib/Worldline/Connect/Sdk/Communication/UuidGenerator.php b/lib/Worldline/Connect/Sdk/Communication/UuidGenerator.php new file mode 100644 index 0000000..b288e43 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Communication/UuidGenerator.php @@ -0,0 +1,31 @@ +apiEndpoint = $communicatorConfiguration->getApiEndpoint(); + $this->connection = $connection != null ? $connection : new DefaultConnection($communicatorConfiguration); + $this->authenticator = $authenticator != null ? $authenticator : new V1HMACAuthenticator($communicatorConfiguration); + $this->metadataProvider = new MetadataProvider($communicatorConfiguration); + } + + /** + * @param CommunicatorLogger $communicatorLogger + */ + public function enableLogging(CommunicatorLogger $communicatorLogger) + { + $this->connection->enableLogging($communicatorLogger); + } + + /** + * + */ + public function disableLogging() + { + $this->connection->disableLogging(); + } + + /** + * @param ResponseClassMap $responseClassMap + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @return DataObject + * @throws Exception + */ + public function get( + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + $requestHeaders = + $this->getRequestHeaders('GET', $relativeUriPathWithRequestParameters, static::MIME_APPLICATION_JSON, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $this->connection->get( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + throw new ErrorResponseException($httpStatusCode, $response); + } + return $response; + } + + /** + * @param callable $bodyHandler Callable accepting a response body chunk and the response headers + * @param ResponseClassMap $responseClassMap Used for error handling + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @throws Exception + */ + public function getWithBinaryResponse( + callable $bodyHandler, + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + $requestHeaders = + $this->getRequestHeaders('GET', $relativeUriPathWithRequestParameters, static::MIME_APPLICATION_JSON, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder, $bodyHandler) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + if ($httpStatusCode >= 400) { + $responseBuilder->appendBody($data); + } else { + call_user_func($bodyHandler, $data, $headers); + } + }; + + $this->connection->get( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + throw new ErrorResponseException($httpStatusCode, $response); + } + } + + /** + * @param ResponseClassMap $responseClassMap + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @return DataObject + * @throws Exception + */ + public function delete( + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + $requestHeaders = + $this->getRequestHeaders('DELETE', $relativeUriPathWithRequestParameters, static::MIME_APPLICATION_JSON, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $this->connection->delete( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + throw new ErrorResponseException($httpStatusCode, $response); + } + return $response; + } + + /** + * @param callable $bodyHandler Callable accepting a response body chunk and the response headers + * @param ResponseClassMap $responseClassMap Used for error handling + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @throws Exception + */ + public function deleteWithBinaryResponse( + callable $bodyHandler, + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + $requestHeaders = + $this->getRequestHeaders('DELETE', $relativeUriPathWithRequestParameters, static::MIME_APPLICATION_JSON, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder, $bodyHandler) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + if ($httpStatusCode >= 400) { + $responseBuilder->appendBody($data); + } else { + call_user_func($bodyHandler, $data, $headers); + } + }; + + $this->connection->delete( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + throw new ErrorResponseException($httpStatusCode, $response); + } + } + + /** + * @param ResponseClassMap $responseClassMap + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param DataObject|MultipartDataObject|null $requestBodyObject + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @return DataObject + * @throws Exception + */ + public function post( + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + $requestBodyObject = null, + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + if ($requestBodyObject instanceof MultipartFormDataObject) { + $contentType = $requestBodyObject->getContentType(); + $requestBody = $requestBodyObject; + } else if ($requestBodyObject instanceof MultipartDataObject) { + $multipart = $requestBodyObject->toMultipartFormDataObject(); + $contentType = $multipart->getContentType(); + $requestBody = $multipart; + } else if ($requestBodyObject instanceof DataObject || is_null($requestBodyObject)) { + $contentType = static::MIME_APPLICATION_JSON; + $requestBody = $requestBodyObject ? $requestBodyObject->toJson() : ''; + } else { + throw new UnexpectedValueException('Unsupported request body'); + } + $requestHeaders = + $this->getRequestHeaders('POST', $relativeUriPathWithRequestParameters, $contentType, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $this->connection->post( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $requestBody, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + throw new ErrorResponseException($httpStatusCode, $response); + } + return $response; + } + + /** + * @param callable $bodyHandler Callable accepting a response body chunk and the response headers + * @param ResponseClassMap $responseClassMap Used for error handling + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param DataObject|MultipartDataObject|null $requestBodyObject + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @throws Exception + */ + public function postWithBinaryResponse( + callable $bodyHandler, + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + $requestBodyObject = null, + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + if ($requestBodyObject instanceof MultipartFormDataObject) { + $contentType = $requestBodyObject->getContentType(); + $requestBody = $requestBodyObject; + } else if ($requestBodyObject instanceof MultipartDataObject) { + $multipart = $requestBodyObject->toMultipartFormDataObject(); + $contentType = $multipart->getContentType(); + $requestBody = $multipart; + } else if ($requestBodyObject instanceof DataObject || is_null($requestBodyObject)) { + $contentType = static::MIME_APPLICATION_JSON; + $requestBody = $requestBodyObject ? $requestBodyObject->toJson() : ''; + } else { + throw new UnexpectedValueException('Unsupported request body'); + } + $requestHeaders = + $this->getRequestHeaders('POST', $relativeUriPathWithRequestParameters, $contentType, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder, $bodyHandler) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + if ($httpStatusCode >= 400) { + $responseBuilder->appendBody($data); + } else { + call_user_func($bodyHandler, $data, $headers); + } + }; + + $this->connection->post( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $requestBody, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + throw new ErrorResponseException($httpStatusCode, $response); + } + } + + /** + * @param ResponseClassMap $responseClassMap + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param DataObject|MultipartDataObject|null $requestBodyObject + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @return DataObject + * @throws Exception + */ + public function put( + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + $requestBodyObject = null, + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + if ($requestBodyObject instanceof MultipartFormDataObject) { + $contentType = $requestBodyObject->getContentType(); + $requestBody = $requestBodyObject; + } else if ($requestBodyObject instanceof MultipartDataObject) { + $multipart = $requestBodyObject->toMultipartFormDataObject(); + $contentType = $multipart->getContentType(); + $requestBody = $multipart; + } else if ($requestBodyObject instanceof DataObject || is_null($requestBodyObject)) { + $contentType = static::MIME_APPLICATION_JSON; + $requestBody = $requestBodyObject ? $requestBodyObject->toJson() : ''; + } else { + throw new UnexpectedValueException('Unsupported request body'); + } + $requestHeaders = + $this->getRequestHeaders('PUT', $relativeUriPathWithRequestParameters, $contentType, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $this->connection->put( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $requestBody, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + throw new ErrorResponseException($httpStatusCode, $response); + } + return $response; + } + + /** + * @param callable $bodyHandler Callable accepting a response body chunk and the response headers + * @param ResponseClassMap $responseClassMap Used for error handling + * @param string $relativeUriPath + * @param string $clientMetaInfo + * @param DataObject|MultipartDataObject|null $requestBodyObject + * @param RequestObject|null $requestParameters + * @param CallContext $callContext + * @throws Exception + */ + public function putWithBinaryResponse( + callable $bodyHandler, + ResponseClassMap $responseClassMap, + $relativeUriPath, + $clientMetaInfo = '', + $requestBodyObject = null, + RequestObject $requestParameters = null, + CallContext $callContext = null + ) { + $relativeUriPathWithRequestParameters = + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + if ($requestBodyObject instanceof MultipartFormDataObject) { + $contentType = $requestBodyObject->getContentType(); + $requestBody = $requestBodyObject; + } else if ($requestBodyObject instanceof MultipartDataObject) { + $multipart = $requestBodyObject->toMultipartFormDataObject(); + $contentType = $multipart->getContentType(); + $requestBody = $multipart; + } else if ($requestBodyObject instanceof DataObject || is_null($requestBodyObject)) { + $contentType = static::MIME_APPLICATION_JSON; + $requestBody = $requestBodyObject ? $requestBodyObject->toJson() : ''; + } else { + throw new UnexpectedValueException('Unsupported request body'); + } + $requestHeaders = + $this->getRequestHeaders('PUT', $relativeUriPathWithRequestParameters, $contentType, $clientMetaInfo, $callContext); + + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder, $bodyHandler) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + if ($httpStatusCode >= 400) { + $responseBuilder->appendBody($data); + } else { + call_user_func($bodyHandler, $data, $headers); + } + }; + + $this->connection->put( + $this->apiEndpoint . $relativeUriPathWithRequestParameters, + $requestHeaders, + $requestBody, + $responseHandler + ); + $connectionResponse = $responseBuilder->getResponse(); + $this->updateCallContext($connectionResponse, $callContext); + $httpStatusCode = $connectionResponse->getHttpStatusCode(); + if ($httpStatusCode >= 400) { + $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); + throw new ErrorResponseException($httpStatusCode, $response); + } + } + + /** + * @param ConnectionResponse $response + * @param CallContext $callContext + */ + protected function updateCallContext(ConnectionResponse $response, CallContext $callContext = null) + { + if ($callContext) { + $callContext->setIdempotenceRequestTimestamp( + $response->getHeaderValue('X-GCS-Idempotence-Request-Timestamp') + ); + } + } + + /** + * @param $relativeUriPath + * @param RequestObject|null $requestParameters + * @return string + * @throws Exception + */ + protected function getRequestUri($relativeUriPath, RequestObject $requestParameters = null) + { + return + $this->apiEndpoint . + $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); + } + + /** + * @param string $httpMethod + * @param string $relativeUriPathWithRequestParameters + * @param string $contentType + * @param string $clientMetaInfo + * @param CallContext $callContext + * @return string[] + */ + protected function getRequestHeaders( + $httpMethod, + $relativeUriPathWithRequestParameters, + $contentType, + $clientMetaInfo = '', + CallContext $callContext = null + ) { + $rfc2616Date = self::getRfc161Date(); + $requestHeaders = array(); + $requestHeaders['Content-Type'] = $contentType; + $requestHeaders['Date'] = $rfc2616Date; + if ($clientMetaInfo) { + $requestHeaders['X-GCS-ClientMetaInfo'] = $clientMetaInfo; + } + $requestHeaders['X-GCS-ServerMetaInfo'] = $this->metadataProvider->getServerMetaInfoValue(); + if ($callContext && strlen($callContext->getIdempotenceKey()) > 0) { + $requestHeaders['X-GCS-Idempotence-Key'] = $callContext->getIdempotenceKey(); + } + $requestHeaders['Authorization'] = $this->authenticator->getAuthorization($httpMethod, $relativeUriPathWithRequestParameters, $requestHeaders); + return $requestHeaders; + } + + /** + * @return string + */ + protected static function getRfc161Date() + { + return gmdate('D, d M Y H:i:s T'); + } + + /** + * @param $relativeUriPath + * @param RequestObject|null $requestParameters + * @return string + */ + protected function getRelativeUriPathWithRequestParameters( + $relativeUriPath, + RequestObject $requestParameters = null + ) { + if (is_null($requestParameters)) { + return $relativeUriPath; + } + $requestParameterObjectVars = get_object_vars($requestParameters); + if (count($requestParameterObjectVars) == 0) { + return $relativeUriPath; + } + $httpQuery = http_build_query($requestParameterObjectVars); + // remove [0], [1] etc that are added if properties are arrays + $httpQuery = preg_replace('/%5B[0-9]+%5D/simU', '', $httpQuery); + return $relativeUriPath . '?' . $httpQuery; + } + + /** @return ResponseFactory */ + protected function getResponseFactory() + { + if (is_null($this->responseFactory)) { + $this->responseFactory = new ResponseFactory(); + } + return $this->responseFactory; + } +} diff --git a/lib/Worldline/Connect/Sdk/CommunicatorConfiguration.php b/lib/Worldline/Connect/Sdk/CommunicatorConfiguration.php new file mode 100644 index 0000000..9943384 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/CommunicatorConfiguration.php @@ -0,0 +1,263 @@ +validateApiEndpoint($apiEndpoint); + $this->validateIntegrator($integrator); + $this->authorizationId = $authorizationId; + $this->authorizationSecret = $authorizationSecret; + $this->apiEndpoint = $apiEndpoint; + $this->integrator = $integrator; + $this->proxyConfiguration = $proxyConfiguration; + $this->connectTimeout = $connectTimeout; + $this->readTimeout = $readTimeout; + } + + private function validateApiEndpoint($apiEndpoint) + { + $url = parse_url($apiEndpoint); + if ($url === FALSE) { + throw new UnexpectedValueException('apiEndpoint is not a valid URL'); + } else if (isset($url['path']) && $url['path'] !== '') { + throw new UnexpectedValueException('apiEndpoint should not contain a path'); + } else if (isset($url['user']) || isset($url['query']) || isset($url['fragment'])) { + throw new UnexpectedValueException('apiEndpoint should not contain user info, query or fragment'); + } + } + + private function validateIntegrator($integrator) + { + if (is_null($integrator) || strlen(trim($integrator)) == 0) { + throw new UnexpectedValueException("integrator is required"); + } + } + + /** + * @return string An id used for authorization. This can be the identifier for a secret API key, or something else. + */ + public function getAuthorizationId() + { + return $this->authorizationId; + } + + /** + * @param string $authorizationId + */ + public function setAuthorizationId($authorizationId) + { + $this->authorizationId = $authorizationId; + } + + /** + * @return string A secret used for authorization. This can be a secret API key, or something else. + */ + public function getAuthorizationSecret() + { + return $this->authorizationSecret; + } + + /** + * @param string $authorizationSecret + */ + public function setAuthorizationSecret($authorizationSecret) + { + $this->authorizationSecret = $authorizationSecret; + } + + /** + * This method is an alias for getAuthorizationId. + * @return string + */ + public function getApiKeyId() + { + return $this->getAuthorizationId(); + } + + /** + * This method is an alias for setAuthorizationId. + * @param string $apiKeyId + */ + public function setApiKeyId($apiKeyId) + { + $this->setAuthorizationId($apiKeyId); + } + + /** + * This method is an alias for getAuthorizationSecret. + * @return string + */ + public function getApiSecret() + { + return $this->getAuthorizationSecret(); + } + + /** + * This method is an alias for setAuthorizationSecret. + * @param string $apiSecret + */ + public function setApiSecret($apiSecret) + { + $this->setAuthorizationSecret($apiSecret); + } + + /** + * @return string + */ + public function getApiEndpoint() + { + return $this->apiEndpoint; + } + + /** + * @param string $apiEndpoint + */ + public function setApiEndpoint($apiEndpoint) + { + $this->validateApiEndpoint($apiEndpoint); + $this->apiEndpoint = $apiEndpoint; + } + + /** + * @return ProxyConfiguration|null + */ + public function getProxyConfiguration() + { + return $this->proxyConfiguration; + } + + /** + * @param ProxyConfiguration|null $proxyConfiguration + */ + public function setProxyConfiguration(ProxyConfiguration $proxyConfiguration = null) + { + $this->proxyConfiguration = $proxyConfiguration; + } + + /** + * @return int + */ + public function getConnectTimeout() + { + return $this->connectTimeout; + } + + /** + * @param int $connectTimeout + */ + public function setConnectTimeout($connectTimeout) + { + $this->connectTimeout = $connectTimeout; + } + + /** + * @return int + */ + public function getReadTimeout() + { + return $this->readTimeout; + } + + /** + * @param int $readTimeout + */ + public function setReadTimeout($readTimeout) + { + $this->readTimeout = $readTimeout; + } + + /** + * @return string + */ + public function getIntegrator() + { + return $this->integrator; + } + + /** + * @param string $integrator + */ + public function setIntegrator($integrator) + { + $this->validateIntegrator($integrator); + $this->integrator = $integrator; + } + + /** + * @return ShoppingCartExtension|null + */ + public function getShoppingCartExtension() + { + return $this->shoppingCartExtension; + } + + /** + * @param ShoppingCartExtension|null $shoppingCartExtension + */ + public function setShoppingCartExtension(ShoppingCartExtension $shoppingCartExtension = null) + { + $this->shoppingCartExtension = $shoppingCartExtension; + } +} diff --git a/lib/Worldline/Connect/Sdk/Domain/DataObject.php b/lib/Worldline/Connect/Sdk/Domain/DataObject.php new file mode 100644 index 0000000..eb3f141 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Domain/DataObject.php @@ -0,0 +1,60 @@ +toObject()); + } + + /** + * @param string $value + * @return $this + * @throws UnexpectedValueException + */ + public function fromJson($value) + { + $object = JSONUtil::decode($value); + return $this->fromObject($object); + } + + /** + * @return object + */ + public function toObject() + { + return new stdClass(); + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + if (!is_object($object)) { + throw new UnexpectedValueException('Expected object, got ' . gettype($object)); + } + return $this; + } + + public function __set($name, $value) + { + throw new Exception('Cannot add new property ' . $name . ' to instances of class ' . get_class($this)); + } +} diff --git a/lib/Worldline/Connect/Sdk/Domain/ShoppingCartExtension.php b/lib/Worldline/Connect/Sdk/Domain/ShoppingCartExtension.php new file mode 100644 index 0000000..127c7c0 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Domain/ShoppingCartExtension.php @@ -0,0 +1,84 @@ +creator = $creator; + $this->name = $name; + $this->version = $version; + $this->extensionId = $extensionId; + } + + /** + * @return object + */ + public function toObject() + { + $object = parent::toObject(); + if (!is_null($this->creator)) { + $object->creator = $this->creator; + } + if (!is_null($this->name)) { + $object->name = $this->name; + } + if (!is_null($this->version)) { + $object->version = $this->version; + } + if (!is_null($this->extensionId)) { + $object->extensionId = $this->extensionId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'creator')) { + $this->creator = $object->creator; + } + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'version')) { + $this->version = $object->version; + } + if (property_exists($object, 'extensionId')) { + $this->extensionId = $object->extensionId; + } + return $this; + } +} diff --git a/lib/Worldline/Connect/Sdk/Domain/UploadableFile.php b/lib/Worldline/Connect/Sdk/Domain/UploadableFile.php new file mode 100644 index 0000000..ea63ffa --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Domain/UploadableFile.php @@ -0,0 +1,84 @@ +fileName = $fileName; + $this->content = $content; + $this->contentType = $contentType; + $this->contentLength = max($contentLength, -1); + if ($this->contentLength == -1 && is_string($content)) { + $this->contentLength = strlen($content); + } + } + + /** + * @return string The name of the file. + */ + public function getFileName() + { + return $this->fileName; + } + + /** + * @return resource|string|callable A resource, string or callable with the file's content. + * If it's a callable it should take a length argument and return a string that is not larger than the input. + */ + public function getContent() + { + return $this->content; + } + + /** + * @return string The file's content type. + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * @return int The file's content length, or -1 if not known. + */ + public function getContentLength() + { + return $this->contentLength; + } +} diff --git a/lib/Worldline/Connect/Sdk/JSON/JSONUtil.php b/lib/Worldline/Connect/Sdk/JSON/JSONUtil.php new file mode 100644 index 0000000..3315963 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/JSON/JSONUtil.php @@ -0,0 +1,57 @@ + */ + private $customRules = array(); + + public function __construct() + { + $this->valueObfuscator = new ValueObfuscator(); + } + + /** + * @param string $contentType + * @param string $body + * @return string + */ + public function obfuscateBody($contentType, $body) + { + if (!$this->isJsonContentType($contentType)) { + return $body; + } + $decodedJsonBody = json_decode($body); + if (json_last_error() !== JSON_ERROR_NONE) { + return $body; + } + return json_encode($this->obfuscateDecodedJsonPart($decodedJsonBody), JSON_PRETTY_PRINT); + } + + private function isJsonContentType($contentType) { + return $contentType === static::MIME_APPLICATION_JSON + || substr($contentType, 0, strlen(static::MIME_APPLICATION_JSON)) === static::MIME_APPLICATION_JSON; + } + + /** + * @param $value + * @return mixed + */ + protected function obfuscateDecodedJsonPart($value) + { + if (is_object($value)) { + foreach ($value as $propertyName => $propertyValue) { + if (is_scalar($propertyValue)) { + $value->$propertyName = $this->obfuscateScalarValue($propertyName, $propertyValue); + } else { + $value->$propertyName = $this->obfuscateDecodedJsonPart($propertyValue); + } + } + } + if (is_array($value)) { + foreach ($value as $elementKey => &$elementValue) { + if (is_scalar($elementValue)) { + $elementValue = $this->obfuscateScalarValue($elementKey, $elementValue); + } else { + $elementValue = $this->obfuscateDecodedJsonPart($elementValue); + } + } + + } + return $value; + } + + /** + * @param $key + * @param $value + * @return string + */ + protected function obfuscateScalarValue($key, $value) + { + if (!is_scalar($value)) { + throw new UnexpectedValueException('scalar value expected'); + } + $lowerKey = mb_strtolower(strval($key), 'UTF-8'); + if (isset($this->customRules[$lowerKey])) { + return call_user_func($this->customRules[$lowerKey], $value, $this->valueObfuscator); + } + switch ($lowerKey) { + case 'keyid': + case 'secretkey': + case 'publickey': + case 'userauthenticationtoken': + case 'encryptedpayload': + case 'decryptedpayload': + case 'encryptedcustomerinput': + return $this->valueObfuscator->obfuscateFixedLength(8); + case 'cvv': + case 'value': + return $this->valueObfuscator->obfuscateAll($value); + case 'bin': + return $this->valueObfuscator->obfuscateAllKeepStart($value, 6); + case 'accountnumber': + case 'cardnumber': + case 'iban': + case 'reformattedaccountnumber': + return $this->valueObfuscator->obfuscateAllKeepEnd($value, 4); + case 'expirydate': + return $this->valueObfuscator->obfuscateAllKeepEnd($value, 2); + default: + return $value; + } + } + + /** + * @param $propertyName + * @param callable $customRule + */ + public function setCustomRule($propertyName, callable $customRule) + { + $lowerName = mb_strtolower(strval($propertyName), 'UTF-8'); + $this->customRules[$lowerName] = $customRule; + } +} diff --git a/lib/Worldline/Connect/Sdk/Logging/CommunicatorLogger.php b/lib/Worldline/Connect/Sdk/Logging/CommunicatorLogger.php new file mode 100644 index 0000000..7dfe052 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Logging/CommunicatorLogger.php @@ -0,0 +1,23 @@ + */ + private $customRules = array(); + + public function __construct() + { + $this->valueObfuscator = new ValueObfuscator(); + } + + /** + * @param string[] $headers + * @return string[] + */ + public function obfuscateHeaders(array $headers) + { + foreach ($headers as $headerName => &$headerValue) { + $headerValue = $this->obfuscateHeaderValue($headerName, $headerValue); + } + return $headers; + } + + /** + * @param $key + * @param $value + * @return string + */ + protected function obfuscateHeaderValue($key, $value) + { + $lowerKey = mb_strtolower(strval($key), 'UTF-8'); + if (isset($this->customRules[$lowerKey])) { + return $this->replaceHeaderValueWithCustomRule($value, $this->customRules[$lowerKey]); + } + switch ($lowerKey) { + case 'authorization': + case 'www-authenticate': + case 'proxy-authenticate': + case 'proxy-authorization': + case 'x-gcs-authentication-token': + case 'x-gcs-callerpassword': + return $this->replaceHeaderValueWithFixedNumberOfCharacters($value, 8); + default: + return $value; + } + } + + /** + * @param $value + * @param $numberOfCharacters + * @return array|string + */ + protected function replaceHeaderValueWithFixedNumberOfCharacters($value, $numberOfCharacters) + { + if (is_array($value)) { + return array_fill(0, count($value), $this->valueObfuscator->obfuscateFixedLength($numberOfCharacters)); + } else { + return $this->valueObfuscator->obfuscateFixedLength($numberOfCharacters); + } + } + + /** + * @param $value + * @param callable $customRule + * @return array|string + */ + protected function replaceHeaderValueWithCustomRule($value, callable $customRule) + { + if (is_array($value)) { + return array_map(function ($v) use ($customRule) { + return call_user_func($customRule, $v, $this->valueObfuscator); + }, $value); + } else { + return call_user_func($customRule, $value, $this->valueObfuscator); + } + } + + /** + * @param $headerName + * @param callable $customRule + */ + public function setCustomRule($headerName, callable $customRule) + { + $lowerName = mb_strtolower(strval($headerName), 'UTF-8'); + $this->customRules[$lowerName] = $customRule; + } +} diff --git a/lib/Worldline/Connect/Sdk/Logging/ResourceLogger.php b/lib/Worldline/Connect/Sdk/Logging/ResourceLogger.php new file mode 100644 index 0000000..ea2d058 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Logging/ResourceLogger.php @@ -0,0 +1,46 @@ +resource = $resource; + } + + /** @inheritdoc */ + public function log($message) + { + fwrite($this->resource, $this->getDatePrefix() . $message . PHP_EOL); + } + + /** @inheritdoc */ + public function logException($message, Exception $exception) + { + fwrite($this->resource, $this->getDatePrefix() . $message . PHP_EOL . $exception . PHP_EOL); + } + + /** @return string */ + protected function getDatePrefix() + { + return date(static::DATE_FORMAT_STRING) . ' '; + } +} diff --git a/lib/Worldline/Connect/Sdk/Logging/SplFileObjectLogger.php b/lib/Worldline/Connect/Sdk/Logging/SplFileObjectLogger.php new file mode 100644 index 0000000..82c6af5 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Logging/SplFileObjectLogger.php @@ -0,0 +1,49 @@ +splFileObject = $splFileObject; + } + + /** @return SplFileObject */ + public function getSplFileObject() + { + return $this->splFileObject; + } + + /** @inheritdoc */ + public function log($message) + { + $this->splFileObject->fwrite($this->getDatePrefix() . $message . PHP_EOL); + } + + /** @inheritdoc */ + public function logException($message, Exception $exception) + { + $this->splFileObject->fwrite($this->getDatePrefix() . $message . PHP_EOL . $exception . PHP_EOL); + } + + /** @return string */ + protected function getDatePrefix() + { + return date(static::DATE_FORMAT_STRING) . ' '; + } +} diff --git a/lib/Worldline/Connect/Sdk/Logging/ValueObfuscator.php b/lib/Worldline/Connect/Sdk/Logging/ValueObfuscator.php new file mode 100644 index 0000000..d9c4a44 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Logging/ValueObfuscator.php @@ -0,0 +1,72 @@ +obfuscateAll($value); + } + if (mb_strlen($value, 'UTF-8') <= $numberOfCharactersToKeep) { + return $value; + } + return + str_repeat(static::MASK_CHARACTER, mb_strlen($value, 'UTF-8') - $numberOfCharactersToKeep) . + mb_substr($value, mb_strlen($value, 'UTF-8') - $numberOfCharactersToKeep, null, 'UTF-8') + ; + } + + /** + * @param string $value + * @param int $numberOfCharactersToKeep + * @return string + */ + public function obfuscateAllKeepStart($value, $numberOfCharactersToKeep) + { + if ($numberOfCharactersToKeep <= 0) { + return $this->obfuscateAll($value); + } + if (mb_strlen($value, 'UTF-8') <= $numberOfCharactersToKeep) { + return $value; + } + return + mb_substr($value, 0, $numberOfCharactersToKeep, 'UTF-8') . + str_repeat(static::MASK_CHARACTER, mb_strlen($value, 'UTF-8') - $numberOfCharactersToKeep) + ; + } + + /** + * @param string $value + * @return string + */ + public function obfuscateAll($value) + { + return str_repeat(static::MASK_CHARACTER, mb_strlen($value, 'UTF-8')); + } + + /** + * @param int $length + * @return string + */ + public function obfuscateFixedLength($length) + { + if ($length <= 0) { + return ''; + } + return str_repeat(static::MASK_CHARACTER, $length); + } +} diff --git a/lib/Worldline/Connect/Sdk/ProxyConfiguration.php b/lib/Worldline/Connect/Sdk/ProxyConfiguration.php new file mode 100644 index 0000000..46ea5df --- /dev/null +++ b/lib/Worldline/Connect/Sdk/ProxyConfiguration.php @@ -0,0 +1,65 @@ +host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + } + } + + /** + * @return string + */ + public function getCurlProxy() + { + if (!is_null($this->host)) { + return $this->host . (is_null($this->port) ? '' : ':'. $this->port); + } + return ''; + } + + /** + * @return string + */ + public function getCurlProxyUserPwd() + { + if (!is_null($this->host)) { + return $this->username . (is_null($this->password) ? '' : ':'. $this->password); + } + return ''; + } +} diff --git a/lib/Worldline/Connect/Sdk/Webhooks/ApiVersionMismatchException.php b/lib/Worldline/Connect/Sdk/Webhooks/ApiVersionMismatchException.php new file mode 100644 index 0000000..6248e6e --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Webhooks/ApiVersionMismatchException.php @@ -0,0 +1,45 @@ +eventApiVersion = $eventApiVersion; + $this->sdkApiVersion = $sdkApiVersion; + } + + /** + * @return string + */ + public function getEventApiVersion() + { + return $this->eventApiVersion; + } + + /** + * @return string + */ + public function getSdkApiVersion() + { + return $this->sdkApiVersion; + } +} diff --git a/lib/Worldline/Connect/Sdk/Webhooks/InMemorySecretKeyStore.php b/lib/Worldline/Connect/Sdk/Webhooks/InMemorySecretKeyStore.php new file mode 100644 index 0000000..c4d4f85 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Webhooks/InMemorySecretKeyStore.php @@ -0,0 +1,70 @@ + */ + private $secretKeys; + + /** + * @param array $secretKeys + */ + public function __construct($secretKeys = array()) + { + $this->secretKeys = $secretKeys; + } + + /** + * @param string $keyId + * @return string + * @throws SecretKeyNotAvailableException + */ + public function getSecretKey($keyId) + { + if (!isset($this->secretKeys[$keyId]) || is_null($this->secretKeys[$keyId])) { + throw new SecretKeyNotAvailableException($keyId, "could not find secret key for key id $keyId"); + } + return $this->secretKeys[$keyId]; + } + + /** + * Stores the given secret key for the given key id. + * @param string $keyId + * @param string $secretKey + */ + public function storeSecretKey($keyId, $secretKey) + { + if (is_null($keyId) || strlen(trim($keyId)) == 0) { + throw new UnexpectedValueException("keyId is required"); + } + if (is_null($secretKey) || strlen(trim($secretKey)) == 0) { + throw new UnexpectedValueException("secretKey is required"); + } + $this->secretKeys[$keyId] = $secretKey; + } + + /** + * Removes the secret key for the given key id. + * @param string $keyId + */ + public function removeSecretKey($keyId) + { + unset($this->secretKeys[$keyId]); + } + + /** + * Removes all stored secret keys. + */ + public function clear() + { + unset($this->secretKeys); + $this->secretKeys = array(); + } +} diff --git a/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyNotAvailableException.php b/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyNotAvailableException.php new file mode 100644 index 0000000..98f2aec --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyNotAvailableException.php @@ -0,0 +1,34 @@ +keyId = $keyId; + } + + /** + * @return string + */ + public function getKeyId() + { + return $this->keyId; + } +} diff --git a/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyStore.php b/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyStore.php new file mode 100644 index 0000000..d8e5256 --- /dev/null +++ b/lib/Worldline/Connect/Sdk/Webhooks/SecretKeyStore.php @@ -0,0 +1,18 @@ +secretKeyStore = $secretKeyStore; + } + + /** + * Validates the given body using the given request headers. + * @param string $body + * @param array $requestHeaders + * @throws SignatureValidationException + */ + public function validate($body, $requestHeaders) + { + $this->validateBody($body, $requestHeaders); + } + + // utility methods + + private function validateBody($body, $requestHeaders) + { + $signature = $this->getHeaderValue($requestHeaders, 'X-GCS-Signature'); + $keyId = $this->getHeaderValue($requestHeaders, 'X-GCS-KeyId'); + $secretKey = $this->secretKeyStore->getSecretKey($keyId); + + $expectedSignature = base64_encode(hash_hmac("sha256", $body, $secretKey, true)); + + $isValid = $this->areEqualSignatures($signature, $expectedSignature); + if (!$isValid) { + throw new SignatureValidationException("failed to validate signature '$signature'"); + } + } + + private function areEqualSignatures($signature, $expectedSignature) { + if (function_exists('hash_equals')) { + return hash_equals($expectedSignature, $signature); + } else { + // copied from http://php.net/manual/en/function.hash-equals.php#115635 + if(strlen($expectedSignature) != strlen($signature)) { + return false; + } else { + $res = $expectedSignature ^ $signature; + $ret = 0; + for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]); + return !$ret; + } + } + } + + // general utility methods + + private function getHeaderValue($requestHeaders, $headerName) { + $lowerCaseHeaderName = strtolower($headerName); + foreach ($requestHeaders as $name => $value) { + if ($lowerCaseHeaderName === strtolower($name)) { + return $value; + } + } + throw new SignatureValidationException("could not find header '$headerName'"); + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..c786b3e --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,13 @@ + + + + tests/Worldline/Connect/Sdk + + + + + src + lib + + + diff --git a/src/Worldline/Connect/Sdk/Client.php b/src/Worldline/Connect/Sdk/Client.php new file mode 100644 index 0000000..0a5e1ea --- /dev/null +++ b/src/Worldline/Connect/Sdk/Client.php @@ -0,0 +1,83 @@ +communicator = $communicator; + $this->setClientMetaInfo($clientMetaInfo); + $this->context = array(); + } + + /** + * @return Communicator + */ + protected function getCommunicator() + { + return $this->communicator; + } + + /** + * @param CommunicatorLogger $communicatorLogger + */ + public function enableLogging(CommunicatorLogger $communicatorLogger) + { + $this->getCommunicator()->enableLogging($communicatorLogger); + } + + /** + * + */ + public function disableLogging() + { + $this->getCommunicator()->disableLogging(); + } + + /** + * @param string $clientMetaInfo + * @return $this + */ + public function setClientMetaInfo($clientMetaInfo) + { + $this->clientMetaInfo = $clientMetaInfo ? base64_encode($clientMetaInfo) : ''; + return $this; + } + + /** + * @return string + */ + protected function getClientMetaInfo() + { + return $this->clientMetaInfo; + } + + public function v1() + { + return new V1Client($this, $this->context); + } +} diff --git a/src/Worldline/Connect/Sdk/V1/ApiException.php b/src/Worldline/Connect/Sdk/V1/ApiException.php new file mode 100644 index 0000000..bbc5ca4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/ApiException.php @@ -0,0 +1,15 @@ +getResponse()); + if (!array_key_exists('paymentResult', $responseVariables)) { + return new CreatePaymentResult(); + } + $paymentResult = $responseVariables['paymentResult']; + if (!($paymentResult instanceof CreatePaymentResult)) { + return new CreatePaymentResult(); + } + return $paymentResult; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/DeclinedPayoutException.php b/src/Worldline/Connect/Sdk/V1/DeclinedPayoutException.php new file mode 100644 index 0000000..91afe7a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/DeclinedPayoutException.php @@ -0,0 +1,32 @@ +getResponse()); + if (!array_key_exists('payoutResult', $responseVariables)) { + return new PayoutResult(); + } + $payoutResult = $responseVariables['payoutResult']; + if (!($payoutResult instanceof PayoutResult)) { + return new PayoutResult(); + } + return $payoutResult; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/DeclinedRefundException.php b/src/Worldline/Connect/Sdk/V1/DeclinedRefundException.php new file mode 100644 index 0000000..1da8f69 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/DeclinedRefundException.php @@ -0,0 +1,32 @@ +getResponse()); + if (!array_key_exists('refundResult', $responseVariables)) { + return new RefundResult(); + } + $refundResult = $responseVariables['refundResult']; + if (!($refundResult instanceof RefundResult)) { + return new RefundResult(); + } + return $refundResult; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/APIError.php b/src/Worldline/Connect/Sdk/V1/Domain/APIError.php new file mode 100644 index 0000000..a1c81a3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/APIError.php @@ -0,0 +1,112 @@ +category)) { + $object->category = $this->category; + } + if (!is_null($this->code)) { + $object->code = $this->code; + } + if (!is_null($this->httpStatusCode)) { + $object->httpStatusCode = $this->httpStatusCode; + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->message)) { + $object->message = $this->message; + } + if (!is_null($this->propertyName)) { + $object->propertyName = $this->propertyName; + } + if (!is_null($this->requestId)) { + $object->requestId = $this->requestId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'category')) { + $this->category = $object->category; + } + if (property_exists($object, 'code')) { + $this->code = $object->code; + } + if (property_exists($object, 'httpStatusCode')) { + $this->httpStatusCode = $object->httpStatusCode; + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'message')) { + $this->message = $object->message; + } + if (property_exists($object, 'propertyName')) { + $this->propertyName = $object->propertyName; + } + if (property_exists($object, 'requestId')) { + $this->requestId = $object->requestId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractBankTransferPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractBankTransferPaymentMethodSpecificInput.php new file mode 100644 index 0000000..0b4f7cd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractBankTransferPaymentMethodSpecificInput.php @@ -0,0 +1,45 @@ +additionalReference)) { + $object->additionalReference = $this->additionalReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalReference')) { + $this->additionalReference = $object->additionalReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractCardPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractCardPaymentMethodSpecificInput.php new file mode 100644 index 0000000..c21c4a9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractCardPaymentMethodSpecificInput.php @@ -0,0 +1,206 @@ +acquirerPromotionCode)) { + $object->acquirerPromotionCode = $this->acquirerPromotionCode; + } + if (!is_null($this->authorizationMode)) { + $object->authorizationMode = $this->authorizationMode; + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->initialSchemeTransactionId)) { + $object->initialSchemeTransactionId = $this->initialSchemeTransactionId; + } + if (!is_null($this->recurring)) { + $object->recurring = $this->recurring->toObject(); + } + if (!is_null($this->recurringPaymentSequenceIndicator)) { + $object->recurringPaymentSequenceIndicator = $this->recurringPaymentSequenceIndicator; + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->skipAuthentication)) { + $object->skipAuthentication = $this->skipAuthentication; + } + if (!is_null($this->skipFraudService)) { + $object->skipFraudService = $this->skipFraudService; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + if (!is_null($this->tokenize)) { + $object->tokenize = $this->tokenize; + } + if (!is_null($this->transactionChannel)) { + $object->transactionChannel = $this->transactionChannel; + } + if (!is_null($this->unscheduledCardOnFileIndicator)) { + $object->unscheduledCardOnFileIndicator = $this->unscheduledCardOnFileIndicator; + } + if (!is_null($this->unscheduledCardOnFileRequestor)) { + $object->unscheduledCardOnFileRequestor = $this->unscheduledCardOnFileRequestor; + } + if (!is_null($this->unscheduledCardOnFileSequenceIndicator)) { + $object->unscheduledCardOnFileSequenceIndicator = $this->unscheduledCardOnFileSequenceIndicator; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acquirerPromotionCode')) { + $this->acquirerPromotionCode = $object->acquirerPromotionCode; + } + if (property_exists($object, 'authorizationMode')) { + $this->authorizationMode = $object->authorizationMode; + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'initialSchemeTransactionId')) { + $this->initialSchemeTransactionId = $object->initialSchemeTransactionId; + } + if (property_exists($object, 'recurring')) { + if (!is_object($object->recurring)) { + throw new UnexpectedValueException('value \'' . print_r($object->recurring, true) . '\' is not an object'); + } + $value = new CardRecurrenceDetails(); + $this->recurring = $value->fromObject($object->recurring); + } + if (property_exists($object, 'recurringPaymentSequenceIndicator')) { + $this->recurringPaymentSequenceIndicator = $object->recurringPaymentSequenceIndicator; + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'skipAuthentication')) { + $this->skipAuthentication = $object->skipAuthentication; + } + if (property_exists($object, 'skipFraudService')) { + $this->skipFraudService = $object->skipFraudService; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + if (property_exists($object, 'tokenize')) { + $this->tokenize = $object->tokenize; + } + if (property_exists($object, 'transactionChannel')) { + $this->transactionChannel = $object->transactionChannel; + } + if (property_exists($object, 'unscheduledCardOnFileIndicator')) { + $this->unscheduledCardOnFileIndicator = $object->unscheduledCardOnFileIndicator; + } + if (property_exists($object, 'unscheduledCardOnFileRequestor')) { + $this->unscheduledCardOnFileRequestor = $object->unscheduledCardOnFileRequestor; + } + if (property_exists($object, 'unscheduledCardOnFileSequenceIndicator')) { + $this->unscheduledCardOnFileSequenceIndicator = $object->unscheduledCardOnFileSequenceIndicator; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractCashPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractCashPaymentMethodSpecificInput.php new file mode 100644 index 0000000..a2a730f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractCashPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractIndicator.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractIndicator.php new file mode 100644 index 0000000..fd39f6a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractIndicator.php @@ -0,0 +1,57 @@ +name)) { + $object->name = $this->name; + } + if (!is_null($this->value)) { + $object->value = $this->value; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'value')) { + $this->value = $object->value; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractOrderStatus.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractOrderStatus.php new file mode 100644 index 0000000..43ad93f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractOrderStatus.php @@ -0,0 +1,46 @@ +id)) { + $object->id = $this->id; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificInput.php new file mode 100644 index 0000000..b44d109 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificInput.php @@ -0,0 +1,46 @@ +paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..8c5252a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPaymentMethodSpecificOutput.php @@ -0,0 +1,46 @@ +paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractPayoutMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPayoutMethodSpecificInput.php new file mode 100644 index 0000000..96da6f6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractPayoutMethodSpecificInput.php @@ -0,0 +1,35 @@ +expirationPeriod)) { + $object->expirationPeriod = $this->expirationPeriod; + } + if (!is_null($this->recurringPaymentSequenceIndicator)) { + $object->recurringPaymentSequenceIndicator = $this->recurringPaymentSequenceIndicator; + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + if (!is_null($this->tokenize)) { + $object->tokenize = $this->tokenize; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'expirationPeriod')) { + $this->expirationPeriod = $object->expirationPeriod; + } + if (property_exists($object, 'recurringPaymentSequenceIndicator')) { + $this->recurringPaymentSequenceIndicator = $object->recurringPaymentSequenceIndicator; + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + if (property_exists($object, 'tokenize')) { + $this->tokenize = $object->tokenize; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentProduct4101SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentProduct4101SpecificInput.php new file mode 100644 index 0000000..527181c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractRedirectPaymentProduct4101SpecificInput.php @@ -0,0 +1,35 @@ +addressSelectionAtPayPal)) { + $object->addressSelectionAtPayPal = $this->addressSelectionAtPayPal; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'addressSelectionAtPayPal')) { + $this->addressSelectionAtPayPal = $object->addressSelectionAtPayPal; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractSepaDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractSepaDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..b889727 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractSepaDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +mandateReference)) { + $object->mandateReference = $this->mandateReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandateReference')) { + $this->mandateReference = $object->mandateReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractThreeDSecure.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractThreeDSecure.php new file mode 100644 index 0000000..95151eb --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractThreeDSecure.php @@ -0,0 +1,146 @@ +authenticationAmount)) { + $object->authenticationAmount = $this->authenticationAmount->toObject(); + } + if (!is_null($this->authenticationFlow)) { + $object->authenticationFlow = $this->authenticationFlow; + } + if (!is_null($this->challengeCanvasSize)) { + $object->challengeCanvasSize = $this->challengeCanvasSize; + } + if (!is_null($this->challengeIndicator)) { + $object->challengeIndicator = $this->challengeIndicator; + } + if (!is_null($this->exemptionRequest)) { + $object->exemptionRequest = $this->exemptionRequest; + } + if (!is_null($this->priorThreeDSecureData)) { + $object->priorThreeDSecureData = $this->priorThreeDSecureData->toObject(); + } + if (!is_null($this->sdkData)) { + $object->sdkData = $this->sdkData->toObject(); + } + if (!is_null($this->skipAuthentication)) { + $object->skipAuthentication = $this->skipAuthentication; + } + if (!is_null($this->transactionRiskLevel)) { + $object->transactionRiskLevel = $this->transactionRiskLevel; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authenticationAmount')) { + if (!is_object($object->authenticationAmount)) { + throw new UnexpectedValueException('value \'' . print_r($object->authenticationAmount, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->authenticationAmount = $value->fromObject($object->authenticationAmount); + } + if (property_exists($object, 'authenticationFlow')) { + $this->authenticationFlow = $object->authenticationFlow; + } + if (property_exists($object, 'challengeCanvasSize')) { + $this->challengeCanvasSize = $object->challengeCanvasSize; + } + if (property_exists($object, 'challengeIndicator')) { + $this->challengeIndicator = $object->challengeIndicator; + } + if (property_exists($object, 'exemptionRequest')) { + $this->exemptionRequest = $object->exemptionRequest; + } + if (property_exists($object, 'priorThreeDSecureData')) { + if (!is_object($object->priorThreeDSecureData)) { + throw new UnexpectedValueException('value \'' . print_r($object->priorThreeDSecureData, true) . '\' is not an object'); + } + $value = new ThreeDSecureData(); + $this->priorThreeDSecureData = $value->fromObject($object->priorThreeDSecureData); + } + if (property_exists($object, 'sdkData')) { + if (!is_object($object->sdkData)) { + throw new UnexpectedValueException('value \'' . print_r($object->sdkData, true) . '\' is not an object'); + } + $value = new SdkDataInput(); + $this->sdkData = $value->fromObject($object->sdkData); + } + if (property_exists($object, 'skipAuthentication')) { + $this->skipAuthentication = $object->skipAuthentication; + } + if (property_exists($object, 'transactionRiskLevel')) { + $this->transactionRiskLevel = $object->transactionRiskLevel; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AbstractToken.php b/src/Worldline/Connect/Sdk/V1/Domain/AbstractToken.php new file mode 100644 index 0000000..4535ccd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AbstractToken.php @@ -0,0 +1,46 @@ +alias)) { + $object->alias = $this->alias; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alias')) { + $this->alias = $object->alias; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AccountFundingRecipient.php b/src/Worldline/Connect/Sdk/V1/Domain/AccountFundingRecipient.php new file mode 100644 index 0000000..30d5a17 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AccountFundingRecipient.php @@ -0,0 +1,109 @@ +accountNumber)) { + $object->accountNumber = $this->accountNumber; + } + if (!is_null($this->accountNumberType)) { + $object->accountNumberType = $this->accountNumberType; + } + if (!is_null($this->address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->dateOfBirth)) { + $object->dateOfBirth = $this->dateOfBirth; + } + if (!is_null($this->name)) { + $object->name = $this->name->toObject(); + } + if (!is_null($this->partialPan)) { + $object->partialPan = $this->partialPan; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountNumber')) { + $this->accountNumber = $object->accountNumber; + } + if (property_exists($object, 'accountNumberType')) { + $this->accountNumberType = $object->accountNumberType; + } + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new Address(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'dateOfBirth')) { + $this->dateOfBirth = $object->dateOfBirth; + } + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new AfrName(); + $this->name = $value->fromObject($object->name); + } + if (property_exists($object, 'partialPan')) { + $this->partialPan = $object->partialPan; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFile.php b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFile.php new file mode 100644 index 0000000..986fcdc --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFile.php @@ -0,0 +1,95 @@ +attributes)) { + $object->attributes = []; + foreach ($this->attributes as $element) { + if (!is_null($element)) { + $object->attributes[] = $element->toObject(); + } + } + } + if (!is_null($this->displayHints)) { + $object->displayHints = $this->displayHints->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'attributes')) { + if (!is_array($object->attributes) && !is_object($object->attributes)) { + throw new UnexpectedValueException('value \'' . print_r($object->attributes, true) . '\' is not an array or object'); + } + $this->attributes = []; + foreach ($object->attributes as $element) { + $value = new AccountOnFileAttribute(); + $this->attributes[] = $value->fromObject($element); + } + } + if (property_exists($object, 'displayHints')) { + if (!is_object($object->displayHints)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); + } + $value = new AccountOnFileDisplayHints(); + $this->displayHints = $value->fromObject($object->displayHints); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileAttribute.php b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileAttribute.php new file mode 100644 index 0000000..c3f2d12 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileAttribute.php @@ -0,0 +1,56 @@ +mustWriteReason)) { + $object->mustWriteReason = $this->mustWriteReason; + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mustWriteReason')) { + $this->mustWriteReason = $object->mustWriteReason; + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileDisplayHints.php b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileDisplayHints.php new file mode 100644 index 0000000..fea3ca4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AccountOnFileDisplayHints.php @@ -0,0 +1,69 @@ +labelTemplate)) { + $object->labelTemplate = []; + foreach ($this->labelTemplate as $element) { + if (!is_null($element)) { + $object->labelTemplate[] = $element->toObject(); + } + } + } + if (!is_null($this->logo)) { + $object->logo = $this->logo; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'labelTemplate')) { + if (!is_array($object->labelTemplate) && !is_object($object->labelTemplate)) { + throw new UnexpectedValueException('value \'' . print_r($object->labelTemplate, true) . '\' is not an array or object'); + } + $this->labelTemplate = []; + foreach ($object->labelTemplate as $element) { + $value = new LabelTemplateElement(); + $this->labelTemplate[] = $value->fromObject($element); + } + } + if (property_exists($object, 'logo')) { + $this->logo = $object->logo; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInput.php b/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInput.php new file mode 100644 index 0000000..92dd0e1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInput.php @@ -0,0 +1,165 @@ +accountFundingRecipient)) { + $object->accountFundingRecipient = $this->accountFundingRecipient->toObject(); + } + if (!is_null($this->airlineData)) { + $object->airlineData = $this->airlineData->toObject(); + } + if (!is_null($this->installments)) { + $object->installments = $this->installments->toObject(); + } + if (!is_null($this->level3SummaryData)) { + $object->level3SummaryData = $this->level3SummaryData->toObject(); + } + if (!is_null($this->loanRecipient)) { + $object->loanRecipient = $this->loanRecipient->toObject(); + } + if (!is_null($this->lodgingData)) { + $object->lodgingData = $this->lodgingData->toObject(); + } + if (!is_null($this->numberOfInstallments)) { + $object->numberOfInstallments = $this->numberOfInstallments; + } + if (!is_null($this->orderDate)) { + $object->orderDate = $this->orderDate; + } + if (!is_null($this->typeInformation)) { + $object->typeInformation = $this->typeInformation->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountFundingRecipient')) { + if (!is_object($object->accountFundingRecipient)) { + throw new UnexpectedValueException('value \'' . print_r($object->accountFundingRecipient, true) . '\' is not an object'); + } + $value = new AccountFundingRecipient(); + $this->accountFundingRecipient = $value->fromObject($object->accountFundingRecipient); + } + if (property_exists($object, 'airlineData')) { + if (!is_object($object->airlineData)) { + throw new UnexpectedValueException('value \'' . print_r($object->airlineData, true) . '\' is not an object'); + } + $value = new AirlineData(); + $this->airlineData = $value->fromObject($object->airlineData); + } + if (property_exists($object, 'installments')) { + if (!is_object($object->installments)) { + throw new UnexpectedValueException('value \'' . print_r($object->installments, true) . '\' is not an object'); + } + $value = new Installments(); + $this->installments = $value->fromObject($object->installments); + } + if (property_exists($object, 'level3SummaryData')) { + if (!is_object($object->level3SummaryData)) { + throw new UnexpectedValueException('value \'' . print_r($object->level3SummaryData, true) . '\' is not an object'); + } + $value = new Level3SummaryData(); + $this->level3SummaryData = $value->fromObject($object->level3SummaryData); + } + if (property_exists($object, 'loanRecipient')) { + if (!is_object($object->loanRecipient)) { + throw new UnexpectedValueException('value \'' . print_r($object->loanRecipient, true) . '\' is not an object'); + } + $value = new LoanRecipient(); + $this->loanRecipient = $value->fromObject($object->loanRecipient); + } + if (property_exists($object, 'lodgingData')) { + if (!is_object($object->lodgingData)) { + throw new UnexpectedValueException('value \'' . print_r($object->lodgingData, true) . '\' is not an object'); + } + $value = new LodgingData(); + $this->lodgingData = $value->fromObject($object->lodgingData); + } + if (property_exists($object, 'numberOfInstallments')) { + $this->numberOfInstallments = $object->numberOfInstallments; + } + if (property_exists($object, 'orderDate')) { + $this->orderDate = $object->orderDate; + } + if (property_exists($object, 'typeInformation')) { + if (!is_object($object->typeInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->typeInformation, true) . '\' is not an object'); + } + $value = new OrderTypeInformation(); + $this->typeInformation = $value->fromObject($object->typeInformation); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInputAirlineData.php b/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInputAirlineData.php new file mode 100644 index 0000000..e7742a8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AdditionalOrderInputAirlineData.php @@ -0,0 +1,65 @@ +airlineData)) { + $object->airlineData = $this->airlineData->toObject(); + } + if (!is_null($this->lodgingData)) { + $object->lodgingData = $this->lodgingData->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'airlineData')) { + if (!is_object($object->airlineData)) { + throw new UnexpectedValueException('value \'' . print_r($object->airlineData, true) . '\' is not an object'); + } + $value = new AirlineData(); + $this->airlineData = $value->fromObject($object->airlineData); + } + if (property_exists($object, 'lodgingData')) { + if (!is_object($object->lodgingData)) { + throw new UnexpectedValueException('value \'' . print_r($object->lodgingData, true) . '\' is not an object'); + } + $value = new LodgingData(); + $this->lodgingData = $value->fromObject($object->lodgingData); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Address.php b/src/Worldline/Connect/Sdk/V1/Domain/Address.php new file mode 100644 index 0000000..6ad5455 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Address.php @@ -0,0 +1,123 @@ +additionalInfo)) { + $object->additionalInfo = $this->additionalInfo; + } + if (!is_null($this->city)) { + $object->city = $this->city; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->houseNumber)) { + $object->houseNumber = $this->houseNumber; + } + if (!is_null($this->state)) { + $object->state = $this->state; + } + if (!is_null($this->stateCode)) { + $object->stateCode = $this->stateCode; + } + if (!is_null($this->street)) { + $object->street = $this->street; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalInfo')) { + $this->additionalInfo = $object->additionalInfo; + } + if (property_exists($object, 'city')) { + $this->city = $object->city; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'houseNumber')) { + $this->houseNumber = $object->houseNumber; + } + if (property_exists($object, 'state')) { + $this->state = $object->state; + } + if (property_exists($object, 'stateCode')) { + $this->stateCode = $object->stateCode; + } + if (property_exists($object, 'street')) { + $this->street = $object->street; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AddressPersonal.php b/src/Worldline/Connect/Sdk/V1/Domain/AddressPersonal.php new file mode 100644 index 0000000..5799d85 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AddressPersonal.php @@ -0,0 +1,49 @@ +name)) { + $object->name = $this->name->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new PersonalName(); + $this->name = $value->fromObject($object->name); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AfrName.php b/src/Worldline/Connect/Sdk/V1/Domain/AfrName.php new file mode 100644 index 0000000..bfb57e7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AfrName.php @@ -0,0 +1,57 @@ +firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AirlineData.php b/src/Worldline/Connect/Sdk/V1/Domain/AirlineData.php new file mode 100644 index 0000000..4193ed2 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AirlineData.php @@ -0,0 +1,335 @@ +agentNumericCode)) { + $object->agentNumericCode = $this->agentNumericCode; + } + if (!is_null($this->code)) { + $object->code = $this->code; + } + if (!is_null($this->flightDate)) { + $object->flightDate = $this->flightDate; + } + if (!is_null($this->flightLegs)) { + $object->flightLegs = []; + foreach ($this->flightLegs as $element) { + if (!is_null($element)) { + $object->flightLegs[] = $element->toObject(); + } + } + } + if (!is_null($this->invoiceNumber)) { + $object->invoiceNumber = $this->invoiceNumber; + } + if (!is_null($this->isETicket)) { + $object->isETicket = $this->isETicket; + } + if (!is_null($this->isRegisteredCustomer)) { + $object->isRegisteredCustomer = $this->isRegisteredCustomer; + } + if (!is_null($this->isRestrictedTicket)) { + $object->isRestrictedTicket = $this->isRestrictedTicket; + } + if (!is_null($this->isThirdParty)) { + $object->isThirdParty = $this->isThirdParty; + } + if (!is_null($this->issueDate)) { + $object->issueDate = $this->issueDate; + } + if (!is_null($this->merchantCustomerId)) { + $object->merchantCustomerId = $this->merchantCustomerId; + } + if (!is_null($this->name)) { + $object->name = $this->name; + } + if (!is_null($this->numberInParty)) { + $object->numberInParty = $this->numberInParty; + } + if (!is_null($this->passengerName)) { + $object->passengerName = $this->passengerName; + } + if (!is_null($this->passengers)) { + $object->passengers = []; + foreach ($this->passengers as $element) { + if (!is_null($element)) { + $object->passengers[] = $element->toObject(); + } + } + } + if (!is_null($this->placeOfIssue)) { + $object->placeOfIssue = $this->placeOfIssue; + } + if (!is_null($this->pnr)) { + $object->pnr = $this->pnr; + } + if (!is_null($this->pointOfSale)) { + $object->pointOfSale = $this->pointOfSale; + } + if (!is_null($this->posCityCode)) { + $object->posCityCode = $this->posCityCode; + } + if (!is_null($this->ticketDeliveryMethod)) { + $object->ticketDeliveryMethod = $this->ticketDeliveryMethod; + } + if (!is_null($this->ticketNumber)) { + $object->ticketNumber = $this->ticketNumber; + } + if (!is_null($this->totalFare)) { + $object->totalFare = $this->totalFare; + } + if (!is_null($this->totalFee)) { + $object->totalFee = $this->totalFee; + } + if (!is_null($this->totalTaxes)) { + $object->totalTaxes = $this->totalTaxes; + } + if (!is_null($this->travelAgencyName)) { + $object->travelAgencyName = $this->travelAgencyName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'agentNumericCode')) { + $this->agentNumericCode = $object->agentNumericCode; + } + if (property_exists($object, 'code')) { + $this->code = $object->code; + } + if (property_exists($object, 'flightDate')) { + $this->flightDate = $object->flightDate; + } + if (property_exists($object, 'flightLegs')) { + if (!is_array($object->flightLegs) && !is_object($object->flightLegs)) { + throw new UnexpectedValueException('value \'' . print_r($object->flightLegs, true) . '\' is not an array or object'); + } + $this->flightLegs = []; + foreach ($object->flightLegs as $element) { + $value = new AirlineFlightLeg(); + $this->flightLegs[] = $value->fromObject($element); + } + } + if (property_exists($object, 'invoiceNumber')) { + $this->invoiceNumber = $object->invoiceNumber; + } + if (property_exists($object, 'isETicket')) { + $this->isETicket = $object->isETicket; + } + if (property_exists($object, 'isRegisteredCustomer')) { + $this->isRegisteredCustomer = $object->isRegisteredCustomer; + } + if (property_exists($object, 'isRestrictedTicket')) { + $this->isRestrictedTicket = $object->isRestrictedTicket; + } + if (property_exists($object, 'isThirdParty')) { + $this->isThirdParty = $object->isThirdParty; + } + if (property_exists($object, 'issueDate')) { + $this->issueDate = $object->issueDate; + } + if (property_exists($object, 'merchantCustomerId')) { + $this->merchantCustomerId = $object->merchantCustomerId; + } + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'numberInParty')) { + $this->numberInParty = $object->numberInParty; + } + if (property_exists($object, 'passengerName')) { + $this->passengerName = $object->passengerName; + } + if (property_exists($object, 'passengers')) { + if (!is_array($object->passengers) && !is_object($object->passengers)) { + throw new UnexpectedValueException('value \'' . print_r($object->passengers, true) . '\' is not an array or object'); + } + $this->passengers = []; + foreach ($object->passengers as $element) { + $value = new AirlinePassenger(); + $this->passengers[] = $value->fromObject($element); + } + } + if (property_exists($object, 'placeOfIssue')) { + $this->placeOfIssue = $object->placeOfIssue; + } + if (property_exists($object, 'pnr')) { + $this->pnr = $object->pnr; + } + if (property_exists($object, 'pointOfSale')) { + $this->pointOfSale = $object->pointOfSale; + } + if (property_exists($object, 'posCityCode')) { + $this->posCityCode = $object->posCityCode; + } + if (property_exists($object, 'ticketDeliveryMethod')) { + $this->ticketDeliveryMethod = $object->ticketDeliveryMethod; + } + if (property_exists($object, 'ticketNumber')) { + $this->ticketNumber = $object->ticketNumber; + } + if (property_exists($object, 'totalFare')) { + $this->totalFare = $object->totalFare; + } + if (property_exists($object, 'totalFee')) { + $this->totalFee = $object->totalFee; + } + if (property_exists($object, 'totalTaxes')) { + $this->totalTaxes = $object->totalTaxes; + } + if (property_exists($object, 'travelAgencyName')) { + $this->travelAgencyName = $object->travelAgencyName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AirlineFlightLeg.php b/src/Worldline/Connect/Sdk/V1/Domain/AirlineFlightLeg.php new file mode 100644 index 0000000..1838ed5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AirlineFlightLeg.php @@ -0,0 +1,256 @@ +airlineClass)) { + $object->airlineClass = $this->airlineClass; + } + if (!is_null($this->arrivalAirport)) { + $object->arrivalAirport = $this->arrivalAirport; + } + if (!is_null($this->arrivalTime)) { + $object->arrivalTime = $this->arrivalTime; + } + if (!is_null($this->carrierCode)) { + $object->carrierCode = $this->carrierCode; + } + if (!is_null($this->conjunctionTicket)) { + $object->conjunctionTicket = $this->conjunctionTicket; + } + if (!is_null($this->couponNumber)) { + $object->couponNumber = $this->couponNumber; + } + if (!is_null($this->date)) { + $object->date = $this->date; + } + if (!is_null($this->departureTime)) { + $object->departureTime = $this->departureTime; + } + if (!is_null($this->endorsementOrRestriction)) { + $object->endorsementOrRestriction = $this->endorsementOrRestriction; + } + if (!is_null($this->exchangeTicket)) { + $object->exchangeTicket = $this->exchangeTicket; + } + if (!is_null($this->fare)) { + $object->fare = $this->fare; + } + if (!is_null($this->fareBasis)) { + $object->fareBasis = $this->fareBasis; + } + if (!is_null($this->fee)) { + $object->fee = $this->fee; + } + if (!is_null($this->flightNumber)) { + $object->flightNumber = $this->flightNumber; + } + if (!is_null($this->number)) { + $object->number = $this->number; + } + if (!is_null($this->originAirport)) { + $object->originAirport = $this->originAirport; + } + if (!is_null($this->passengerClass)) { + $object->passengerClass = $this->passengerClass; + } + if (!is_null($this->serviceClass)) { + $object->serviceClass = $this->serviceClass; + } + if (!is_null($this->stopoverCode)) { + $object->stopoverCode = $this->stopoverCode; + } + if (!is_null($this->taxes)) { + $object->taxes = $this->taxes; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'airlineClass')) { + $this->airlineClass = $object->airlineClass; + } + if (property_exists($object, 'arrivalAirport')) { + $this->arrivalAirport = $object->arrivalAirport; + } + if (property_exists($object, 'arrivalTime')) { + $this->arrivalTime = $object->arrivalTime; + } + if (property_exists($object, 'carrierCode')) { + $this->carrierCode = $object->carrierCode; + } + if (property_exists($object, 'conjunctionTicket')) { + $this->conjunctionTicket = $object->conjunctionTicket; + } + if (property_exists($object, 'couponNumber')) { + $this->couponNumber = $object->couponNumber; + } + if (property_exists($object, 'date')) { + $this->date = $object->date; + } + if (property_exists($object, 'departureTime')) { + $this->departureTime = $object->departureTime; + } + if (property_exists($object, 'endorsementOrRestriction')) { + $this->endorsementOrRestriction = $object->endorsementOrRestriction; + } + if (property_exists($object, 'exchangeTicket')) { + $this->exchangeTicket = $object->exchangeTicket; + } + if (property_exists($object, 'fare')) { + $this->fare = $object->fare; + } + if (property_exists($object, 'fareBasis')) { + $this->fareBasis = $object->fareBasis; + } + if (property_exists($object, 'fee')) { + $this->fee = $object->fee; + } + if (property_exists($object, 'flightNumber')) { + $this->flightNumber = $object->flightNumber; + } + if (property_exists($object, 'number')) { + $this->number = $object->number; + } + if (property_exists($object, 'originAirport')) { + $this->originAirport = $object->originAirport; + } + if (property_exists($object, 'passengerClass')) { + $this->passengerClass = $object->passengerClass; + } + if (property_exists($object, 'serviceClass')) { + $this->serviceClass = $object->serviceClass; + } + if (property_exists($object, 'stopoverCode')) { + $this->stopoverCode = $object->stopoverCode; + } + if (property_exists($object, 'taxes')) { + $this->taxes = $object->taxes; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AirlinePassenger.php b/src/Worldline/Connect/Sdk/V1/Domain/AirlinePassenger.php new file mode 100644 index 0000000..9a9e59e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AirlinePassenger.php @@ -0,0 +1,79 @@ +firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->surnamePrefix)) { + $object->surnamePrefix = $this->surnamePrefix; + } + if (!is_null($this->title)) { + $object->title = $this->title; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'surnamePrefix')) { + $this->surnamePrefix = $object->surnamePrefix; + } + if (property_exists($object, 'title')) { + $this->title = $object->title; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AmountBreakdown.php b/src/Worldline/Connect/Sdk/V1/Domain/AmountBreakdown.php new file mode 100644 index 0000000..4116ba3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AmountBreakdown.php @@ -0,0 +1,57 @@ +amount)) { + $object->amount = $this->amount; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amount')) { + $this->amount = $object->amount; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/AmountOfMoney.php b/src/Worldline/Connect/Sdk/V1/Domain/AmountOfMoney.php new file mode 100644 index 0000000..fc67ba1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/AmountOfMoney.php @@ -0,0 +1,57 @@ +amount)) { + $object->amount = $this->amount; + } + if (!is_null($this->currencyCode)) { + $object->currencyCode = $this->currencyCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amount')) { + $this->amount = $object->amount; + } + if (property_exists($object, 'currencyCode')) { + $this->currencyCode = $object->currencyCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentCardPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentCardPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..442bddd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentCardPaymentMethodSpecificOutput.php @@ -0,0 +1,46 @@ +voidResponseId)) { + $object->voidResponseId = $this->voidResponseId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'voidResponseId')) { + $this->voidResponseId = $object->voidResponseId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..e7a7e73 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +voidResponseId)) { + $object->voidResponseId = $this->voidResponseId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'voidResponseId')) { + $this->voidResponseId = $object->voidResponseId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..95754ad --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +dateCollect)) { + $object->dateCollect = $this->dateCollect; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dateCollect')) { + $this->dateCollect = $object->dateCollect; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentRequest.php new file mode 100644 index 0000000..7b39c6a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentRequest.php @@ -0,0 +1,91 @@ +amount)) { + $object->amount = $this->amount; + } + if (!is_null($this->directDebitPaymentMethodSpecificInput)) { + $object->directDebitPaymentMethodSpecificInput = $this->directDebitPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->order)) { + $object->order = $this->order->toObject(); + } + if (!is_null($this->sepaDirectDebitPaymentMethodSpecificInput)) { + $object->sepaDirectDebitPaymentMethodSpecificInput = $this->sepaDirectDebitPaymentMethodSpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amount')) { + $this->amount = $object->amount; + } + if (property_exists($object, 'directDebitPaymentMethodSpecificInput')) { + if (!is_object($object->directDebitPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput(); + $this->directDebitPaymentMethodSpecificInput = $value->fromObject($object->directDebitPaymentMethodSpecificInput); + } + if (property_exists($object, 'order')) { + if (!is_object($object->order)) { + throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); + } + $value = new OrderApprovePayment(); + $this->order = $value->fromObject($object->order); + } + if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificInput')) { + if (!is_object($object->sepaDirectDebitPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput(); + $this->sepaDirectDebitPaymentMethodSpecificInput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..b992d40 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +datePayout)) { + $object->datePayout = $this->datePayout; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'datePayout')) { + $this->datePayout = $object->datePayout; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApproveRefundRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/ApproveRefundRequest.php new file mode 100644 index 0000000..7631c1c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApproveRefundRequest.php @@ -0,0 +1,46 @@ +amount)) { + $object->amount = $this->amount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amount')) { + $this->amount = $object->amount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ApproveTokenRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/ApproveTokenRequest.php new file mode 100644 index 0000000..fd0b10f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ApproveTokenRequest.php @@ -0,0 +1,34 @@ +accountHolderName)) { + $object->accountHolderName = $this->accountHolderName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountHolderName')) { + $this->accountHolderName = $object->accountHolderName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBban.php b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBban.php new file mode 100644 index 0000000..228a0d7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBban.php @@ -0,0 +1,100 @@ +accountNumber)) { + $object->accountNumber = $this->accountNumber; + } + if (!is_null($this->bankCode)) { + $object->bankCode = $this->bankCode; + } + if (!is_null($this->bankName)) { + $object->bankName = $this->bankName; + } + if (!is_null($this->branchCode)) { + $object->branchCode = $this->branchCode; + } + if (!is_null($this->checkDigit)) { + $object->checkDigit = $this->checkDigit; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountNumber')) { + $this->accountNumber = $object->accountNumber; + } + if (property_exists($object, 'bankCode')) { + $this->bankCode = $object->bankCode; + } + if (property_exists($object, 'bankName')) { + $this->bankName = $object->bankName; + } + if (property_exists($object, 'branchCode')) { + $this->branchCode = $object->branchCode; + } + if (property_exists($object, 'checkDigit')) { + $this->checkDigit = $object->checkDigit; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBbanRefund.php b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBbanRefund.php new file mode 100644 index 0000000..c6c6efe --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountBbanRefund.php @@ -0,0 +1,67 @@ +bankCity)) { + $object->bankCity = $this->bankCity; + } + if (!is_null($this->patronymicName)) { + $object->patronymicName = $this->patronymicName; + } + if (!is_null($this->swiftCode)) { + $object->swiftCode = $this->swiftCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankCity')) { + $this->bankCity = $object->bankCity; + } + if (property_exists($object, 'patronymicName')) { + $this->patronymicName = $object->patronymicName; + } + if (property_exists($object, 'swiftCode')) { + $this->swiftCode = $object->swiftCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankAccountIban.php b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountIban.php new file mode 100644 index 0000000..f1024da --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankAccountIban.php @@ -0,0 +1,45 @@ +iban)) { + $object->iban = $this->iban; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'iban')) { + $this->iban = $object->iban; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankData.php b/src/Worldline/Connect/Sdk/V1/Domain/BankData.php new file mode 100644 index 0000000..3e4c22c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankData.php @@ -0,0 +1,79 @@ +newBankName)) { + $object->newBankName = $this->newBankName; + } + if (!is_null($this->reformattedAccountNumber)) { + $object->reformattedAccountNumber = $this->reformattedAccountNumber; + } + if (!is_null($this->reformattedBankCode)) { + $object->reformattedBankCode = $this->reformattedBankCode; + } + if (!is_null($this->reformattedBranchCode)) { + $object->reformattedBranchCode = $this->reformattedBranchCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'newBankName')) { + $this->newBankName = $object->newBankName; + } + if (property_exists($object, 'reformattedAccountNumber')) { + $this->reformattedAccountNumber = $object->reformattedAccountNumber; + } + if (property_exists($object, 'reformattedBankCode')) { + $this->reformattedBankCode = $object->reformattedBankCode; + } + if (property_exists($object, 'reformattedBranchCode')) { + $this->reformattedBranchCode = $object->reformattedBranchCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/BankDetails.php new file mode 100644 index 0000000..7846f4e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankDetails.php @@ -0,0 +1,65 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankDetailsRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/BankDetailsRequest.php new file mode 100644 index 0000000..ac2c0f0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankDetailsRequest.php @@ -0,0 +1,34 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->bankData)) { + $object->bankData = $this->bankData->toObject(); + } + if (!is_null($this->swift)) { + $object->swift = $this->swift->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'bankData')) { + if (!is_object($object->bankData)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankData, true) . '\' is not an object'); + } + $value = new BankData(); + $this->bankData = $value->fromObject($object->bankData); + } + if (property_exists($object, 'swift')) { + if (!is_object($object->swift)) { + throw new UnexpectedValueException('value \'' . print_r($object->swift, true) . '\' is not an object'); + } + $value = new Swift(); + $this->swift = $value->fromObject($object->swift); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankRefundMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/BankRefundMethodSpecificInput.php new file mode 100644 index 0000000..80927eb --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankRefundMethodSpecificInput.php @@ -0,0 +1,76 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBbanRefund(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificInput.php new file mode 100644 index 0000000..7c1ebe5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPaymentMethodSpecificInput.php @@ -0,0 +1,34 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPayoutMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPayoutMethodSpecificInput.php new file mode 100644 index 0000000..6b53c68 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BankTransferPayoutMethodSpecificInput.php @@ -0,0 +1,113 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->payoutDate)) { + $object->payoutDate = $this->payoutDate; + } + if (!is_null($this->payoutText)) { + $object->payoutText = $this->payoutText; + } + if (!is_null($this->swiftCode)) { + $object->swiftCode = $this->swiftCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new PayoutCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'payoutDate')) { + $this->payoutDate = $object->payoutDate; + } + if (property_exists($object, 'payoutText')) { + $this->payoutText = $object->payoutText; + } + if (property_exists($object, 'swiftCode')) { + $this->swiftCode = $object->swiftCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BoletoBancarioRequirednessValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/BoletoBancarioRequirednessValidator.php new file mode 100644 index 0000000..39bd226 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BoletoBancarioRequirednessValidator.php @@ -0,0 +1,46 @@ +fiscalNumberLength)) { + $object->fiscalNumberLength = $this->fiscalNumberLength; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fiscalNumberLength')) { + $this->fiscalNumberLength = $object->fiscalNumberLength; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/BrowserData.php b/src/Worldline/Connect/Sdk/V1/Domain/BrowserData.php new file mode 100644 index 0000000..e7413fe --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/BrowserData.php @@ -0,0 +1,112 @@ +colorDepth)) { + $object->colorDepth = $this->colorDepth; + } + if (!is_null($this->innerHeight)) { + $object->innerHeight = $this->innerHeight; + } + if (!is_null($this->innerWidth)) { + $object->innerWidth = $this->innerWidth; + } + if (!is_null($this->javaEnabled)) { + $object->javaEnabled = $this->javaEnabled; + } + if (!is_null($this->javaScriptEnabled)) { + $object->javaScriptEnabled = $this->javaScriptEnabled; + } + if (!is_null($this->screenHeight)) { + $object->screenHeight = $this->screenHeight; + } + if (!is_null($this->screenWidth)) { + $object->screenWidth = $this->screenWidth; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'colorDepth')) { + $this->colorDepth = $object->colorDepth; + } + if (property_exists($object, 'innerHeight')) { + $this->innerHeight = $object->innerHeight; + } + if (property_exists($object, 'innerWidth')) { + $this->innerWidth = $object->innerWidth; + } + if (property_exists($object, 'javaEnabled')) { + $this->javaEnabled = $object->javaEnabled; + } + if (property_exists($object, 'javaScriptEnabled')) { + $this->javaScriptEnabled = $object->javaScriptEnabled; + } + if (property_exists($object, 'screenHeight')) { + $this->screenHeight = $object->screenHeight; + } + if (property_exists($object, 'screenWidth')) { + $this->screenWidth = $object->screenWidth; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CancelApprovalPaymentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CancelApprovalPaymentResponse.php new file mode 100644 index 0000000..106bce3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CancelApprovalPaymentResponse.php @@ -0,0 +1,50 @@ +payment)) { + $object->payment = $this->payment->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new Payment(); + $this->payment = $value->fromObject($object->payment); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentCardPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentCardPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..2024e71 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentCardPaymentMethodSpecificOutput.php @@ -0,0 +1,46 @@ +voidResponseId)) { + $object->voidResponseId = $this->voidResponseId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'voidResponseId')) { + $this->voidResponseId = $object->voidResponseId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentMobilePaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentMobilePaymentMethodSpecificOutput.php new file mode 100644 index 0000000..eae0fe8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentMobilePaymentMethodSpecificOutput.php @@ -0,0 +1,46 @@ +voidResponseId)) { + $object->voidResponseId = $this->voidResponseId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'voidResponseId')) { + $this->voidResponseId = $object->voidResponseId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentResponse.php new file mode 100644 index 0000000..076d77d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CancelPaymentResponse.php @@ -0,0 +1,80 @@ +cardPaymentMethodSpecificOutput)) { + $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificOutput)) { + $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->payment)) { + $object->payment = $this->payment->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { + if (!is_object($object->cardPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CancelPaymentCardPaymentMethodSpecificOutput(); + $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); + } + if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { + if (!is_object($object->mobilePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CancelPaymentMobilePaymentMethodSpecificOutput(); + $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); + } + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new Payment(); + $this->payment = $value->fromObject($object->payment); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Capture.php b/src/Worldline/Connect/Sdk/V1/Domain/Capture.php new file mode 100644 index 0000000..9147e09 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Capture.php @@ -0,0 +1,75 @@ +captureOutput)) { + $object->captureOutput = $this->captureOutput->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->statusOutput)) { + $object->statusOutput = $this->statusOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'captureOutput')) { + if (!is_object($object->captureOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->captureOutput, true) . '\' is not an object'); + } + $value = new CaptureOutput(); + $this->captureOutput = $value->fromObject($object->captureOutput); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'statusOutput')) { + if (!is_object($object->statusOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); + } + $value = new CaptureStatusOutput(); + $this->statusOutput = $value->fromObject($object->statusOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CaptureOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/CaptureOutput.php new file mode 100644 index 0000000..5c00610 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CaptureOutput.php @@ -0,0 +1,213 @@ +amountPaid)) { + $object->amountPaid = $this->amountPaid; + } + if (!is_null($this->amountReversed)) { + $object->amountReversed = $this->amountReversed; + } + if (!is_null($this->bankTransferPaymentMethodSpecificOutput)) { + $object->bankTransferPaymentMethodSpecificOutput = $this->bankTransferPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->cardPaymentMethodSpecificOutput)) { + $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->cashPaymentMethodSpecificOutput)) { + $object->cashPaymentMethodSpecificOutput = $this->cashPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->directDebitPaymentMethodSpecificOutput)) { + $object->directDebitPaymentMethodSpecificOutput = $this->directDebitPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->eInvoicePaymentMethodSpecificOutput)) { + $object->eInvoicePaymentMethodSpecificOutput = $this->eInvoicePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->invoicePaymentMethodSpecificOutput)) { + $object->invoicePaymentMethodSpecificOutput = $this->invoicePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificOutput)) { + $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->paymentMethod)) { + $object->paymentMethod = $this->paymentMethod; + } + if (!is_null($this->redirectPaymentMethodSpecificOutput)) { + $object->redirectPaymentMethodSpecificOutput = $this->redirectPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->reversalReason)) { + $object->reversalReason = $this->reversalReason; + } + if (!is_null($this->sepaDirectDebitPaymentMethodSpecificOutput)) { + $object->sepaDirectDebitPaymentMethodSpecificOutput = $this->sepaDirectDebitPaymentMethodSpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountPaid')) { + $this->amountPaid = $object->amountPaid; + } + if (property_exists($object, 'amountReversed')) { + $this->amountReversed = $object->amountReversed; + } + if (property_exists($object, 'bankTransferPaymentMethodSpecificOutput')) { + if (!is_object($object->bankTransferPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new BankTransferPaymentMethodSpecificOutput(); + $this->bankTransferPaymentMethodSpecificOutput = $value->fromObject($object->bankTransferPaymentMethodSpecificOutput); + } + if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { + if (!is_object($object->cardPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CardPaymentMethodSpecificOutput(); + $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); + } + if (property_exists($object, 'cashPaymentMethodSpecificOutput')) { + if (!is_object($object->cashPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CashPaymentMethodSpecificOutput(); + $this->cashPaymentMethodSpecificOutput = $value->fromObject($object->cashPaymentMethodSpecificOutput); + } + if (property_exists($object, 'directDebitPaymentMethodSpecificOutput')) { + if (!is_object($object->directDebitPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new NonSepaDirectDebitPaymentMethodSpecificOutput(); + $this->directDebitPaymentMethodSpecificOutput = $value->fromObject($object->directDebitPaymentMethodSpecificOutput); + } + if (property_exists($object, 'eInvoicePaymentMethodSpecificOutput')) { + if (!is_object($object->eInvoicePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentMethodSpecificOutput(); + $this->eInvoicePaymentMethodSpecificOutput = $value->fromObject($object->eInvoicePaymentMethodSpecificOutput); + } + if (property_exists($object, 'invoicePaymentMethodSpecificOutput')) { + if (!is_object($object->invoicePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->invoicePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new InvoicePaymentMethodSpecificOutput(); + $this->invoicePaymentMethodSpecificOutput = $value->fromObject($object->invoicePaymentMethodSpecificOutput); + } + if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { + if (!is_object($object->mobilePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new MobilePaymentMethodSpecificOutput(); + $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); + } + if (property_exists($object, 'paymentMethod')) { + $this->paymentMethod = $object->paymentMethod; + } + if (property_exists($object, 'redirectPaymentMethodSpecificOutput')) { + if (!is_object($object->redirectPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RedirectPaymentMethodSpecificOutput(); + $this->redirectPaymentMethodSpecificOutput = $value->fromObject($object->redirectPaymentMethodSpecificOutput); + } + if (property_exists($object, 'reversalReason')) { + $this->reversalReason = $object->reversalReason; + } + if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificOutput')) { + if (!is_object($object->sepaDirectDebitPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentMethodSpecificOutput(); + $this->sepaDirectDebitPaymentMethodSpecificOutput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CapturePaymentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CapturePaymentRequest.php new file mode 100644 index 0000000..94bbc99 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CapturePaymentRequest.php @@ -0,0 +1,57 @@ +amount)) { + $object->amount = $this->amount; + } + if (!is_null($this->isFinal)) { + $object->isFinal = $this->isFinal; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amount')) { + $this->amount = $object->amount; + } + if (property_exists($object, 'isFinal')) { + $this->isFinal = $object->isFinal; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CaptureResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CaptureResponse.php new file mode 100644 index 0000000..1415c53 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CaptureResponse.php @@ -0,0 +1,34 @@ +isRetriable)) { + $object->isRetriable = $this->isRetriable; + } + if (!is_null($this->providerRawOutput)) { + $object->providerRawOutput = []; + foreach ($this->providerRawOutput as $element) { + if (!is_null($element)) { + $object->providerRawOutput[] = $element->toObject(); + } + } + } + if (!is_null($this->statusCode)) { + $object->statusCode = $this->statusCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isRetriable')) { + $this->isRetriable = $object->isRetriable; + } + if (property_exists($object, 'providerRawOutput')) { + if (!is_array($object->providerRawOutput) && !is_object($object->providerRawOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->providerRawOutput, true) . '\' is not an array or object'); + } + $this->providerRawOutput = []; + foreach ($object->providerRawOutput as $element) { + $value = new KeyValuePair(); + $this->providerRawOutput[] = $value->fromObject($element); + } + } + if (property_exists($object, 'statusCode')) { + $this->statusCode = $object->statusCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CapturesResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CapturesResponse.php new file mode 100644 index 0000000..040c8af --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CapturesResponse.php @@ -0,0 +1,58 @@ +captures)) { + $object->captures = []; + foreach ($this->captures as $element) { + if (!is_null($element)) { + $object->captures[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'captures')) { + if (!is_array($object->captures) && !is_object($object->captures)) { + throw new UnexpectedValueException('value \'' . print_r($object->captures, true) . '\' is not an array or object'); + } + $this->captures = []; + foreach ($object->captures as $element) { + $value = new Capture(); + $this->captures[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Card.php b/src/Worldline/Connect/Sdk/V1/Domain/Card.php new file mode 100644 index 0000000..e6bcca6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Card.php @@ -0,0 +1,56 @@ +cvv)) { + $object->cvv = $this->cvv; + } + if (!is_null($this->partialPin)) { + $object->partialPin = $this->partialPin; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cvv')) { + $this->cvv = $object->cvv; + } + if (property_exists($object, 'partialPin')) { + $this->partialPin = $object->partialPin; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardEssentials.php b/src/Worldline/Connect/Sdk/V1/Domain/CardEssentials.php new file mode 100644 index 0000000..971ba44 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardEssentials.php @@ -0,0 +1,68 @@ +cardNumber)) { + $object->cardNumber = $this->cardNumber; + } + if (!is_null($this->cardholderName)) { + $object->cardholderName = $this->cardholderName; + } + if (!is_null($this->expiryDate)) { + $object->expiryDate = $this->expiryDate; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardNumber')) { + $this->cardNumber = $object->cardNumber; + } + if (property_exists($object, 'cardholderName')) { + $this->cardholderName = $object->cardholderName; + } + if (property_exists($object, 'expiryDate')) { + $this->expiryDate = $object->expiryDate; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardFraudResults.php b/src/Worldline/Connect/Sdk/V1/Domain/CardFraudResults.php new file mode 100644 index 0000000..b24f8d7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardFraudResults.php @@ -0,0 +1,86 @@ +avsResult)) { + $object->avsResult = $this->avsResult; + } + if (!is_null($this->cvvResult)) { + $object->cvvResult = $this->cvvResult; + } + if (!is_null($this->fraugster)) { + $object->fraugster = $this->fraugster->toObject(); + } + if (!is_null($this->retailDecisions)) { + $object->retailDecisions = $this->retailDecisions->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'avsResult')) { + $this->avsResult = $object->avsResult; + } + if (property_exists($object, 'cvvResult')) { + $this->cvvResult = $object->cvvResult; + } + if (property_exists($object, 'fraugster')) { + if (!is_object($object->fraugster)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraugster, true) . '\' is not an object'); + } + $value = new FraugsterResults(); + $this->fraugster = $value->fromObject($object->fraugster); + } + if (property_exists($object, 'retailDecisions')) { + if (!is_object($object->retailDecisions)) { + throw new UnexpectedValueException('value \'' . print_r($object->retailDecisions, true) . '\' is not an object'); + } + $value = new FraudResultsRetailDecisions(); + $this->retailDecisions = $value->fromObject($object->retailDecisions); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInput.php new file mode 100644 index 0000000..489d75e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInput.php @@ -0,0 +1,129 @@ +card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->externalCardholderAuthenticationData)) { + $object->externalCardholderAuthenticationData = $this->externalCardholderAuthenticationData->toObject(); + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->merchantInitiatedReasonIndicator)) { + $object->merchantInitiatedReasonIndicator = $this->merchantInitiatedReasonIndicator; + } + if (!is_null($this->networkTokenData)) { + $object->networkTokenData = $this->networkTokenData->toObject(); + } + if (!is_null($this->returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + if (!is_null($this->threeDSecure)) { + $object->threeDSecure = $this->threeDSecure->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new Card(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'externalCardholderAuthenticationData')) { + if (!is_object($object->externalCardholderAuthenticationData)) { + throw new UnexpectedValueException('value \'' . print_r($object->externalCardholderAuthenticationData, true) . '\' is not an object'); + } + $value = new ExternalCardholderAuthenticationData(); + $this->externalCardholderAuthenticationData = $value->fromObject($object->externalCardholderAuthenticationData); + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'merchantInitiatedReasonIndicator')) { + $this->merchantInitiatedReasonIndicator = $object->merchantInitiatedReasonIndicator; + } + if (property_exists($object, 'networkTokenData')) { + if (!is_object($object->networkTokenData)) { + throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); + } + $value = new SchemeTokenData(); + $this->networkTokenData = $value->fromObject($object->networkTokenData); + } + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + if (property_exists($object, 'threeDSecure')) { + if (!is_object($object->threeDSecure)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecure, true) . '\' is not an object'); + } + $value = new ThreeDSecure(); + $this->threeDSecure = $value->fromObject($object->threeDSecure); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInputBase.php new file mode 100644 index 0000000..f9a25b8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificInputBase.php @@ -0,0 +1,49 @@ +threeDSecure)) { + $object->threeDSecure = $this->threeDSecure->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'threeDSecure')) { + if (!is_object($object->threeDSecure)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecure, true) . '\' is not an object'); + } + $value = new ThreeDSecureBase(); + $this->threeDSecure = $value->fromObject($object->threeDSecure); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..7ad550b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardPaymentMethodSpecificOutput.php @@ -0,0 +1,123 @@ +authorisationCode)) { + $object->authorisationCode = $this->authorisationCode; + } + if (!is_null($this->card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + if (!is_null($this->initialSchemeTransactionId)) { + $object->initialSchemeTransactionId = $this->initialSchemeTransactionId; + } + if (!is_null($this->schemeTransactionId)) { + $object->schemeTransactionId = $this->schemeTransactionId; + } + if (!is_null($this->threeDSecureResults)) { + $object->threeDSecureResults = $this->threeDSecureResults->toObject(); + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorisationCode')) { + $this->authorisationCode = $object->authorisationCode; + } + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new CardEssentials(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new CardFraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + if (property_exists($object, 'initialSchemeTransactionId')) { + $this->initialSchemeTransactionId = $object->initialSchemeTransactionId; + } + if (property_exists($object, 'schemeTransactionId')) { + $this->schemeTransactionId = $object->schemeTransactionId; + } + if (property_exists($object, 'threeDSecureResults')) { + if (!is_object($object->threeDSecureResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecureResults, true) . '\' is not an object'); + } + $value = new ThreeDSecureResults(); + $this->threeDSecureResults = $value->fromObject($object->threeDSecureResults); + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardPayoutMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CardPayoutMethodSpecificInput.php new file mode 100644 index 0000000..7fb550d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardPayoutMethodSpecificInput.php @@ -0,0 +1,86 @@ +card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + if (!is_null($this->recipient)) { + $object->recipient = $this->recipient->toObject(); + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new Card(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + if (property_exists($object, 'recipient')) { + if (!is_object($object->recipient)) { + throw new UnexpectedValueException('value \'' . print_r($object->recipient, true) . '\' is not an object'); + } + $value = new PayoutRecipient(); + $this->recipient = $value->fromObject($object->recipient); + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardRecurrenceDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/CardRecurrenceDetails.php new file mode 100644 index 0000000..1fc8400 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardRecurrenceDetails.php @@ -0,0 +1,68 @@ +endDate)) { + $object->endDate = $this->endDate; + } + if (!is_null($this->minFrequency)) { + $object->minFrequency = $this->minFrequency; + } + if (!is_null($this->recurringPaymentSequenceIndicator)) { + $object->recurringPaymentSequenceIndicator = $this->recurringPaymentSequenceIndicator; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'endDate')) { + $this->endDate = $object->endDate; + } + if (property_exists($object, 'minFrequency')) { + $this->minFrequency = $object->minFrequency; + } + if (property_exists($object, 'recurringPaymentSequenceIndicator')) { + $this->recurringPaymentSequenceIndicator = $object->recurringPaymentSequenceIndicator; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CardWithoutCvv.php b/src/Worldline/Connect/Sdk/V1/Domain/CardWithoutCvv.php new file mode 100644 index 0000000..f7de5ba --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CardWithoutCvv.php @@ -0,0 +1,45 @@ +issueNumber)) { + $object->issueNumber = $this->issueNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'issueNumber')) { + $this->issueNumber = $object->issueNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInput.php new file mode 100644 index 0000000..44c6952 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInput.php @@ -0,0 +1,140 @@ +paymentProduct1503SpecificInput)) { + $object->paymentProduct1503SpecificInput = $this->paymentProduct1503SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1504SpecificInput)) { + $object->paymentProduct1504SpecificInput = $this->paymentProduct1504SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1521SpecificInput)) { + $object->paymentProduct1521SpecificInput = $this->paymentProduct1521SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1522SpecificInput)) { + $object->paymentProduct1522SpecificInput = $this->paymentProduct1522SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1523SpecificInput)) { + $object->paymentProduct1523SpecificInput = $this->paymentProduct1523SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1524SpecificInput)) { + $object->paymentProduct1524SpecificInput = $this->paymentProduct1524SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct1526SpecificInput)) { + $object->paymentProduct1526SpecificInput = $this->paymentProduct1526SpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct1503SpecificInput')) { + if (!is_object($object->paymentProduct1503SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1503SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1503SpecificInput(); + $this->paymentProduct1503SpecificInput = $value->fromObject($object->paymentProduct1503SpecificInput); + } + if (property_exists($object, 'paymentProduct1504SpecificInput')) { + if (!is_object($object->paymentProduct1504SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1504SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1504SpecificInput(); + $this->paymentProduct1504SpecificInput = $value->fromObject($object->paymentProduct1504SpecificInput); + } + if (property_exists($object, 'paymentProduct1521SpecificInput')) { + if (!is_object($object->paymentProduct1521SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1521SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1521SpecificInput(); + $this->paymentProduct1521SpecificInput = $value->fromObject($object->paymentProduct1521SpecificInput); + } + if (property_exists($object, 'paymentProduct1522SpecificInput')) { + if (!is_object($object->paymentProduct1522SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1522SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1522SpecificInput(); + $this->paymentProduct1522SpecificInput = $value->fromObject($object->paymentProduct1522SpecificInput); + } + if (property_exists($object, 'paymentProduct1523SpecificInput')) { + if (!is_object($object->paymentProduct1523SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1523SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1523SpecificInput(); + $this->paymentProduct1523SpecificInput = $value->fromObject($object->paymentProduct1523SpecificInput); + } + if (property_exists($object, 'paymentProduct1524SpecificInput')) { + if (!is_object($object->paymentProduct1524SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1524SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1524SpecificInput(); + $this->paymentProduct1524SpecificInput = $value->fromObject($object->paymentProduct1524SpecificInput); + } + if (property_exists($object, 'paymentProduct1526SpecificInput')) { + if (!is_object($object->paymentProduct1526SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct1526SpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentProduct1526SpecificInput(); + $this->paymentProduct1526SpecificInput = $value->fromObject($object->paymentProduct1526SpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInputBase.php new file mode 100644 index 0000000..5c90fe9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentMethodSpecificInputBase.php @@ -0,0 +1,34 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1503SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1503SpecificInput.php new file mode 100644 index 0000000..318202a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1503SpecificInput.php @@ -0,0 +1,48 @@ +returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1504SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1504SpecificInput.php new file mode 100644 index 0000000..873d4b8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CashPaymentProduct1504SpecificInput.php @@ -0,0 +1,34 @@ +returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CompanyInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/CompanyInformation.php new file mode 100644 index 0000000..bbbb269 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CompanyInformation.php @@ -0,0 +1,57 @@ +name)) { + $object->name = $this->name; + } + if (!is_null($this->vatNumber)) { + $object->vatNumber = $this->vatNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'vatNumber')) { + $this->vatNumber = $object->vatNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentCardPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentCardPaymentMethodSpecificInput.php new file mode 100644 index 0000000..3f708ad --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentCardPaymentMethodSpecificInput.php @@ -0,0 +1,50 @@ +card)) { + $object->card = $this->card->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new CardWithoutCvv(); + $this->card = $value->fromObject($object->card); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentRequest.php new file mode 100644 index 0000000..634fbe2 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentRequest.php @@ -0,0 +1,80 @@ +cardPaymentMethodSpecificInput)) { + $object->cardPaymentMethodSpecificInput = $this->cardPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->merchant)) { + $object->merchant = $this->merchant->toObject(); + } + if (!is_null($this->order)) { + $object->order = $this->order->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardPaymentMethodSpecificInput')) { + if (!is_object($object->cardPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CompletePaymentCardPaymentMethodSpecificInput(); + $this->cardPaymentMethodSpecificInput = $value->fromObject($object->cardPaymentMethodSpecificInput); + } + if (property_exists($object, 'merchant')) { + if (!is_object($object->merchant)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); + } + $value = new Merchant(); + $this->merchant = $value->fromObject($object->merchant); + } + if (property_exists($object, 'order')) { + if (!is_object($object->order)) { + throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); + } + $value = new Order(); + $this->order = $value->fromObject($object->order); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentResponse.php new file mode 100644 index 0000000..3bfb6a1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CompletePaymentResponse.php @@ -0,0 +1,34 @@ +faxNumber)) { + $object->faxNumber = $this->faxNumber; + } + if (!is_null($this->mobilePhoneNumber)) { + $object->mobilePhoneNumber = $this->mobilePhoneNumber; + } + if (!is_null($this->phoneNumber)) { + $object->phoneNumber = $this->phoneNumber; + } + if (!is_null($this->workPhoneNumber)) { + $object->workPhoneNumber = $this->workPhoneNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'faxNumber')) { + $this->faxNumber = $object->faxNumber; + } + if (property_exists($object, 'mobilePhoneNumber')) { + $this->mobilePhoneNumber = $object->mobilePhoneNumber; + } + if (property_exists($object, 'phoneNumber')) { + $this->phoneNumber = $object->phoneNumber; + } + if (property_exists($object, 'workPhoneNumber')) { + $this->workPhoneNumber = $object->workPhoneNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsBase.php b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsBase.php new file mode 100644 index 0000000..8badb61 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsBase.php @@ -0,0 +1,57 @@ +emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + if (!is_null($this->emailMessageType)) { + $object->emailMessageType = $this->emailMessageType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + if (property_exists($object, 'emailMessageType')) { + $this->emailMessageType = $object->emailMessageType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsRiskAssessment.php new file mode 100644 index 0000000..7b48c23 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsRiskAssessment.php @@ -0,0 +1,46 @@ +emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsToken.php b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsToken.php new file mode 100644 index 0000000..49c84ba --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ContactDetailsToken.php @@ -0,0 +1,34 @@ +convertedAmount)) { + $object->convertedAmount = $this->convertedAmount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'convertedAmount')) { + $this->convertedAmount = $object->convertedAmount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateDisputeRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateDisputeRequest.php new file mode 100644 index 0000000..55a8f4f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateDisputeRequest.php @@ -0,0 +1,94 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->contactPerson)) { + $object->contactPerson = $this->contactPerson; + } + if (!is_null($this->emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + if (!is_null($this->replyTo)) { + $object->replyTo = $this->replyTo; + } + if (!is_null($this->requestMessage)) { + $object->requestMessage = $this->requestMessage; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'contactPerson')) { + $this->contactPerson = $object->contactPerson; + } + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + if (property_exists($object, 'replyTo')) { + $this->replyTo = $object->replyTo; + } + if (property_exists($object, 'requestMessage')) { + $this->requestMessage = $object->requestMessage; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutRequest.php new file mode 100644 index 0000000..cc6adc3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutRequest.php @@ -0,0 +1,200 @@ +bankTransferPaymentMethodSpecificInput)) { + $object->bankTransferPaymentMethodSpecificInput = $this->bankTransferPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->cardPaymentMethodSpecificInput)) { + $object->cardPaymentMethodSpecificInput = $this->cardPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->cashPaymentMethodSpecificInput)) { + $object->cashPaymentMethodSpecificInput = $this->cashPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->eInvoicePaymentMethodSpecificInput)) { + $object->eInvoicePaymentMethodSpecificInput = $this->eInvoicePaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->fraudFields)) { + $object->fraudFields = $this->fraudFields->toObject(); + } + if (!is_null($this->hostedCheckoutSpecificInput)) { + $object->hostedCheckoutSpecificInput = $this->hostedCheckoutSpecificInput->toObject(); + } + if (!is_null($this->merchant)) { + $object->merchant = $this->merchant->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificInput)) { + $object->mobilePaymentMethodSpecificInput = $this->mobilePaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->order)) { + $object->order = $this->order->toObject(); + } + if (!is_null($this->redirectPaymentMethodSpecificInput)) { + $object->redirectPaymentMethodSpecificInput = $this->redirectPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->sepaDirectDebitPaymentMethodSpecificInput)) { + $object->sepaDirectDebitPaymentMethodSpecificInput = $this->sepaDirectDebitPaymentMethodSpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankTransferPaymentMethodSpecificInput')) { + if (!is_object($object->bankTransferPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new BankTransferPaymentMethodSpecificInputBase(); + $this->bankTransferPaymentMethodSpecificInput = $value->fromObject($object->bankTransferPaymentMethodSpecificInput); + } + if (property_exists($object, 'cardPaymentMethodSpecificInput')) { + if (!is_object($object->cardPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CardPaymentMethodSpecificInputBase(); + $this->cardPaymentMethodSpecificInput = $value->fromObject($object->cardPaymentMethodSpecificInput); + } + if (property_exists($object, 'cashPaymentMethodSpecificInput')) { + if (!is_object($object->cashPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentMethodSpecificInputBase(); + $this->cashPaymentMethodSpecificInput = $value->fromObject($object->cashPaymentMethodSpecificInput); + } + if (property_exists($object, 'eInvoicePaymentMethodSpecificInput')) { + if (!is_object($object->eInvoicePaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentMethodSpecificInputBase(); + $this->eInvoicePaymentMethodSpecificInput = $value->fromObject($object->eInvoicePaymentMethodSpecificInput); + } + if (property_exists($object, 'fraudFields')) { + if (!is_object($object->fraudFields)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object'); + } + $value = new FraudFields(); + $this->fraudFields = $value->fromObject($object->fraudFields); + } + if (property_exists($object, 'hostedCheckoutSpecificInput')) { + if (!is_object($object->hostedCheckoutSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->hostedCheckoutSpecificInput, true) . '\' is not an object'); + } + $value = new HostedCheckoutSpecificInput(); + $this->hostedCheckoutSpecificInput = $value->fromObject($object->hostedCheckoutSpecificInput); + } + if (property_exists($object, 'merchant')) { + if (!is_object($object->merchant)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); + } + $value = new Merchant(); + $this->merchant = $value->fromObject($object->merchant); + } + if (property_exists($object, 'mobilePaymentMethodSpecificInput')) { + if (!is_object($object->mobilePaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentMethodSpecificInputHostedCheckout(); + $this->mobilePaymentMethodSpecificInput = $value->fromObject($object->mobilePaymentMethodSpecificInput); + } + if (property_exists($object, 'order')) { + if (!is_object($object->order)) { + throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); + } + $value = new Order(); + $this->order = $value->fromObject($object->order); + } + if (property_exists($object, 'redirectPaymentMethodSpecificInput')) { + if (!is_object($object->redirectPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentMethodSpecificInputBase(); + $this->redirectPaymentMethodSpecificInput = $value->fromObject($object->redirectPaymentMethodSpecificInput); + } + if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificInput')) { + if (!is_object($object->sepaDirectDebitPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentMethodSpecificInputBase(); + $this->sepaDirectDebitPaymentMethodSpecificInput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutResponse.php new file mode 100644 index 0000000..c5811fa --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedCheckoutResponse.php @@ -0,0 +1,101 @@ +RETURNMAC)) { + $object->RETURNMAC = $this->RETURNMAC; + } + if (!is_null($this->hostedCheckoutId)) { + $object->hostedCheckoutId = $this->hostedCheckoutId; + } + if (!is_null($this->invalidTokens)) { + $object->invalidTokens = []; + foreach ($this->invalidTokens as $element) { + if (!is_null($element)) { + $object->invalidTokens[] = $element; + } + } + } + if (!is_null($this->merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + if (!is_null($this->partialRedirectUrl)) { + $object->partialRedirectUrl = $this->partialRedirectUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'RETURNMAC')) { + $this->RETURNMAC = $object->RETURNMAC; + } + if (property_exists($object, 'hostedCheckoutId')) { + $this->hostedCheckoutId = $object->hostedCheckoutId; + } + if (property_exists($object, 'invalidTokens')) { + if (!is_array($object->invalidTokens) && !is_object($object->invalidTokens)) { + throw new UnexpectedValueException('value \'' . print_r($object->invalidTokens, true) . '\' is not an array or object'); + } + $this->invalidTokens = []; + foreach ($object->invalidTokens as $element) { + $this->invalidTokens[] = $element; + } + } + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + if (property_exists($object, 'partialRedirectUrl')) { + $this->partialRedirectUrl = $object->partialRedirectUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementRequest.php new file mode 100644 index 0000000..2d45582 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementRequest.php @@ -0,0 +1,65 @@ +createMandateInfo)) { + $object->createMandateInfo = $this->createMandateInfo->toObject(); + } + if (!is_null($this->hostedMandateManagementSpecificInput)) { + $object->hostedMandateManagementSpecificInput = $this->hostedMandateManagementSpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'createMandateInfo')) { + if (!is_object($object->createMandateInfo)) { + throw new UnexpectedValueException('value \'' . print_r($object->createMandateInfo, true) . '\' is not an object'); + } + $value = new HostedMandateInfo(); + $this->createMandateInfo = $value->fromObject($object->createMandateInfo); + } + if (property_exists($object, 'hostedMandateManagementSpecificInput')) { + if (!is_object($object->hostedMandateManagementSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->hostedMandateManagementSpecificInput, true) . '\' is not an object'); + } + $value = new HostedMandateManagementSpecificInput(); + $this->hostedMandateManagementSpecificInput = $value->fromObject($object->hostedMandateManagementSpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementResponse.php new file mode 100644 index 0000000..a826f5b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateHostedMandateManagementResponse.php @@ -0,0 +1,68 @@ +RETURNMAC)) { + $object->RETURNMAC = $this->RETURNMAC; + } + if (!is_null($this->hostedMandateManagementId)) { + $object->hostedMandateManagementId = $this->hostedMandateManagementId; + } + if (!is_null($this->partialRedirectUrl)) { + $object->partialRedirectUrl = $this->partialRedirectUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'RETURNMAC')) { + $this->RETURNMAC = $object->RETURNMAC; + } + if (property_exists($object, 'hostedMandateManagementId')) { + $this->hostedMandateManagementId = $object->hostedMandateManagementId; + } + if (property_exists($object, 'partialRedirectUrl')) { + $this->partialRedirectUrl = $object->partialRedirectUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateBase.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateBase.php new file mode 100644 index 0000000..9d76ec4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateBase.php @@ -0,0 +1,116 @@ +alias)) { + $object->alias = $this->alias; + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->language)) { + $object->language = $this->language; + } + if (!is_null($this->recurrenceType)) { + $object->recurrenceType = $this->recurrenceType; + } + if (!is_null($this->signatureType)) { + $object->signatureType = $this->signatureType; + } + if (!is_null($this->uniqueMandateReference)) { + $object->uniqueMandateReference = $this->uniqueMandateReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alias')) { + $this->alias = $object->alias; + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new MandateCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'language')) { + $this->language = $object->language; + } + if (property_exists($object, 'recurrenceType')) { + $this->recurrenceType = $object->recurrenceType; + } + if (property_exists($object, 'signatureType')) { + $this->signatureType = $object->signatureType; + } + if (property_exists($object, 'uniqueMandateReference')) { + $this->uniqueMandateReference = $object->uniqueMandateReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateRequest.php new file mode 100644 index 0000000..f84cb17 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateRequest.php @@ -0,0 +1,34 @@ +mandate)) { + $object->mandate = $this->mandate->toObject(); + } + if (!is_null($this->merchantAction)) { + $object->merchantAction = $this->merchantAction->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateResponse(); + $this->mandate = $value->fromObject($object->mandate); + } + if (property_exists($object, 'merchantAction')) { + if (!is_object($object->merchantAction)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchantAction, true) . '\' is not an object'); + } + $value = new MandateMerchantAction(); + $this->merchantAction = $value->fromObject($object->merchantAction); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateWithReturnUrl.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateWithReturnUrl.php new file mode 100644 index 0000000..6bf033e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateMandateWithReturnUrl.php @@ -0,0 +1,45 @@ +returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionRequest.php new file mode 100644 index 0000000..4b8cc45 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionRequest.php @@ -0,0 +1,50 @@ +paymentProductSession302SpecificInput)) { + $object->paymentProductSession302SpecificInput = $this->paymentProductSession302SpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductSession302SpecificInput')) { + if (!is_object($object->paymentProductSession302SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProductSession302SpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentProductSession302SpecificInput(); + $this->paymentProductSession302SpecificInput = $value->fromObject($object->paymentProductSession302SpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionResponse.php new file mode 100644 index 0000000..eddc521 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentProductSessionResponse.php @@ -0,0 +1,50 @@ +paymentProductSession302SpecificOutput)) { + $object->paymentProductSession302SpecificOutput = $this->paymentProductSession302SpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductSession302SpecificOutput')) { + if (!is_object($object->paymentProductSession302SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProductSession302SpecificOutput, true) . '\' is not an object'); + } + $value = new MobilePaymentProductSession302SpecificOutput(); + $this->paymentProductSession302SpecificOutput = $value->fromObject($object->paymentProductSession302SpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentRequest.php new file mode 100644 index 0000000..c3b377e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentRequest.php @@ -0,0 +1,226 @@ +bankTransferPaymentMethodSpecificInput)) { + $object->bankTransferPaymentMethodSpecificInput = $this->bankTransferPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->cardPaymentMethodSpecificInput)) { + $object->cardPaymentMethodSpecificInput = $this->cardPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->cashPaymentMethodSpecificInput)) { + $object->cashPaymentMethodSpecificInput = $this->cashPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->directDebitPaymentMethodSpecificInput)) { + $object->directDebitPaymentMethodSpecificInput = $this->directDebitPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->eInvoicePaymentMethodSpecificInput)) { + $object->eInvoicePaymentMethodSpecificInput = $this->eInvoicePaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->encryptedCustomerInput)) { + $object->encryptedCustomerInput = $this->encryptedCustomerInput; + } + if (!is_null($this->fraudFields)) { + $object->fraudFields = $this->fraudFields->toObject(); + } + if (!is_null($this->invoicePaymentMethodSpecificInput)) { + $object->invoicePaymentMethodSpecificInput = $this->invoicePaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->merchant)) { + $object->merchant = $this->merchant->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificInput)) { + $object->mobilePaymentMethodSpecificInput = $this->mobilePaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->order)) { + $object->order = $this->order->toObject(); + } + if (!is_null($this->redirectPaymentMethodSpecificInput)) { + $object->redirectPaymentMethodSpecificInput = $this->redirectPaymentMethodSpecificInput->toObject(); + } + if (!is_null($this->sepaDirectDebitPaymentMethodSpecificInput)) { + $object->sepaDirectDebitPaymentMethodSpecificInput = $this->sepaDirectDebitPaymentMethodSpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankTransferPaymentMethodSpecificInput')) { + if (!is_object($object->bankTransferPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new BankTransferPaymentMethodSpecificInput(); + $this->bankTransferPaymentMethodSpecificInput = $value->fromObject($object->bankTransferPaymentMethodSpecificInput); + } + if (property_exists($object, 'cardPaymentMethodSpecificInput')) { + if (!is_object($object->cardPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CardPaymentMethodSpecificInput(); + $this->cardPaymentMethodSpecificInput = $value->fromObject($object->cardPaymentMethodSpecificInput); + } + if (property_exists($object, 'cashPaymentMethodSpecificInput')) { + if (!is_object($object->cashPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CashPaymentMethodSpecificInput(); + $this->cashPaymentMethodSpecificInput = $value->fromObject($object->cashPaymentMethodSpecificInput); + } + if (property_exists($object, 'directDebitPaymentMethodSpecificInput')) { + if (!is_object($object->directDebitPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new NonSepaDirectDebitPaymentMethodSpecificInput(); + $this->directDebitPaymentMethodSpecificInput = $value->fromObject($object->directDebitPaymentMethodSpecificInput); + } + if (property_exists($object, 'eInvoicePaymentMethodSpecificInput')) { + if (!is_object($object->eInvoicePaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentMethodSpecificInput(); + $this->eInvoicePaymentMethodSpecificInput = $value->fromObject($object->eInvoicePaymentMethodSpecificInput); + } + if (property_exists($object, 'encryptedCustomerInput')) { + $this->encryptedCustomerInput = $object->encryptedCustomerInput; + } + if (property_exists($object, 'fraudFields')) { + if (!is_object($object->fraudFields)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object'); + } + $value = new FraudFields(); + $this->fraudFields = $value->fromObject($object->fraudFields); + } + if (property_exists($object, 'invoicePaymentMethodSpecificInput')) { + if (!is_object($object->invoicePaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->invoicePaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new InvoicePaymentMethodSpecificInput(); + $this->invoicePaymentMethodSpecificInput = $value->fromObject($object->invoicePaymentMethodSpecificInput); + } + if (property_exists($object, 'merchant')) { + if (!is_object($object->merchant)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); + } + $value = new Merchant(); + $this->merchant = $value->fromObject($object->merchant); + } + if (property_exists($object, 'mobilePaymentMethodSpecificInput')) { + if (!is_object($object->mobilePaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentMethodSpecificInput(); + $this->mobilePaymentMethodSpecificInput = $value->fromObject($object->mobilePaymentMethodSpecificInput); + } + if (property_exists($object, 'order')) { + if (!is_object($object->order)) { + throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); + } + $value = new Order(); + $this->order = $value->fromObject($object->order); + } + if (property_exists($object, 'redirectPaymentMethodSpecificInput')) { + if (!is_object($object->redirectPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentMethodSpecificInput(); + $this->redirectPaymentMethodSpecificInput = $value->fromObject($object->redirectPaymentMethodSpecificInput); + } + if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificInput')) { + if (!is_object($object->sepaDirectDebitPaymentMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificInput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentMethodSpecificInput(); + $this->sepaDirectDebitPaymentMethodSpecificInput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentResponse.php new file mode 100644 index 0000000..d45ccf9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatePaymentResponse.php @@ -0,0 +1,34 @@ +creationOutput)) { + $object->creationOutput = $this->creationOutput->toObject(); + } + if (!is_null($this->merchantAction)) { + $object->merchantAction = $this->merchantAction->toObject(); + } + if (!is_null($this->payment)) { + $object->payment = $this->payment->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'creationOutput')) { + if (!is_object($object->creationOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->creationOutput, true) . '\' is not an object'); + } + $value = new PaymentCreationOutput(); + $this->creationOutput = $value->fromObject($object->creationOutput); + } + if (property_exists($object, 'merchantAction')) { + if (!is_object($object->merchantAction)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchantAction, true) . '\' is not an object'); + } + $value = new MerchantAction(); + $this->merchantAction = $value->fromObject($object->merchantAction); + } + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new Payment(); + $this->payment = $value->fromObject($object->payment); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatePayoutRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatePayoutRequest.php new file mode 100644 index 0000000..fae2854 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatePayoutRequest.php @@ -0,0 +1,211 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->bankTransferPayoutMethodSpecificInput)) { + $object->bankTransferPayoutMethodSpecificInput = $this->bankTransferPayoutMethodSpecificInput->toObject(); + } + if (!is_null($this->cardPayoutMethodSpecificInput)) { + $object->cardPayoutMethodSpecificInput = $this->cardPayoutMethodSpecificInput->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->merchant)) { + $object->merchant = $this->merchant->toObject(); + } + if (!is_null($this->payoutDate)) { + $object->payoutDate = $this->payoutDate; + } + if (!is_null($this->payoutDetails)) { + $object->payoutDetails = $this->payoutDetails->toObject(); + } + if (!is_null($this->payoutText)) { + $object->payoutText = $this->payoutText; + } + if (!is_null($this->references)) { + $object->references = $this->references->toObject(); + } + if (!is_null($this->swiftCode)) { + $object->swiftCode = $this->swiftCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'bankTransferPayoutMethodSpecificInput')) { + if (!is_object($object->bankTransferPayoutMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPayoutMethodSpecificInput, true) . '\' is not an object'); + } + $value = new BankTransferPayoutMethodSpecificInput(); + $this->bankTransferPayoutMethodSpecificInput = $value->fromObject($object->bankTransferPayoutMethodSpecificInput); + } + if (property_exists($object, 'cardPayoutMethodSpecificInput')) { + if (!is_object($object->cardPayoutMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPayoutMethodSpecificInput, true) . '\' is not an object'); + } + $value = new CardPayoutMethodSpecificInput(); + $this->cardPayoutMethodSpecificInput = $value->fromObject($object->cardPayoutMethodSpecificInput); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new PayoutCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'merchant')) { + if (!is_object($object->merchant)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); + } + $value = new PayoutMerchant(); + $this->merchant = $value->fromObject($object->merchant); + } + if (property_exists($object, 'payoutDate')) { + $this->payoutDate = $object->payoutDate; + } + if (property_exists($object, 'payoutDetails')) { + if (!is_object($object->payoutDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->payoutDetails, true) . '\' is not an object'); + } + $value = new PayoutDetails(); + $this->payoutDetails = $value->fromObject($object->payoutDetails); + } + if (property_exists($object, 'payoutText')) { + $this->payoutText = $object->payoutText; + } + if (property_exists($object, 'references')) { + if (!is_object($object->references)) { + throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); + } + $value = new PayoutReferences(); + $this->references = $value->fromObject($object->references); + } + if (property_exists($object, 'swiftCode')) { + $this->swiftCode = $object->swiftCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenRequest.php new file mode 100644 index 0000000..fc12606 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenRequest.php @@ -0,0 +1,117 @@ +card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->eWallet)) { + $object->eWallet = $this->eWallet->toObject(); + } + if (!is_null($this->encryptedCustomerInput)) { + $object->encryptedCustomerInput = $this->encryptedCustomerInput; + } + if (!is_null($this->nonSepaDirectDebit)) { + $object->nonSepaDirectDebit = $this->nonSepaDirectDebit->toObject(); + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + if (!is_null($this->sepaDirectDebit)) { + $object->sepaDirectDebit = $this->sepaDirectDebit->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new TokenCard(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'eWallet')) { + if (!is_object($object->eWallet)) { + throw new UnexpectedValueException('value \'' . print_r($object->eWallet, true) . '\' is not an object'); + } + $value = new TokenEWallet(); + $this->eWallet = $value->fromObject($object->eWallet); + } + if (property_exists($object, 'encryptedCustomerInput')) { + $this->encryptedCustomerInput = $object->encryptedCustomerInput; + } + if (property_exists($object, 'nonSepaDirectDebit')) { + if (!is_object($object->nonSepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->nonSepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenNonSepaDirectDebit(); + $this->nonSepaDirectDebit = $value->fromObject($object->nonSepaDirectDebit); + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + if (property_exists($object, 'sepaDirectDebit')) { + if (!is_object($object->sepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenSepaDirectDebitWithoutCreditor(); + $this->sepaDirectDebit = $value->fromObject($object->sepaDirectDebit); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenResponse.php new file mode 100644 index 0000000..6e2f000 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreateTokenResponse.php @@ -0,0 +1,68 @@ +isNewToken)) { + $object->isNewToken = $this->isNewToken; + } + if (!is_null($this->originalPaymentId)) { + $object->originalPaymentId = $this->originalPaymentId; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isNewToken')) { + $this->isNewToken = $object->isNewToken; + } + if (property_exists($object, 'originalPaymentId')) { + $this->originalPaymentId = $object->originalPaymentId; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CreatedPaymentOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/CreatedPaymentOutput.php new file mode 100644 index 0000000..c8972ed --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CreatedPaymentOutput.php @@ -0,0 +1,125 @@ +displayedData)) { + $object->displayedData = $this->displayedData->toObject(); + } + if (!is_null($this->isCheckedRememberMe)) { + $object->isCheckedRememberMe = $this->isCheckedRememberMe; + } + if (!is_null($this->payment)) { + $object->payment = $this->payment->toObject(); + } + if (!is_null($this->paymentCreationReferences)) { + $object->paymentCreationReferences = $this->paymentCreationReferences->toObject(); + } + if (!is_null($this->paymentStatusCategory)) { + $object->paymentStatusCategory = $this->paymentStatusCategory; + } + if (!is_null($this->tokenizationSucceeded)) { + $object->tokenizationSucceeded = $this->tokenizationSucceeded; + } + if (!is_null($this->tokens)) { + $object->tokens = $this->tokens; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayedData')) { + if (!is_object($object->displayedData)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayedData, true) . '\' is not an object'); + } + $value = new DisplayedData(); + $this->displayedData = $value->fromObject($object->displayedData); + } + if (property_exists($object, 'isCheckedRememberMe')) { + $this->isCheckedRememberMe = $object->isCheckedRememberMe; + } + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new Payment(); + $this->payment = $value->fromObject($object->payment); + } + if (property_exists($object, 'paymentCreationReferences')) { + if (!is_object($object->paymentCreationReferences)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentCreationReferences, true) . '\' is not an object'); + } + $value = new PaymentCreationReferences(); + $this->paymentCreationReferences = $value->fromObject($object->paymentCreationReferences); + } + if (property_exists($object, 'paymentStatusCategory')) { + $this->paymentStatusCategory = $object->paymentStatusCategory; + } + if (property_exists($object, 'tokenizationSucceeded')) { + $this->tokenizationSucceeded = $object->tokenizationSucceeded; + } + if (property_exists($object, 'tokens')) { + $this->tokens = $object->tokens; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Creditor.php b/src/Worldline/Connect/Sdk/V1/Domain/Creditor.php new file mode 100644 index 0000000..1696544 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Creditor.php @@ -0,0 +1,156 @@ +additionalAddressInfo)) { + $object->additionalAddressInfo = $this->additionalAddressInfo; + } + if (!is_null($this->city)) { + $object->city = $this->city; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->houseNumber)) { + $object->houseNumber = $this->houseNumber; + } + if (!is_null($this->iban)) { + $object->iban = $this->iban; + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->name)) { + $object->name = $this->name; + } + if (!is_null($this->referenceParty)) { + $object->referenceParty = $this->referenceParty; + } + if (!is_null($this->referencePartyId)) { + $object->referencePartyId = $this->referencePartyId; + } + if (!is_null($this->street)) { + $object->street = $this->street; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalAddressInfo')) { + $this->additionalAddressInfo = $object->additionalAddressInfo; + } + if (property_exists($object, 'city')) { + $this->city = $object->city; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'houseNumber')) { + $this->houseNumber = $object->houseNumber; + } + if (property_exists($object, 'iban')) { + $this->iban = $object->iban; + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'referenceParty')) { + $this->referenceParty = $object->referenceParty; + } + if (property_exists($object, 'referencePartyId')) { + $this->referencePartyId = $object->referencePartyId; + } + if (property_exists($object, 'street')) { + $this->street = $object->street; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Customer.php b/src/Worldline/Connect/Sdk/V1/Domain/Customer.php new file mode 100644 index 0000000..a55deff --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Customer.php @@ -0,0 +1,180 @@ +account)) { + $object->account = $this->account->toObject(); + } + if (!is_null($this->accountType)) { + $object->accountType = $this->accountType; + } + if (!is_null($this->billingAddress)) { + $object->billingAddress = $this->billingAddress->toObject(); + } + if (!is_null($this->contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + if (!is_null($this->device)) { + $object->device = $this->device->toObject(); + } + if (!is_null($this->fiscalNumber)) { + $object->fiscalNumber = $this->fiscalNumber; + } + if (!is_null($this->isCompany)) { + $object->isCompany = $this->isCompany; + } + if (!is_null($this->isPreviousCustomer)) { + $object->isPreviousCustomer = $this->isPreviousCustomer; + } + if (!is_null($this->locale)) { + $object->locale = $this->locale; + } + if (!is_null($this->personalInformation)) { + $object->personalInformation = $this->personalInformation->toObject(); + } + if (!is_null($this->shippingAddress)) { + $object->shippingAddress = $this->shippingAddress->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'account')) { + if (!is_object($object->account)) { + throw new UnexpectedValueException('value \'' . print_r($object->account, true) . '\' is not an object'); + } + $value = new CustomerAccount(); + $this->account = $value->fromObject($object->account); + } + if (property_exists($object, 'accountType')) { + $this->accountType = $object->accountType; + } + if (property_exists($object, 'billingAddress')) { + if (!is_object($object->billingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->billingAddress = $value->fromObject($object->billingAddress); + } + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new ContactDetails(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + if (property_exists($object, 'device')) { + if (!is_object($object->device)) { + throw new UnexpectedValueException('value \'' . print_r($object->device, true) . '\' is not an object'); + } + $value = new CustomerDevice(); + $this->device = $value->fromObject($object->device); + } + if (property_exists($object, 'fiscalNumber')) { + $this->fiscalNumber = $object->fiscalNumber; + } + if (property_exists($object, 'isCompany')) { + $this->isCompany = $object->isCompany; + } + if (property_exists($object, 'isPreviousCustomer')) { + $this->isPreviousCustomer = $object->isPreviousCustomer; + } + if (property_exists($object, 'locale')) { + $this->locale = $object->locale; + } + if (property_exists($object, 'personalInformation')) { + if (!is_object($object->personalInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); + } + $value = new PersonalInformation(); + $this->personalInformation = $value->fromObject($object->personalInformation); + } + if (property_exists($object, 'shippingAddress')) { + if (!is_object($object->shippingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->shippingAddress, true) . '\' is not an object'); + } + $value = new AddressPersonal(); + $this->shippingAddress = $value->fromObject($object->shippingAddress); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccount.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccount.php new file mode 100644 index 0000000..4e0ede0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccount.php @@ -0,0 +1,179 @@ +authentication)) { + $object->authentication = $this->authentication->toObject(); + } + if (!is_null($this->changeDate)) { + $object->changeDate = $this->changeDate; + } + if (!is_null($this->changedDuringCheckout)) { + $object->changedDuringCheckout = $this->changedDuringCheckout; + } + if (!is_null($this->createDate)) { + $object->createDate = $this->createDate; + } + if (!is_null($this->hadSuspiciousActivity)) { + $object->hadSuspiciousActivity = $this->hadSuspiciousActivity; + } + if (!is_null($this->hasForgottenPassword)) { + $object->hasForgottenPassword = $this->hasForgottenPassword; + } + if (!is_null($this->hasPassword)) { + $object->hasPassword = $this->hasPassword; + } + if (!is_null($this->passwordChangeDate)) { + $object->passwordChangeDate = $this->passwordChangeDate; + } + if (!is_null($this->passwordChangedDuringCheckout)) { + $object->passwordChangedDuringCheckout = $this->passwordChangedDuringCheckout; + } + if (!is_null($this->paymentAccountOnFile)) { + $object->paymentAccountOnFile = $this->paymentAccountOnFile->toObject(); + } + if (!is_null($this->paymentAccountOnFileType)) { + $object->paymentAccountOnFileType = $this->paymentAccountOnFileType; + } + if (!is_null($this->paymentActivity)) { + $object->paymentActivity = $this->paymentActivity->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authentication')) { + if (!is_object($object->authentication)) { + throw new UnexpectedValueException('value \'' . print_r($object->authentication, true) . '\' is not an object'); + } + $value = new CustomerAccountAuthentication(); + $this->authentication = $value->fromObject($object->authentication); + } + if (property_exists($object, 'changeDate')) { + $this->changeDate = $object->changeDate; + } + if (property_exists($object, 'changedDuringCheckout')) { + $this->changedDuringCheckout = $object->changedDuringCheckout; + } + if (property_exists($object, 'createDate')) { + $this->createDate = $object->createDate; + } + if (property_exists($object, 'hadSuspiciousActivity')) { + $this->hadSuspiciousActivity = $object->hadSuspiciousActivity; + } + if (property_exists($object, 'hasForgottenPassword')) { + $this->hasForgottenPassword = $object->hasForgottenPassword; + } + if (property_exists($object, 'hasPassword')) { + $this->hasPassword = $object->hasPassword; + } + if (property_exists($object, 'passwordChangeDate')) { + $this->passwordChangeDate = $object->passwordChangeDate; + } + if (property_exists($object, 'passwordChangedDuringCheckout')) { + $this->passwordChangedDuringCheckout = $object->passwordChangedDuringCheckout; + } + if (property_exists($object, 'paymentAccountOnFile')) { + if (!is_object($object->paymentAccountOnFile)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentAccountOnFile, true) . '\' is not an object'); + } + $value = new PaymentAccountOnFile(); + $this->paymentAccountOnFile = $value->fromObject($object->paymentAccountOnFile); + } + if (property_exists($object, 'paymentAccountOnFileType')) { + $this->paymentAccountOnFileType = $object->paymentAccountOnFileType; + } + if (property_exists($object, 'paymentActivity')) { + if (!is_object($object->paymentActivity)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentActivity, true) . '\' is not an object'); + } + $value = new CustomerPaymentActivity(); + $this->paymentActivity = $value->fromObject($object->paymentActivity); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountAuthentication.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountAuthentication.php new file mode 100644 index 0000000..f8adc2b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountAuthentication.php @@ -0,0 +1,68 @@ +data)) { + $object->data = $this->data; + } + if (!is_null($this->method)) { + $object->method = $this->method; + } + if (!is_null($this->utcTimestamp)) { + $object->utcTimestamp = $this->utcTimestamp; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'data')) { + $this->data = $object->data; + } + if (property_exists($object, 'method')) { + $this->method = $object->method; + } + if (property_exists($object, 'utcTimestamp')) { + $this->utcTimestamp = $object->utcTimestamp; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountRiskAssessment.php new file mode 100644 index 0000000..e339f8a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerAccountRiskAssessment.php @@ -0,0 +1,57 @@ +hasForgottenPassword)) { + $object->hasForgottenPassword = $this->hasForgottenPassword; + } + if (!is_null($this->hasPassword)) { + $object->hasPassword = $this->hasPassword; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'hasForgottenPassword')) { + $this->hasForgottenPassword = $object->hasForgottenPassword; + } + if (property_exists($object, 'hasPassword')) { + $this->hasPassword = $object->hasPassword; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerApprovePayment.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerApprovePayment.php new file mode 100644 index 0000000..9284874 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerApprovePayment.php @@ -0,0 +1,46 @@ +accountType)) { + $object->accountType = $this->accountType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountType')) { + $this->accountType = $object->accountType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerBase.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerBase.php new file mode 100644 index 0000000..ae4ab88 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerBase.php @@ -0,0 +1,73 @@ +companyInformation)) { + $object->companyInformation = $this->companyInformation->toObject(); + } + if (!is_null($this->merchantCustomerId)) { + $object->merchantCustomerId = $this->merchantCustomerId; + } + if (!is_null($this->vatNumber)) { + $object->vatNumber = $this->vatNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'companyInformation')) { + if (!is_object($object->companyInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); + } + $value = new CompanyInformation(); + $this->companyInformation = $value->fromObject($object->companyInformation); + } + if (property_exists($object, 'merchantCustomerId')) { + $this->merchantCustomerId = $object->merchantCustomerId; + } + if (property_exists($object, 'vatNumber')) { + $this->vatNumber = $object->vatNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerDevice.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerDevice.php new file mode 100644 index 0000000..4265068 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerDevice.php @@ -0,0 +1,127 @@ +acceptHeader)) { + $object->acceptHeader = $this->acceptHeader; + } + if (!is_null($this->browserData)) { + $object->browserData = $this->browserData->toObject(); + } + if (!is_null($this->defaultFormFill)) { + $object->defaultFormFill = $this->defaultFormFill; + } + if (!is_null($this->deviceFingerprintTransactionId)) { + $object->deviceFingerprintTransactionId = $this->deviceFingerprintTransactionId; + } + if (!is_null($this->ipAddress)) { + $object->ipAddress = $this->ipAddress; + } + if (!is_null($this->locale)) { + $object->locale = $this->locale; + } + if (!is_null($this->timezoneOffsetUtcMinutes)) { + $object->timezoneOffsetUtcMinutes = $this->timezoneOffsetUtcMinutes; + } + if (!is_null($this->userAgent)) { + $object->userAgent = $this->userAgent; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acceptHeader')) { + $this->acceptHeader = $object->acceptHeader; + } + if (property_exists($object, 'browserData')) { + if (!is_object($object->browserData)) { + throw new UnexpectedValueException('value \'' . print_r($object->browserData, true) . '\' is not an object'); + } + $value = new BrowserData(); + $this->browserData = $value->fromObject($object->browserData); + } + if (property_exists($object, 'defaultFormFill')) { + $this->defaultFormFill = $object->defaultFormFill; + } + if (property_exists($object, 'deviceFingerprintTransactionId')) { + $this->deviceFingerprintTransactionId = $object->deviceFingerprintTransactionId; + } + if (property_exists($object, 'ipAddress')) { + $this->ipAddress = $object->ipAddress; + } + if (property_exists($object, 'locale')) { + $this->locale = $object->locale; + } + if (property_exists($object, 'timezoneOffsetUtcMinutes')) { + $this->timezoneOffsetUtcMinutes = $object->timezoneOffsetUtcMinutes; + } + if (property_exists($object, 'userAgent')) { + $this->userAgent = $object->userAgent; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerDeviceRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerDeviceRiskAssessment.php new file mode 100644 index 0000000..0ff064f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerDeviceRiskAssessment.php @@ -0,0 +1,57 @@ +defaultFormFill)) { + $object->defaultFormFill = $this->defaultFormFill; + } + if (!is_null($this->deviceFingerprintTransactionId)) { + $object->deviceFingerprintTransactionId = $this->deviceFingerprintTransactionId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'defaultFormFill')) { + $this->defaultFormFill = $object->defaultFormFill; + } + if (property_exists($object, 'deviceFingerprintTransactionId')) { + $this->deviceFingerprintTransactionId = $object->deviceFingerprintTransactionId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerPaymentActivity.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerPaymentActivity.php new file mode 100644 index 0000000..18bdf5f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerPaymentActivity.php @@ -0,0 +1,68 @@ +numberOfPaymentAttemptsLast24Hours)) { + $object->numberOfPaymentAttemptsLast24Hours = $this->numberOfPaymentAttemptsLast24Hours; + } + if (!is_null($this->numberOfPaymentAttemptsLastYear)) { + $object->numberOfPaymentAttemptsLastYear = $this->numberOfPaymentAttemptsLastYear; + } + if (!is_null($this->numberOfPurchasesLast6Months)) { + $object->numberOfPurchasesLast6Months = $this->numberOfPurchasesLast6Months; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'numberOfPaymentAttemptsLast24Hours')) { + $this->numberOfPaymentAttemptsLast24Hours = $object->numberOfPaymentAttemptsLast24Hours; + } + if (property_exists($object, 'numberOfPaymentAttemptsLastYear')) { + $this->numberOfPaymentAttemptsLastYear = $object->numberOfPaymentAttemptsLastYear; + } + if (property_exists($object, 'numberOfPurchasesLast6Months')) { + $this->numberOfPurchasesLast6Months = $object->numberOfPurchasesLast6Months; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerRiskAssessment.php new file mode 100644 index 0000000..7a44639 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerRiskAssessment.php @@ -0,0 +1,159 @@ +account)) { + $object->account = $this->account->toObject(); + } + if (!is_null($this->accountType)) { + $object->accountType = $this->accountType; + } + if (!is_null($this->billingAddress)) { + $object->billingAddress = $this->billingAddress->toObject(); + } + if (!is_null($this->contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + if (!is_null($this->device)) { + $object->device = $this->device->toObject(); + } + if (!is_null($this->isPreviousCustomer)) { + $object->isPreviousCustomer = $this->isPreviousCustomer; + } + if (!is_null($this->locale)) { + $object->locale = $this->locale; + } + if (!is_null($this->personalInformation)) { + $object->personalInformation = $this->personalInformation->toObject(); + } + if (!is_null($this->shippingAddress)) { + $object->shippingAddress = $this->shippingAddress->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'account')) { + if (!is_object($object->account)) { + throw new UnexpectedValueException('value \'' . print_r($object->account, true) . '\' is not an object'); + } + $value = new CustomerAccountRiskAssessment(); + $this->account = $value->fromObject($object->account); + } + if (property_exists($object, 'accountType')) { + $this->accountType = $object->accountType; + } + if (property_exists($object, 'billingAddress')) { + if (!is_object($object->billingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->billingAddress = $value->fromObject($object->billingAddress); + } + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new ContactDetailsRiskAssessment(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + if (property_exists($object, 'device')) { + if (!is_object($object->device)) { + throw new UnexpectedValueException('value \'' . print_r($object->device, true) . '\' is not an object'); + } + $value = new CustomerDeviceRiskAssessment(); + $this->device = $value->fromObject($object->device); + } + if (property_exists($object, 'isPreviousCustomer')) { + $this->isPreviousCustomer = $object->isPreviousCustomer; + } + if (property_exists($object, 'locale')) { + $this->locale = $object->locale; + } + if (property_exists($object, 'personalInformation')) { + if (!is_object($object->personalInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); + } + $value = new PersonalInformationRiskAssessment(); + $this->personalInformation = $value->fromObject($object->personalInformation); + } + if (property_exists($object, 'shippingAddress')) { + if (!is_object($object->shippingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->shippingAddress, true) . '\' is not an object'); + } + $value = new AddressPersonal(); + $this->shippingAddress = $value->fromObject($object->shippingAddress); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerToken.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerToken.php new file mode 100644 index 0000000..3c09fc4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerToken.php @@ -0,0 +1,64 @@ +billingAddress)) { + $object->billingAddress = $this->billingAddress->toObject(); + } + if (!is_null($this->personalInformation)) { + $object->personalInformation = $this->personalInformation->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'billingAddress')) { + if (!is_object($object->billingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->billingAddress = $value->fromObject($object->billingAddress); + } + if (property_exists($object, 'personalInformation')) { + if (!is_object($object->personalInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); + } + $value = new PersonalInformationToken(); + $this->personalInformation = $value->fromObject($object->personalInformation); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/CustomerTokenWithContactDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/CustomerTokenWithContactDetails.php new file mode 100644 index 0000000..fd09ff6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/CustomerTokenWithContactDetails.php @@ -0,0 +1,49 @@ +contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new ContactDetailsToken(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Debtor.php b/src/Worldline/Connect/Sdk/V1/Domain/Debtor.php new file mode 100644 index 0000000..72d2c28 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Debtor.php @@ -0,0 +1,156 @@ +additionalAddressInfo)) { + $object->additionalAddressInfo = $this->additionalAddressInfo; + } + if (!is_null($this->city)) { + $object->city = $this->city; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->houseNumber)) { + $object->houseNumber = $this->houseNumber; + } + if (!is_null($this->state)) { + $object->state = $this->state; + } + if (!is_null($this->stateCode)) { + $object->stateCode = $this->stateCode; + } + if (!is_null($this->street)) { + $object->street = $this->street; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->surnamePrefix)) { + $object->surnamePrefix = $this->surnamePrefix; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalAddressInfo')) { + $this->additionalAddressInfo = $object->additionalAddressInfo; + } + if (property_exists($object, 'city')) { + $this->city = $object->city; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'houseNumber')) { + $this->houseNumber = $object->houseNumber; + } + if (property_exists($object, 'state')) { + $this->state = $object->state; + } + if (property_exists($object, 'stateCode')) { + $this->stateCode = $object->stateCode; + } + if (property_exists($object, 'street')) { + $this->street = $object->street; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'surnamePrefix')) { + $this->surnamePrefix = $object->surnamePrefix; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DecryptedPaymentData.php b/src/Worldline/Connect/Sdk/V1/Domain/DecryptedPaymentData.php new file mode 100644 index 0000000..73e58d8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DecryptedPaymentData.php @@ -0,0 +1,124 @@ +authMethod)) { + $object->authMethod = $this->authMethod; + } + if (!is_null($this->cardholderName)) { + $object->cardholderName = $this->cardholderName; + } + if (!is_null($this->cryptogram)) { + $object->cryptogram = $this->cryptogram; + } + if (!is_null($this->dpan)) { + $object->dpan = $this->dpan; + } + if (!is_null($this->eci)) { + $object->eci = $this->eci; + } + if (!is_null($this->expiryDate)) { + $object->expiryDate = $this->expiryDate; + } + if (!is_null($this->pan)) { + $object->pan = $this->pan; + } + if (!is_null($this->paymentMethod)) { + $object->paymentMethod = $this->paymentMethod; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authMethod')) { + $this->authMethod = $object->authMethod; + } + if (property_exists($object, 'cardholderName')) { + $this->cardholderName = $object->cardholderName; + } + if (property_exists($object, 'cryptogram')) { + $this->cryptogram = $object->cryptogram; + } + if (property_exists($object, 'dpan')) { + $this->dpan = $object->dpan; + } + if (property_exists($object, 'eci')) { + $this->eci = $object->eci; + } + if (property_exists($object, 'expiryDate')) { + $this->expiryDate = $object->expiryDate; + } + if (property_exists($object, 'pan')) { + $this->pan = $object->pan; + } + if (property_exists($object, 'paymentMethod')) { + $this->paymentMethod = $object->paymentMethod; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintDetails.php new file mode 100644 index 0000000..befe0ee --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintDetails.php @@ -0,0 +1,57 @@ +paymentId)) { + $object->paymentId = $this->paymentId; + } + if (!is_null($this->rawDeviceFingerprintOutput)) { + $object->rawDeviceFingerprintOutput = $this->rawDeviceFingerprintOutput; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentId')) { + $this->paymentId = $object->paymentId; + } + if (property_exists($object, 'rawDeviceFingerprintOutput')) { + $this->rawDeviceFingerprintOutput = $object->rawDeviceFingerprintOutput; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintRequest.php new file mode 100644 index 0000000..86410ef --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintRequest.php @@ -0,0 +1,46 @@ +collectorCallback)) { + $object->collectorCallback = $this->collectorCallback; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'collectorCallback')) { + $this->collectorCallback = $object->collectorCallback; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintResponse.php new file mode 100644 index 0000000..6528e21 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DeviceFingerprintResponse.php @@ -0,0 +1,57 @@ +deviceFingerprintTransactionId)) { + $object->deviceFingerprintTransactionId = $this->deviceFingerprintTransactionId; + } + if (!is_null($this->html)) { + $object->html = $this->html; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'deviceFingerprintTransactionId')) { + $this->deviceFingerprintTransactionId = $object->deviceFingerprintTransactionId; + } + if (property_exists($object, 'html')) { + $this->html = $object->html; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DeviceRenderOptions.php b/src/Worldline/Connect/Sdk/V1/Domain/DeviceRenderOptions.php new file mode 100644 index 0000000..6e92ab5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DeviceRenderOptions.php @@ -0,0 +1,80 @@ +sdkInterface)) { + $object->sdkInterface = $this->sdkInterface; + } + if (!is_null($this->sdkUiType)) { + $object->sdkUiType = $this->sdkUiType; + } + if (!is_null($this->sdkUiTypes)) { + $object->sdkUiTypes = []; + foreach ($this->sdkUiTypes as $element) { + if (!is_null($element)) { + $object->sdkUiTypes[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'sdkInterface')) { + $this->sdkInterface = $object->sdkInterface; + } + if (property_exists($object, 'sdkUiType')) { + $this->sdkUiType = $object->sdkUiType; + } + if (property_exists($object, 'sdkUiTypes')) { + if (!is_array($object->sdkUiTypes) && !is_object($object->sdkUiTypes)) { + throw new UnexpectedValueException('value \'' . print_r($object->sdkUiTypes, true) . '\' is not an array or object'); + } + $this->sdkUiTypes = []; + foreach ($object->sdkUiTypes as $element) { + $this->sdkUiTypes[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Directory.php b/src/Worldline/Connect/Sdk/V1/Domain/Directory.php new file mode 100644 index 0000000..f38e665 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Directory.php @@ -0,0 +1,58 @@ +entries)) { + $object->entries = []; + foreach ($this->entries as $element) { + if (!is_null($element)) { + $object->entries[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'entries')) { + if (!is_array($object->entries) && !is_object($object->entries)) { + throw new UnexpectedValueException('value \'' . print_r($object->entries, true) . '\' is not an array or object'); + } + $this->entries = []; + foreach ($object->entries as $element) { + $value = new DirectoryEntry(); + $this->entries[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DirectoryEntry.php b/src/Worldline/Connect/Sdk/V1/Domain/DirectoryEntry.php new file mode 100644 index 0000000..dc06976 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DirectoryEntry.php @@ -0,0 +1,90 @@ +countryNames)) { + $object->countryNames = []; + foreach ($this->countryNames as $element) { + if (!is_null($element)) { + $object->countryNames[] = $element; + } + } + } + if (!is_null($this->issuerId)) { + $object->issuerId = $this->issuerId; + } + if (!is_null($this->issuerList)) { + $object->issuerList = $this->issuerList; + } + if (!is_null($this->issuerName)) { + $object->issuerName = $this->issuerName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'countryNames')) { + if (!is_array($object->countryNames) && !is_object($object->countryNames)) { + throw new UnexpectedValueException('value \'' . print_r($object->countryNames, true) . '\' is not an array or object'); + } + $this->countryNames = []; + foreach ($object->countryNames as $element) { + $this->countryNames[] = $element; + } + } + if (property_exists($object, 'issuerId')) { + $this->issuerId = $object->issuerId; + } + if (property_exists($object, 'issuerList')) { + $this->issuerList = $object->issuerList; + } + if (property_exists($object, 'issuerName')) { + $this->issuerName = $object->issuerName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisplayedData.php b/src/Worldline/Connect/Sdk/V1/Domain/DisplayedData.php new file mode 100644 index 0000000..aa7f889 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisplayedData.php @@ -0,0 +1,80 @@ +displayedDataType)) { + $object->displayedDataType = $this->displayedDataType; + } + if (!is_null($this->renderingData)) { + $object->renderingData = $this->renderingData; + } + if (!is_null($this->showData)) { + $object->showData = []; + foreach ($this->showData as $element) { + if (!is_null($element)) { + $object->showData[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayedDataType')) { + $this->displayedDataType = $object->displayedDataType; + } + if (property_exists($object, 'renderingData')) { + $this->renderingData = $object->renderingData; + } + if (property_exists($object, 'showData')) { + if (!is_array($object->showData) && !is_object($object->showData)) { + throw new UnexpectedValueException('value \'' . print_r($object->showData, true) . '\' is not an array or object'); + } + $this->showData = []; + foreach ($object->showData as $element) { + $value = new KeyValuePair(); + $this->showData[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Dispute.php b/src/Worldline/Connect/Sdk/V1/Domain/Dispute.php new file mode 100644 index 0000000..78efab0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Dispute.php @@ -0,0 +1,98 @@ +disputeOutput)) { + $object->disputeOutput = $this->disputeOutput->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->paymentId)) { + $object->paymentId = $this->paymentId; + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->statusOutput)) { + $object->statusOutput = $this->statusOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'disputeOutput')) { + if (!is_object($object->disputeOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->disputeOutput, true) . '\' is not an object'); + } + $value = new DisputeOutput(); + $this->disputeOutput = $value->fromObject($object->disputeOutput); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'paymentId')) { + $this->paymentId = $object->paymentId; + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'statusOutput')) { + if (!is_object($object->statusOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); + } + $value = new DisputeStatusOutput(); + $this->statusOutput = $value->fromObject($object->statusOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisputeCreationDetail.php b/src/Worldline/Connect/Sdk/V1/Domain/DisputeCreationDetail.php new file mode 100644 index 0000000..9d1a5b3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisputeCreationDetail.php @@ -0,0 +1,68 @@ +disputeCreationDate)) { + $object->disputeCreationDate = $this->disputeCreationDate; + } + if (!is_null($this->disputeOriginator)) { + $object->disputeOriginator = $this->disputeOriginator; + } + if (!is_null($this->userName)) { + $object->userName = $this->userName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'disputeCreationDate')) { + $this->disputeCreationDate = $object->disputeCreationDate; + } + if (property_exists($object, 'disputeOriginator')) { + $this->disputeOriginator = $object->disputeOriginator; + } + if (property_exists($object, 'userName')) { + $this->userName = $object->userName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisputeOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/DisputeOutput.php new file mode 100644 index 0000000..90e0f69 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisputeOutput.php @@ -0,0 +1,158 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->contactPerson)) { + $object->contactPerson = $this->contactPerson; + } + if (!is_null($this->creationDetails)) { + $object->creationDetails = $this->creationDetails->toObject(); + } + if (!is_null($this->emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + if (!is_null($this->files)) { + $object->files = []; + foreach ($this->files as $element) { + if (!is_null($element)) { + $object->files[] = $element->toObject(); + } + } + } + if (!is_null($this->reference)) { + $object->reference = $this->reference->toObject(); + } + if (!is_null($this->replyTo)) { + $object->replyTo = $this->replyTo; + } + if (!is_null($this->requestMessage)) { + $object->requestMessage = $this->requestMessage; + } + if (!is_null($this->responseMessage)) { + $object->responseMessage = $this->responseMessage; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'contactPerson')) { + $this->contactPerson = $object->contactPerson; + } + if (property_exists($object, 'creationDetails')) { + if (!is_object($object->creationDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->creationDetails, true) . '\' is not an object'); + } + $value = new DisputeCreationDetail(); + $this->creationDetails = $value->fromObject($object->creationDetails); + } + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + if (property_exists($object, 'files')) { + if (!is_array($object->files) && !is_object($object->files)) { + throw new UnexpectedValueException('value \'' . print_r($object->files, true) . '\' is not an array or object'); + } + $this->files = []; + foreach ($object->files as $element) { + $value = new HostedFile(); + $this->files[] = $value->fromObject($element); + } + } + if (property_exists($object, 'reference')) { + if (!is_object($object->reference)) { + throw new UnexpectedValueException('value \'' . print_r($object->reference, true) . '\' is not an object'); + } + $value = new DisputeReference(); + $this->reference = $value->fromObject($object->reference); + } + if (property_exists($object, 'replyTo')) { + $this->replyTo = $object->replyTo; + } + if (property_exists($object, 'requestMessage')) { + $this->requestMessage = $object->requestMessage; + } + if (property_exists($object, 'responseMessage')) { + $this->responseMessage = $object->responseMessage; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisputeReference.php b/src/Worldline/Connect/Sdk/V1/Domain/DisputeReference.php new file mode 100644 index 0000000..fba7e61 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisputeReference.php @@ -0,0 +1,90 @@ +merchantOrderId)) { + $object->merchantOrderId = $this->merchantOrderId; + } + if (!is_null($this->merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + if (!is_null($this->paymentReference)) { + $object->paymentReference = $this->paymentReference; + } + if (!is_null($this->providerId)) { + $object->providerId = $this->providerId; + } + if (!is_null($this->providerReference)) { + $object->providerReference = $this->providerReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'merchantOrderId')) { + $this->merchantOrderId = $object->merchantOrderId; + } + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + if (property_exists($object, 'paymentReference')) { + $this->paymentReference = $object->paymentReference; + } + if (property_exists($object, 'providerId')) { + $this->providerId = $object->providerId; + } + if (property_exists($object, 'providerReference')) { + $this->providerReference = $object->providerReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisputeResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/DisputeResponse.php new file mode 100644 index 0000000..0b230f6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisputeResponse.php @@ -0,0 +1,34 @@ +isCancellable)) { + $object->isCancellable = $this->isCancellable; + } + if (!is_null($this->statusCategory)) { + $object->statusCategory = $this->statusCategory; + } + if (!is_null($this->statusCode)) { + $object->statusCode = $this->statusCode; + } + if (!is_null($this->statusCodeChangeDateTime)) { + $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isCancellable')) { + $this->isCancellable = $object->isCancellable; + } + if (property_exists($object, 'statusCategory')) { + $this->statusCategory = $object->statusCategory; + } + if (property_exists($object, 'statusCode')) { + $this->statusCode = $object->statusCode; + } + if (property_exists($object, 'statusCodeChangeDateTime')) { + $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/DisputesResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/DisputesResponse.php new file mode 100644 index 0000000..26641af --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/DisputesResponse.php @@ -0,0 +1,58 @@ +disputes)) { + $object->disputes = []; + foreach ($this->disputes as $element) { + if (!is_null($element)) { + $object->disputes[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'disputes')) { + if (!is_array($object->disputes) && !is_object($object->disputes)) { + throw new UnexpectedValueException('value \'' . print_r($object->disputes, true) . '\' is not an array or object'); + } + $this->disputes = []; + foreach ($object->disputes as $element) { + $value = new Dispute(); + $this->disputes[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInput.php new file mode 100644 index 0000000..fa8ac85 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInput.php @@ -0,0 +1,60 @@ +acceptedTermsAndConditions)) { + $object->acceptedTermsAndConditions = $this->acceptedTermsAndConditions; + } + if (!is_null($this->paymentProduct9000SpecificInput)) { + $object->paymentProduct9000SpecificInput = $this->paymentProduct9000SpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acceptedTermsAndConditions')) { + $this->acceptedTermsAndConditions = $object->acceptedTermsAndConditions; + } + if (property_exists($object, 'paymentProduct9000SpecificInput')) { + if (!is_object($object->paymentProduct9000SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct9000SpecificInput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentProduct9000SpecificInput(); + $this->paymentProduct9000SpecificInput = $value->fromObject($object->paymentProduct9000SpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInputBase.php new file mode 100644 index 0000000..44d5a11 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentMethodSpecificInputBase.php @@ -0,0 +1,34 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + if (!is_null($this->paymentProduct9000SpecificOutput)) { + $object->paymentProduct9000SpecificOutput = $this->paymentProduct9000SpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + if (property_exists($object, 'paymentProduct9000SpecificOutput')) { + if (!is_object($object->paymentProduct9000SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct9000SpecificOutput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentProduct9000SpecificOutput(); + $this->paymentProduct9000SpecificOutput = $value->fromObject($object->paymentProduct9000SpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificInput.php new file mode 100644 index 0000000..7f61784 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificInput.php @@ -0,0 +1,61 @@ +bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->installmentId)) { + $object->installmentId = $this->installmentId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'installmentId')) { + $this->installmentId = $object->installmentId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificOutput.php new file mode 100644 index 0000000..94316de --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/EInvoicePaymentProduct9000SpecificOutput.php @@ -0,0 +1,46 @@ +installmentId)) { + $object->installmentId = $this->installmentId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'installmentId')) { + $this->installmentId = $object->installmentId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/EmptyValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/EmptyValidator.php new file mode 100644 index 0000000..134e3e1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/EmptyValidator.php @@ -0,0 +1,35 @@ +errorId)) { + $object->errorId = $this->errorId; + } + if (!is_null($this->errors)) { + $object->errors = []; + foreach ($this->errors as $element) { + if (!is_null($element)) { + $object->errors[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'errorId')) { + $this->errorId = $object->errorId; + } + if (property_exists($object, 'errors')) { + if (!is_array($object->errors) && !is_object($object->errors)) { + throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); + } + $this->errors = []; + foreach ($object->errors as $element) { + $value = new APIError(); + $this->errors[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ExemptionOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/ExemptionOutput.php new file mode 100644 index 0000000..28f1a58 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ExemptionOutput.php @@ -0,0 +1,68 @@ +exemptionRaised)) { + $object->exemptionRaised = $this->exemptionRaised; + } + if (!is_null($this->exemptionRejectionReason)) { + $object->exemptionRejectionReason = $this->exemptionRejectionReason; + } + if (!is_null($this->exemptionRequest)) { + $object->exemptionRequest = $this->exemptionRequest; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'exemptionRaised')) { + $this->exemptionRaised = $object->exemptionRaised; + } + if (property_exists($object, 'exemptionRejectionReason')) { + $this->exemptionRejectionReason = $object->exemptionRejectionReason; + } + if (property_exists($object, 'exemptionRequest')) { + $this->exemptionRequest = $object->exemptionRequest; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ExternalCardholderAuthenticationData.php b/src/Worldline/Connect/Sdk/V1/Domain/ExternalCardholderAuthenticationData.php new file mode 100644 index 0000000..dcee3d3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ExternalCardholderAuthenticationData.php @@ -0,0 +1,157 @@ +acsTransactionId)) { + $object->acsTransactionId = $this->acsTransactionId; + } + if (!is_null($this->appliedExemption)) { + $object->appliedExemption = $this->appliedExemption; + } + if (!is_null($this->cavv)) { + $object->cavv = $this->cavv; + } + if (!is_null($this->cavvAlgorithm)) { + $object->cavvAlgorithm = $this->cavvAlgorithm; + } + if (!is_null($this->directoryServerTransactionId)) { + $object->directoryServerTransactionId = $this->directoryServerTransactionId; + } + if (!is_null($this->eci)) { + $object->eci = $this->eci; + } + if (!is_null($this->schemeRiskScore)) { + $object->schemeRiskScore = $this->schemeRiskScore; + } + if (!is_null($this->threeDSecureVersion)) { + $object->threeDSecureVersion = $this->threeDSecureVersion; + } + if (!is_null($this->threeDServerTransactionId)) { + $object->threeDServerTransactionId = $this->threeDServerTransactionId; + } + if (!is_null($this->validationResult)) { + $object->validationResult = $this->validationResult; + } + if (!is_null($this->xid)) { + $object->xid = $this->xid; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acsTransactionId')) { + $this->acsTransactionId = $object->acsTransactionId; + } + if (property_exists($object, 'appliedExemption')) { + $this->appliedExemption = $object->appliedExemption; + } + if (property_exists($object, 'cavv')) { + $this->cavv = $object->cavv; + } + if (property_exists($object, 'cavvAlgorithm')) { + $this->cavvAlgorithm = $object->cavvAlgorithm; + } + if (property_exists($object, 'directoryServerTransactionId')) { + $this->directoryServerTransactionId = $object->directoryServerTransactionId; + } + if (property_exists($object, 'eci')) { + $this->eci = $object->eci; + } + if (property_exists($object, 'schemeRiskScore')) { + $this->schemeRiskScore = $object->schemeRiskScore; + } + if (property_exists($object, 'threeDSecureVersion')) { + $this->threeDSecureVersion = $object->threeDSecureVersion; + } + if (property_exists($object, 'threeDServerTransactionId')) { + $this->threeDServerTransactionId = $object->threeDServerTransactionId; + } + if (property_exists($object, 'validationResult')) { + $this->validationResult = $object->validationResult; + } + if (property_exists($object, 'xid')) { + $this->xid = $object->xid; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FindPaymentsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/FindPaymentsResponse.php new file mode 100644 index 0000000..8636fda --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FindPaymentsResponse.php @@ -0,0 +1,91 @@ +limit)) { + $object->limit = $this->limit; + } + if (!is_null($this->offset)) { + $object->offset = $this->offset; + } + if (!is_null($this->payments)) { + $object->payments = []; + foreach ($this->payments as $element) { + if (!is_null($element)) { + $object->payments[] = $element->toObject(); + } + } + } + if (!is_null($this->totalCount)) { + $object->totalCount = $this->totalCount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'limit')) { + $this->limit = $object->limit; + } + if (property_exists($object, 'offset')) { + $this->offset = $object->offset; + } + if (property_exists($object, 'payments')) { + if (!is_array($object->payments) && !is_object($object->payments)) { + throw new UnexpectedValueException('value \'' . print_r($object->payments, true) . '\' is not an array or object'); + } + $this->payments = []; + foreach ($object->payments as $element) { + $value = new Payment(); + $this->payments[] = $value->fromObject($element); + } + } + if (property_exists($object, 'totalCount')) { + $this->totalCount = $object->totalCount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FindPayoutsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/FindPayoutsResponse.php new file mode 100644 index 0000000..6ec7576 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FindPayoutsResponse.php @@ -0,0 +1,91 @@ +limit)) { + $object->limit = $this->limit; + } + if (!is_null($this->offset)) { + $object->offset = $this->offset; + } + if (!is_null($this->payouts)) { + $object->payouts = []; + foreach ($this->payouts as $element) { + if (!is_null($element)) { + $object->payouts[] = $element->toObject(); + } + } + } + if (!is_null($this->totalCount)) { + $object->totalCount = $this->totalCount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'limit')) { + $this->limit = $object->limit; + } + if (property_exists($object, 'offset')) { + $this->offset = $object->offset; + } + if (property_exists($object, 'payouts')) { + if (!is_array($object->payouts) && !is_object($object->payouts)) { + throw new UnexpectedValueException('value \'' . print_r($object->payouts, true) . '\' is not an array or object'); + } + $this->payouts = []; + foreach ($object->payouts as $element) { + $value = new PayoutResult(); + $this->payouts[] = $value->fromObject($element); + } + } + if (property_exists($object, 'totalCount')) { + $this->totalCount = $object->totalCount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FindRefundsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/FindRefundsResponse.php new file mode 100644 index 0000000..5b99fbc --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FindRefundsResponse.php @@ -0,0 +1,91 @@ +limit)) { + $object->limit = $this->limit; + } + if (!is_null($this->offset)) { + $object->offset = $this->offset; + } + if (!is_null($this->refunds)) { + $object->refunds = []; + foreach ($this->refunds as $element) { + if (!is_null($element)) { + $object->refunds[] = $element->toObject(); + } + } + } + if (!is_null($this->totalCount)) { + $object->totalCount = $this->totalCount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'limit')) { + $this->limit = $object->limit; + } + if (property_exists($object, 'offset')) { + $this->offset = $object->offset; + } + if (property_exists($object, 'refunds')) { + if (!is_array($object->refunds) && !is_object($object->refunds)) { + throw new UnexpectedValueException('value \'' . print_r($object->refunds, true) . '\' is not an array or object'); + } + $this->refunds = []; + foreach ($object->refunds as $element) { + $value = new RefundResult(); + $this->refunds[] = $value->fromObject($element); + } + } + if (property_exists($object, 'totalCount')) { + $this->totalCount = $object->totalCount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FixedListValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/FixedListValidator.php new file mode 100644 index 0000000..446f698 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FixedListValidator.php @@ -0,0 +1,57 @@ +allowedValues)) { + $object->allowedValues = []; + foreach ($this->allowedValues as $element) { + if (!is_null($element)) { + $object->allowedValues[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'allowedValues')) { + if (!is_array($object->allowedValues) && !is_object($object->allowedValues)) { + throw new UnexpectedValueException('value \'' . print_r($object->allowedValues, true) . '\' is not an array or object'); + } + $this->allowedValues = []; + foreach ($object->allowedValues as $element) { + $this->allowedValues[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FraudFields.php b/src/Worldline/Connect/Sdk/V1/Domain/FraudFields.php new file mode 100644 index 0000000..013af7e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FraudFields.php @@ -0,0 +1,264 @@ +addressesAreIdentical)) { + $object->addressesAreIdentical = $this->addressesAreIdentical; + } + if (!is_null($this->blackListData)) { + $object->blackListData = $this->blackListData; + } + if (!is_null($this->cardOwnerAddress)) { + $object->cardOwnerAddress = $this->cardOwnerAddress->toObject(); + } + if (!is_null($this->customerIpAddress)) { + $object->customerIpAddress = $this->customerIpAddress; + } + if (!is_null($this->defaultFormFill)) { + $object->defaultFormFill = $this->defaultFormFill; + } + if (!is_null($this->deviceFingerprintActivated)) { + $object->deviceFingerprintActivated = $this->deviceFingerprintActivated; + } + if (!is_null($this->deviceFingerprintTransactionId)) { + $object->deviceFingerprintTransactionId = $this->deviceFingerprintTransactionId; + } + if (!is_null($this->giftCardType)) { + $object->giftCardType = $this->giftCardType; + } + if (!is_null($this->giftMessage)) { + $object->giftMessage = $this->giftMessage; + } + if (!is_null($this->hasForgottenPwd)) { + $object->hasForgottenPwd = $this->hasForgottenPwd; + } + if (!is_null($this->hasPassword)) { + $object->hasPassword = $this->hasPassword; + } + if (!is_null($this->isPreviousCustomer)) { + $object->isPreviousCustomer = $this->isPreviousCustomer; + } + if (!is_null($this->orderTimezone)) { + $object->orderTimezone = $this->orderTimezone; + } + if (!is_null($this->shipComments)) { + $object->shipComments = $this->shipComments; + } + if (!is_null($this->shipmentTrackingNumber)) { + $object->shipmentTrackingNumber = $this->shipmentTrackingNumber; + } + if (!is_null($this->shippingDetails)) { + $object->shippingDetails = $this->shippingDetails->toObject(); + } + if (!is_null($this->userData)) { + $object->userData = []; + foreach ($this->userData as $element) { + if (!is_null($element)) { + $object->userData[] = $element; + } + } + } + if (!is_null($this->website)) { + $object->website = $this->website; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'addressesAreIdentical')) { + $this->addressesAreIdentical = $object->addressesAreIdentical; + } + if (property_exists($object, 'blackListData')) { + $this->blackListData = $object->blackListData; + } + if (property_exists($object, 'cardOwnerAddress')) { + if (!is_object($object->cardOwnerAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardOwnerAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->cardOwnerAddress = $value->fromObject($object->cardOwnerAddress); + } + if (property_exists($object, 'customerIpAddress')) { + $this->customerIpAddress = $object->customerIpAddress; + } + if (property_exists($object, 'defaultFormFill')) { + $this->defaultFormFill = $object->defaultFormFill; + } + if (property_exists($object, 'deviceFingerprintActivated')) { + $this->deviceFingerprintActivated = $object->deviceFingerprintActivated; + } + if (property_exists($object, 'deviceFingerprintTransactionId')) { + $this->deviceFingerprintTransactionId = $object->deviceFingerprintTransactionId; + } + if (property_exists($object, 'giftCardType')) { + $this->giftCardType = $object->giftCardType; + } + if (property_exists($object, 'giftMessage')) { + $this->giftMessage = $object->giftMessage; + } + if (property_exists($object, 'hasForgottenPwd')) { + $this->hasForgottenPwd = $object->hasForgottenPwd; + } + if (property_exists($object, 'hasPassword')) { + $this->hasPassword = $object->hasPassword; + } + if (property_exists($object, 'isPreviousCustomer')) { + $this->isPreviousCustomer = $object->isPreviousCustomer; + } + if (property_exists($object, 'orderTimezone')) { + $this->orderTimezone = $object->orderTimezone; + } + if (property_exists($object, 'shipComments')) { + $this->shipComments = $object->shipComments; + } + if (property_exists($object, 'shipmentTrackingNumber')) { + $this->shipmentTrackingNumber = $object->shipmentTrackingNumber; + } + if (property_exists($object, 'shippingDetails')) { + if (!is_object($object->shippingDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->shippingDetails, true) . '\' is not an object'); + } + $value = new FraudFieldsShippingDetails(); + $this->shippingDetails = $value->fromObject($object->shippingDetails); + } + if (property_exists($object, 'userData')) { + if (!is_array($object->userData) && !is_object($object->userData)) { + throw new UnexpectedValueException('value \'' . print_r($object->userData, true) . '\' is not an array or object'); + } + $this->userData = []; + foreach ($object->userData as $element) { + $this->userData[] = $element; + } + } + if (property_exists($object, 'website')) { + $this->website = $object->website; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FraudFieldsShippingDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/FraudFieldsShippingDetails.php new file mode 100644 index 0000000..3040e51 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FraudFieldsShippingDetails.php @@ -0,0 +1,72 @@ +methodDetails)) { + $object->methodDetails = $this->methodDetails; + } + if (!is_null($this->methodSpeed)) { + $object->methodSpeed = $this->methodSpeed; + } + if (!is_null($this->methodType)) { + $object->methodType = $this->methodType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'methodDetails')) { + $this->methodDetails = $object->methodDetails; + } + if (property_exists($object, 'methodSpeed')) { + $this->methodSpeed = $object->methodSpeed; + } + if (property_exists($object, 'methodType')) { + $this->methodType = $object->methodType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FraudResults.php b/src/Worldline/Connect/Sdk/V1/Domain/FraudResults.php new file mode 100644 index 0000000..ea3e77e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FraudResults.php @@ -0,0 +1,76 @@ +fraudServiceResult)) { + $object->fraudServiceResult = $this->fraudServiceResult; + } + if (!is_null($this->inAuth)) { + $object->inAuth = $this->inAuth->toObject(); + } + if (!is_null($this->microsoftFraudProtection)) { + $object->microsoftFraudProtection = $this->microsoftFraudProtection->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudServiceResult')) { + $this->fraudServiceResult = $object->fraudServiceResult; + } + if (property_exists($object, 'inAuth')) { + if (!is_object($object->inAuth)) { + throw new UnexpectedValueException('value \'' . print_r($object->inAuth, true) . '\' is not an object'); + } + $value = new InAuth(); + $this->inAuth = $value->fromObject($object->inAuth); + } + if (property_exists($object, 'microsoftFraudProtection')) { + if (!is_object($object->microsoftFraudProtection)) { + throw new UnexpectedValueException('value \'' . print_r($object->microsoftFraudProtection, true) . '\' is not an object'); + } + $value = new MicrosoftFraudResults(); + $this->microsoftFraudProtection = $value->fromObject($object->microsoftFraudProtection); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FraudResultsRetailDecisions.php b/src/Worldline/Connect/Sdk/V1/Domain/FraudResultsRetailDecisions.php new file mode 100644 index 0000000..7b404f7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FraudResultsRetailDecisions.php @@ -0,0 +1,68 @@ +fraudCode)) { + $object->fraudCode = $this->fraudCode; + } + if (!is_null($this->fraudNeural)) { + $object->fraudNeural = $this->fraudNeural; + } + if (!is_null($this->fraudRCF)) { + $object->fraudRCF = $this->fraudRCF; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudCode')) { + $this->fraudCode = $object->fraudCode; + } + if (property_exists($object, 'fraudNeural')) { + $this->fraudNeural = $object->fraudNeural; + } + if (property_exists($object, 'fraudRCF')) { + $this->fraudRCF = $object->fraudRCF; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/FraugsterResults.php b/src/Worldline/Connect/Sdk/V1/Domain/FraugsterResults.php new file mode 100644 index 0000000..cc79c12 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/FraugsterResults.php @@ -0,0 +1,57 @@ +fraudInvestigationPoints)) { + $object->fraudInvestigationPoints = $this->fraudInvestigationPoints; + } + if (!is_null($this->fraudScore)) { + $object->fraudScore = $this->fraudScore; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudInvestigationPoints')) { + $this->fraudInvestigationPoints = $object->fraudInvestigationPoints; + } + if (property_exists($object, 'fraudScore')) { + $this->fraudScore = $object->fraudScore; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Frequency.php b/src/Worldline/Connect/Sdk/V1/Domain/Frequency.php new file mode 100644 index 0000000..e54cf59 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Frequency.php @@ -0,0 +1,57 @@ +interval)) { + $object->interval = $this->interval; + } + if (!is_null($this->intervalFrequency)) { + $object->intervalFrequency = $this->intervalFrequency; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'interval')) { + $this->interval = $object->interval; + } + if (property_exists($object, 'intervalFrequency')) { + $this->intervalFrequency = $object->intervalFrequency; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GPayThreeDSecure.php b/src/Worldline/Connect/Sdk/V1/Domain/GPayThreeDSecure.php new file mode 100644 index 0000000..61408b2 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GPayThreeDSecure.php @@ -0,0 +1,94 @@ +challengeCanvasSize)) { + $object->challengeCanvasSize = $this->challengeCanvasSize; + } + if (!is_null($this->challengeIndicator)) { + $object->challengeIndicator = $this->challengeIndicator; + } + if (!is_null($this->exemptionRequest)) { + $object->exemptionRequest = $this->exemptionRequest; + } + if (!is_null($this->redirectionData)) { + $object->redirectionData = $this->redirectionData->toObject(); + } + if (!is_null($this->skipAuthentication)) { + $object->skipAuthentication = $this->skipAuthentication; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'challengeCanvasSize')) { + $this->challengeCanvasSize = $object->challengeCanvasSize; + } + if (property_exists($object, 'challengeIndicator')) { + $this->challengeIndicator = $object->challengeIndicator; + } + if (property_exists($object, 'exemptionRequest')) { + $this->exemptionRequest = $object->exemptionRequest; + } + if (property_exists($object, 'redirectionData')) { + if (!is_object($object->redirectionData)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectionData, true) . '\' is not an object'); + } + $value = new RedirectionData(); + $this->redirectionData = $value->fromObject($object->redirectionData); + } + if (property_exists($object, 'skipAuthentication')) { + $this->skipAuthentication = $object->skipAuthentication; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsRequest.php new file mode 100644 index 0000000..2fd1b46 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsRequest.php @@ -0,0 +1,69 @@ +countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->values)) { + $object->values = []; + foreach ($this->values as $element) { + if (!is_null($element)) { + $object->values[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'values')) { + if (!is_array($object->values) && !is_object($object->values)) { + throw new UnexpectedValueException('value \'' . print_r($object->values, true) . '\' is not an array or object'); + } + $this->values = []; + foreach ($object->values as $element) { + $value = new KeyValuePair(); + $this->values[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsResponse.php new file mode 100644 index 0000000..ee2dce3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetCustomerDetailsResponse.php @@ -0,0 +1,145 @@ +city)) { + $object->city = $this->city; + } + if (!is_null($this->country)) { + $object->country = $this->country; + } + if (!is_null($this->emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + if (!is_null($this->firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->fiscalNumber)) { + $object->fiscalNumber = $this->fiscalNumber; + } + if (!is_null($this->languageCode)) { + $object->languageCode = $this->languageCode; + } + if (!is_null($this->phoneNumber)) { + $object->phoneNumber = $this->phoneNumber; + } + if (!is_null($this->street)) { + $object->street = $this->street; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'city')) { + $this->city = $object->city; + } + if (property_exists($object, 'country')) { + $this->country = $object->country; + } + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'fiscalNumber')) { + $this->fiscalNumber = $object->fiscalNumber; + } + if (property_exists($object, 'languageCode')) { + $this->languageCode = $object->languageCode; + } + if (property_exists($object, 'phoneNumber')) { + $this->phoneNumber = $object->phoneNumber; + } + if (property_exists($object, 'street')) { + $this->street = $object->street; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetHostedCheckoutResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetHostedCheckoutResponse.php new file mode 100644 index 0000000..b6cfe01 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetHostedCheckoutResponse.php @@ -0,0 +1,61 @@ +createdPaymentOutput)) { + $object->createdPaymentOutput = $this->createdPaymentOutput->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'createdPaymentOutput')) { + if (!is_object($object->createdPaymentOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->createdPaymentOutput, true) . '\' is not an object'); + } + $value = new CreatedPaymentOutput(); + $this->createdPaymentOutput = $value->fromObject($object->createdPaymentOutput); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetHostedMandateManagementResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetHostedMandateManagementResponse.php new file mode 100644 index 0000000..e3ceda0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetHostedMandateManagementResponse.php @@ -0,0 +1,61 @@ +mandate)) { + $object->mandate = $this->mandate->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateResponse(); + $this->mandate = $value->fromObject($object->mandate); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsRequest.php new file mode 100644 index 0000000..fc8a87c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsRequest.php @@ -0,0 +1,61 @@ +bin)) { + $object->bin = $this->bin; + } + if (!is_null($this->paymentContext)) { + $object->paymentContext = $this->paymentContext->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bin')) { + $this->bin = $object->bin; + } + if (property_exists($object, 'paymentContext')) { + if (!is_object($object->paymentContext)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentContext, true) . '\' is not an object'); + } + $value = new PaymentContext(); + $this->paymentContext = $value->fromObject($object->paymentContext); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsResponse.php new file mode 100644 index 0000000..e472037 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetIINDetailsResponse.php @@ -0,0 +1,91 @@ +coBrands)) { + $object->coBrands = []; + foreach ($this->coBrands as $element) { + if (!is_null($element)) { + $object->coBrands[] = $element->toObject(); + } + } + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->isAllowedInContext)) { + $object->isAllowedInContext = $this->isAllowedInContext; + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'coBrands')) { + if (!is_array($object->coBrands) && !is_object($object->coBrands)) { + throw new UnexpectedValueException('value \'' . print_r($object->coBrands, true) . '\' is not an array or object'); + } + $this->coBrands = []; + foreach ($object->coBrands as $element) { + $value = new IINDetail(); + $this->coBrands[] = $value->fromObject($element); + } + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'isAllowedInContext')) { + $this->isAllowedInContext = $object->isAllowedInContext; + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetInstallmentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/GetInstallmentRequest.php new file mode 100644 index 0000000..d5f44b0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetInstallmentRequest.php @@ -0,0 +1,83 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->bin)) { + $object->bin = $this->bin; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'bin')) { + $this->bin = $object->bin; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetMandateResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetMandateResponse.php new file mode 100644 index 0000000..d764aa0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetMandateResponse.php @@ -0,0 +1,50 @@ +mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateResponse(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GetPrivacyPolicyResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/GetPrivacyPolicyResponse.php new file mode 100644 index 0000000..bc86db6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GetPrivacyPolicyResponse.php @@ -0,0 +1,46 @@ +htmlContent)) { + $object->htmlContent = $this->htmlContent; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'htmlContent')) { + $this->htmlContent = $object->htmlContent; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/GiftCardPurchase.php b/src/Worldline/Connect/Sdk/V1/Domain/GiftCardPurchase.php new file mode 100644 index 0000000..01e0f4f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/GiftCardPurchase.php @@ -0,0 +1,61 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->numberOfGiftCards)) { + $object->numberOfGiftCards = $this->numberOfGiftCards; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'numberOfGiftCards')) { + $this->numberOfGiftCards = $object->numberOfGiftCards; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificInput.php new file mode 100644 index 0000000..65e8527 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificInput.php @@ -0,0 +1,153 @@ +isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->locale)) { + $object->locale = $this->locale; + } + if (!is_null($this->paymentProductFilters)) { + $object->paymentProductFilters = $this->paymentProductFilters->toObject(); + } + if (!is_null($this->recurringPaymentsData)) { + $object->recurringPaymentsData = $this->recurringPaymentsData->toObject(); + } + if (!is_null($this->returnCancelState)) { + $object->returnCancelState = $this->returnCancelState; + } + if (!is_null($this->returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + if (!is_null($this->showResultPage)) { + $object->showResultPage = $this->showResultPage; + } + if (!is_null($this->tokens)) { + $object->tokens = $this->tokens; + } + if (!is_null($this->validateShoppingCart)) { + $object->validateShoppingCart = $this->validateShoppingCart; + } + if (!is_null($this->variant)) { + $object->variant = $this->variant; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'locale')) { + $this->locale = $object->locale; + } + if (property_exists($object, 'paymentProductFilters')) { + if (!is_object($object->paymentProductFilters)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProductFilters, true) . '\' is not an object'); + } + $value = new PaymentProductFiltersHostedCheckout(); + $this->paymentProductFilters = $value->fromObject($object->paymentProductFilters); + } + if (property_exists($object, 'recurringPaymentsData')) { + if (!is_object($object->recurringPaymentsData)) { + throw new UnexpectedValueException('value \'' . print_r($object->recurringPaymentsData, true) . '\' is not an object'); + } + $value = new RecurringPaymentsData(); + $this->recurringPaymentsData = $value->fromObject($object->recurringPaymentsData); + } + if (property_exists($object, 'returnCancelState')) { + $this->returnCancelState = $object->returnCancelState; + } + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + if (property_exists($object, 'showResultPage')) { + $this->showResultPage = $object->showResultPage; + } + if (property_exists($object, 'tokens')) { + $this->tokens = $object->tokens; + } + if (property_exists($object, 'validateShoppingCart')) { + $this->validateShoppingCart = $object->validateShoppingCart; + } + if (property_exists($object, 'variant')) { + $this->variant = $object->variant; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificOutput.php new file mode 100644 index 0000000..64de159 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/HostedCheckoutSpecificOutput.php @@ -0,0 +1,57 @@ +hostedCheckoutId)) { + $object->hostedCheckoutId = $this->hostedCheckoutId; + } + if (!is_null($this->variant)) { + $object->variant = $this->variant; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'hostedCheckoutId')) { + $this->hostedCheckoutId = $object->hostedCheckoutId; + } + if (property_exists($object, 'variant')) { + $this->variant = $object->variant; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/HostedFile.php b/src/Worldline/Connect/Sdk/V1/Domain/HostedFile.php new file mode 100644 index 0000000..0a4f0fe --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/HostedFile.php @@ -0,0 +1,79 @@ +fileName)) { + $object->fileName = $this->fileName; + } + if (!is_null($this->fileSize)) { + $object->fileSize = $this->fileSize; + } + if (!is_null($this->fileType)) { + $object->fileType = $this->fileType; + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fileName')) { + $this->fileName = $object->fileName; + } + if (property_exists($object, 'fileSize')) { + $this->fileSize = $object->fileSize; + } + if (property_exists($object, 'fileType')) { + $this->fileType = $object->fileType; + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateInfo.php b/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateInfo.php new file mode 100644 index 0000000..2154453 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateInfo.php @@ -0,0 +1,105 @@ +alias)) { + $object->alias = $this->alias; + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->recurrenceType)) { + $object->recurrenceType = $this->recurrenceType; + } + if (!is_null($this->signatureType)) { + $object->signatureType = $this->signatureType; + } + if (!is_null($this->uniqueMandateReference)) { + $object->uniqueMandateReference = $this->uniqueMandateReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alias')) { + $this->alias = $object->alias; + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new MandateCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'recurrenceType')) { + $this->recurrenceType = $object->recurrenceType; + } + if (property_exists($object, 'signatureType')) { + $this->signatureType = $object->signatureType; + } + if (property_exists($object, 'uniqueMandateReference')) { + $this->uniqueMandateReference = $object->uniqueMandateReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateManagementSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateManagementSpecificInput.php new file mode 100644 index 0000000..a57f021 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/HostedMandateManagementSpecificInput.php @@ -0,0 +1,79 @@ +locale)) { + $object->locale = $this->locale; + } + if (!is_null($this->returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + if (!is_null($this->showResultPage)) { + $object->showResultPage = $this->showResultPage; + } + if (!is_null($this->variant)) { + $object->variant = $this->variant; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'locale')) { + $this->locale = $object->locale; + } + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + if (property_exists($object, 'showResultPage')) { + $this->showResultPage = $object->showResultPage; + } + if (property_exists($object, 'variant')) { + $this->variant = $object->variant; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/IINDetail.php b/src/Worldline/Connect/Sdk/V1/Domain/IINDetail.php new file mode 100644 index 0000000..bd0da66 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/IINDetail.php @@ -0,0 +1,57 @@ +isAllowedInContext)) { + $object->isAllowedInContext = $this->isAllowedInContext; + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isAllowedInContext')) { + $this->isAllowedInContext = $object->isAllowedInContext; + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InAuth.php b/src/Worldline/Connect/Sdk/V1/Domain/InAuth.php new file mode 100644 index 0000000..39fe6d6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InAuth.php @@ -0,0 +1,90 @@ +deviceCategory)) { + $object->deviceCategory = $this->deviceCategory; + } + if (!is_null($this->deviceId)) { + $object->deviceId = $this->deviceId; + } + if (!is_null($this->riskScore)) { + $object->riskScore = $this->riskScore; + } + if (!is_null($this->trueIpAddress)) { + $object->trueIpAddress = $this->trueIpAddress; + } + if (!is_null($this->trueIpAddressCountry)) { + $object->trueIpAddressCountry = $this->trueIpAddressCountry; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'deviceCategory')) { + $this->deviceCategory = $object->deviceCategory; + } + if (property_exists($object, 'deviceId')) { + $this->deviceId = $object->deviceId; + } + if (property_exists($object, 'riskScore')) { + $this->riskScore = $object->riskScore; + } + if (property_exists($object, 'trueIpAddress')) { + $this->trueIpAddress = $object->trueIpAddress; + } + if (property_exists($object, 'trueIpAddressCountry')) { + $this->trueIpAddressCountry = $object->trueIpAddressCountry; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InstallmentDisplayHints.php b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentDisplayHints.php new file mode 100644 index 0000000..a0c7361 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentDisplayHints.php @@ -0,0 +1,68 @@ +displayOrder)) { + $object->displayOrder = $this->displayOrder; + } + if (!is_null($this->label)) { + $object->label = $this->label; + } + if (!is_null($this->logo)) { + $object->logo = $this->logo; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayOrder')) { + $this->displayOrder = $object->displayOrder; + } + if (property_exists($object, 'label')) { + $this->label = $object->label; + } + if (property_exists($object, 'logo')) { + $this->logo = $object->logo; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptions.php b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptions.php new file mode 100644 index 0000000..09a03df --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptions.php @@ -0,0 +1,84 @@ +displayHints)) { + $object->displayHints = $this->displayHints->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->installmentPlans)) { + $object->installmentPlans = []; + foreach ($this->installmentPlans as $element) { + if (!is_null($element)) { + $object->installmentPlans[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayHints')) { + if (!is_object($object->displayHints)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); + } + $value = new InstallmentDisplayHints(); + $this->displayHints = $value->fromObject($object->displayHints); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'installmentPlans')) { + if (!is_array($object->installmentPlans) && !is_object($object->installmentPlans)) { + throw new UnexpectedValueException('value \'' . print_r($object->installmentPlans, true) . '\' is not an array or object'); + } + $this->installmentPlans = []; + foreach ($object->installmentPlans as $element) { + $value = new Installments(); + $this->installmentPlans[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptionsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptionsResponse.php new file mode 100644 index 0000000..7931474 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InstallmentOptionsResponse.php @@ -0,0 +1,58 @@ +installmentOptions)) { + $object->installmentOptions = []; + foreach ($this->installmentOptions as $element) { + if (!is_null($element)) { + $object->installmentOptions[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'installmentOptions')) { + if (!is_array($object->installmentOptions) && !is_object($object->installmentOptions)) { + throw new UnexpectedValueException('value \'' . print_r($object->installmentOptions, true) . '\' is not an array or object'); + } + $this->installmentOptions = []; + foreach ($object->installmentOptions as $element) { + $value = new InstallmentOptions(); + $this->installmentOptions[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Installments.php b/src/Worldline/Connect/Sdk/V1/Domain/Installments.php new file mode 100644 index 0000000..ae0e6bd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Installments.php @@ -0,0 +1,109 @@ +amountOfMoneyPerInstallment)) { + $object->amountOfMoneyPerInstallment = $this->amountOfMoneyPerInstallment->toObject(); + } + if (!is_null($this->amountOfMoneyTotal)) { + $object->amountOfMoneyTotal = $this->amountOfMoneyTotal->toObject(); + } + if (!is_null($this->frequencyOfInstallments)) { + $object->frequencyOfInstallments = $this->frequencyOfInstallments; + } + if (!is_null($this->installmentPlanCode)) { + $object->installmentPlanCode = $this->installmentPlanCode; + } + if (!is_null($this->interestRate)) { + $object->interestRate = $this->interestRate; + } + if (!is_null($this->numberOfInstallments)) { + $object->numberOfInstallments = $this->numberOfInstallments; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoneyPerInstallment')) { + if (!is_object($object->amountOfMoneyPerInstallment)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoneyPerInstallment, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoneyPerInstallment = $value->fromObject($object->amountOfMoneyPerInstallment); + } + if (property_exists($object, 'amountOfMoneyTotal')) { + if (!is_object($object->amountOfMoneyTotal)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoneyTotal, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoneyTotal = $value->fromObject($object->amountOfMoneyTotal); + } + if (property_exists($object, 'frequencyOfInstallments')) { + $this->frequencyOfInstallments = $object->frequencyOfInstallments; + } + if (property_exists($object, 'installmentPlanCode')) { + $this->installmentPlanCode = $object->installmentPlanCode; + } + if (property_exists($object, 'interestRate')) { + $this->interestRate = $object->interestRate; + } + if (property_exists($object, 'numberOfInstallments')) { + $this->numberOfInstallments = $object->numberOfInstallments; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificInput.php new file mode 100644 index 0000000..471c906 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificInput.php @@ -0,0 +1,45 @@ +additionalReference)) { + $object->additionalReference = $this->additionalReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalReference')) { + $this->additionalReference = $object->additionalReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificOutput.php new file mode 100644 index 0000000..52a1dc6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/InvoicePaymentMethodSpecificOutput.php @@ -0,0 +1,49 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/KeyValuePair.php b/src/Worldline/Connect/Sdk/V1/Domain/KeyValuePair.php new file mode 100644 index 0000000..ad1db93 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/KeyValuePair.php @@ -0,0 +1,57 @@ +key)) { + $object->key = $this->key; + } + if (!is_null($this->value)) { + $object->value = $this->value; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'key')) { + $this->key = $object->key; + } + if (property_exists($object, 'value')) { + $this->value = $object->value; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LabelTemplateElement.php b/src/Worldline/Connect/Sdk/V1/Domain/LabelTemplateElement.php new file mode 100644 index 0000000..49994e0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LabelTemplateElement.php @@ -0,0 +1,57 @@ +attributeKey)) { + $object->attributeKey = $this->attributeKey; + } + if (!is_null($this->mask)) { + $object->mask = $this->mask; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'attributeKey')) { + $this->attributeKey = $object->attributeKey; + } + if (property_exists($object, 'mask')) { + $this->mask = $object->mask; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LengthValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/LengthValidator.php new file mode 100644 index 0000000..41e5db3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LengthValidator.php @@ -0,0 +1,57 @@ +maxLength)) { + $object->maxLength = $this->maxLength; + } + if (!is_null($this->minLength)) { + $object->minLength = $this->minLength; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'maxLength')) { + $this->maxLength = $object->maxLength; + } + if (property_exists($object, 'minLength')) { + $this->minLength = $object->minLength; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Level3SummaryData.php b/src/Worldline/Connect/Sdk/V1/Domain/Level3SummaryData.php new file mode 100644 index 0000000..97e4f01 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Level3SummaryData.php @@ -0,0 +1,72 @@ +discountAmount)) { + $object->discountAmount = $this->discountAmount; + } + if (!is_null($this->dutyAmount)) { + $object->dutyAmount = $this->dutyAmount; + } + if (!is_null($this->shippingAmount)) { + $object->shippingAmount = $this->shippingAmount; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'discountAmount')) { + $this->discountAmount = $object->discountAmount; + } + if (property_exists($object, 'dutyAmount')) { + $this->dutyAmount = $object->dutyAmount; + } + if (property_exists($object, 'shippingAmount')) { + $this->shippingAmount = $object->shippingAmount; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LineItem.php b/src/Worldline/Connect/Sdk/V1/Domain/LineItem.php new file mode 100644 index 0000000..85a7da0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LineItem.php @@ -0,0 +1,96 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->invoiceData)) { + $object->invoiceData = $this->invoiceData->toObject(); + } + if (!is_null($this->level3InterchangeInformation)) { + $object->level3InterchangeInformation = $this->level3InterchangeInformation->toObject(); + } + if (!is_null($this->orderLineDetails)) { + $object->orderLineDetails = $this->orderLineDetails->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'invoiceData')) { + if (!is_object($object->invoiceData)) { + throw new UnexpectedValueException('value \'' . print_r($object->invoiceData, true) . '\' is not an object'); + } + $value = new LineItemInvoiceData(); + $this->invoiceData = $value->fromObject($object->invoiceData); + } + if (property_exists($object, 'level3InterchangeInformation')) { + if (!is_object($object->level3InterchangeInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->level3InterchangeInformation, true) . '\' is not an object'); + } + $value = new LineItemLevel3InterchangeInformation(); + $this->level3InterchangeInformation = $value->fromObject($object->level3InterchangeInformation); + } + if (property_exists($object, 'orderLineDetails')) { + if (!is_object($object->orderLineDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->orderLineDetails, true) . '\' is not an object'); + } + $value = new OrderLineDetails(); + $this->orderLineDetails = $value->fromObject($object->orderLineDetails); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LineItemInvoiceData.php b/src/Worldline/Connect/Sdk/V1/Domain/LineItemInvoiceData.php new file mode 100644 index 0000000..257bbf7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LineItemInvoiceData.php @@ -0,0 +1,90 @@ +description)) { + $object->description = $this->description; + } + if (!is_null($this->merchantLinenumber)) { + $object->merchantLinenumber = $this->merchantLinenumber; + } + if (!is_null($this->merchantPagenumber)) { + $object->merchantPagenumber = $this->merchantPagenumber; + } + if (!is_null($this->nrOfItems)) { + $object->nrOfItems = $this->nrOfItems; + } + if (!is_null($this->pricePerItem)) { + $object->pricePerItem = $this->pricePerItem; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'description')) { + $this->description = $object->description; + } + if (property_exists($object, 'merchantLinenumber')) { + $this->merchantLinenumber = $object->merchantLinenumber; + } + if (property_exists($object, 'merchantPagenumber')) { + $this->merchantPagenumber = $object->merchantPagenumber; + } + if (property_exists($object, 'nrOfItems')) { + $this->nrOfItems = $object->nrOfItems; + } + if (property_exists($object, 'pricePerItem')) { + $this->pricePerItem = $object->pricePerItem; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LineItemLevel3InterchangeInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/LineItemLevel3InterchangeInformation.php new file mode 100644 index 0000000..25260a0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LineItemLevel3InterchangeInformation.php @@ -0,0 +1,123 @@ +discountAmount)) { + $object->discountAmount = $this->discountAmount; + } + if (!is_null($this->lineAmountTotal)) { + $object->lineAmountTotal = $this->lineAmountTotal; + } + if (!is_null($this->productCode)) { + $object->productCode = $this->productCode; + } + if (!is_null($this->productPrice)) { + $object->productPrice = $this->productPrice; + } + if (!is_null($this->productType)) { + $object->productType = $this->productType; + } + if (!is_null($this->quantity)) { + $object->quantity = $this->quantity; + } + if (!is_null($this->taxAmount)) { + $object->taxAmount = $this->taxAmount; + } + if (!is_null($this->unit)) { + $object->unit = $this->unit; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'discountAmount')) { + $this->discountAmount = $object->discountAmount; + } + if (property_exists($object, 'lineAmountTotal')) { + $this->lineAmountTotal = $object->lineAmountTotal; + } + if (property_exists($object, 'productCode')) { + $this->productCode = $object->productCode; + } + if (property_exists($object, 'productPrice')) { + $this->productPrice = $object->productPrice; + } + if (property_exists($object, 'productType')) { + $this->productType = $object->productType; + } + if (property_exists($object, 'quantity')) { + $this->quantity = $object->quantity; + } + if (property_exists($object, 'taxAmount')) { + $this->taxAmount = $object->taxAmount; + } + if (property_exists($object, 'unit')) { + $this->unit = $object->unit; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LoanRecipient.php b/src/Worldline/Connect/Sdk/V1/Domain/LoanRecipient.php new file mode 100644 index 0000000..0bb95c0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LoanRecipient.php @@ -0,0 +1,96 @@ +accountNumber)) { + $object->accountNumber = $this->accountNumber; + } + if (!is_null($this->dateOfBirth)) { + $object->dateOfBirth = $this->dateOfBirth; + } + if (!is_null($this->partialPan)) { + $object->partialPan = $this->partialPan; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountNumber')) { + $this->accountNumber = $object->accountNumber; + } + if (property_exists($object, 'dateOfBirth')) { + $this->dateOfBirth = $object->dateOfBirth; + } + if (property_exists($object, 'partialPan')) { + $this->partialPan = $object->partialPan; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LodgingCharge.php b/src/Worldline/Connect/Sdk/V1/Domain/LodgingCharge.php new file mode 100644 index 0000000..7cf97e7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LodgingCharge.php @@ -0,0 +1,68 @@ +chargeAmount)) { + $object->chargeAmount = $this->chargeAmount; + } + if (!is_null($this->chargeAmountCurrencyCode)) { + $object->chargeAmountCurrencyCode = $this->chargeAmountCurrencyCode; + } + if (!is_null($this->chargeType)) { + $object->chargeType = $this->chargeType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'chargeAmount')) { + $this->chargeAmount = $object->chargeAmount; + } + if (property_exists($object, 'chargeAmountCurrencyCode')) { + $this->chargeAmountCurrencyCode = $object->chargeAmountCurrencyCode; + } + if (property_exists($object, 'chargeType')) { + $this->chargeType = $object->chargeType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LodgingData.php b/src/Worldline/Connect/Sdk/V1/Domain/LodgingData.php new file mode 100644 index 0000000..e012d4b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LodgingData.php @@ -0,0 +1,235 @@ +charges)) { + $object->charges = []; + foreach ($this->charges as $element) { + if (!is_null($element)) { + $object->charges[] = $element->toObject(); + } + } + } + if (!is_null($this->checkInDate)) { + $object->checkInDate = $this->checkInDate; + } + if (!is_null($this->checkOutDate)) { + $object->checkOutDate = $this->checkOutDate; + } + if (!is_null($this->folioNumber)) { + $object->folioNumber = $this->folioNumber; + } + if (!is_null($this->isConfirmedReservation)) { + $object->isConfirmedReservation = $this->isConfirmedReservation; + } + if (!is_null($this->isFacilityFireSafetyConform)) { + $object->isFacilityFireSafetyConform = $this->isFacilityFireSafetyConform; + } + if (!is_null($this->isNoShow)) { + $object->isNoShow = $this->isNoShow; + } + if (!is_null($this->isPreferenceSmokingRoom)) { + $object->isPreferenceSmokingRoom = $this->isPreferenceSmokingRoom; + } + if (!is_null($this->numberOfAdults)) { + $object->numberOfAdults = $this->numberOfAdults; + } + if (!is_null($this->numberOfNights)) { + $object->numberOfNights = $this->numberOfNights; + } + if (!is_null($this->numberOfRooms)) { + $object->numberOfRooms = $this->numberOfRooms; + } + if (!is_null($this->programCode)) { + $object->programCode = $this->programCode; + } + if (!is_null($this->propertyCustomerServicePhoneNumber)) { + $object->propertyCustomerServicePhoneNumber = $this->propertyCustomerServicePhoneNumber; + } + if (!is_null($this->propertyPhoneNumber)) { + $object->propertyPhoneNumber = $this->propertyPhoneNumber; + } + if (!is_null($this->renterName)) { + $object->renterName = $this->renterName; + } + if (!is_null($this->rooms)) { + $object->rooms = []; + foreach ($this->rooms as $element) { + if (!is_null($element)) { + $object->rooms[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'charges')) { + if (!is_array($object->charges) && !is_object($object->charges)) { + throw new UnexpectedValueException('value \'' . print_r($object->charges, true) . '\' is not an array or object'); + } + $this->charges = []; + foreach ($object->charges as $element) { + $value = new LodgingCharge(); + $this->charges[] = $value->fromObject($element); + } + } + if (property_exists($object, 'checkInDate')) { + $this->checkInDate = $object->checkInDate; + } + if (property_exists($object, 'checkOutDate')) { + $this->checkOutDate = $object->checkOutDate; + } + if (property_exists($object, 'folioNumber')) { + $this->folioNumber = $object->folioNumber; + } + if (property_exists($object, 'isConfirmedReservation')) { + $this->isConfirmedReservation = $object->isConfirmedReservation; + } + if (property_exists($object, 'isFacilityFireSafetyConform')) { + $this->isFacilityFireSafetyConform = $object->isFacilityFireSafetyConform; + } + if (property_exists($object, 'isNoShow')) { + $this->isNoShow = $object->isNoShow; + } + if (property_exists($object, 'isPreferenceSmokingRoom')) { + $this->isPreferenceSmokingRoom = $object->isPreferenceSmokingRoom; + } + if (property_exists($object, 'numberOfAdults')) { + $this->numberOfAdults = $object->numberOfAdults; + } + if (property_exists($object, 'numberOfNights')) { + $this->numberOfNights = $object->numberOfNights; + } + if (property_exists($object, 'numberOfRooms')) { + $this->numberOfRooms = $object->numberOfRooms; + } + if (property_exists($object, 'programCode')) { + $this->programCode = $object->programCode; + } + if (property_exists($object, 'propertyCustomerServicePhoneNumber')) { + $this->propertyCustomerServicePhoneNumber = $object->propertyCustomerServicePhoneNumber; + } + if (property_exists($object, 'propertyPhoneNumber')) { + $this->propertyPhoneNumber = $object->propertyPhoneNumber; + } + if (property_exists($object, 'renterName')) { + $this->renterName = $object->renterName; + } + if (property_exists($object, 'rooms')) { + if (!is_array($object->rooms) && !is_object($object->rooms)) { + throw new UnexpectedValueException('value \'' . print_r($object->rooms, true) . '\' is not an array or object'); + } + $this->rooms = []; + foreach ($object->rooms as $element) { + $value = new LodgingRoom(); + $this->rooms[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/LodgingRoom.php b/src/Worldline/Connect/Sdk/V1/Domain/LodgingRoom.php new file mode 100644 index 0000000..0c0b5b9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/LodgingRoom.php @@ -0,0 +1,134 @@ +dailyRoomRate)) { + $object->dailyRoomRate = $this->dailyRoomRate; + } + if (!is_null($this->dailyRoomRateCurrencyCode)) { + $object->dailyRoomRateCurrencyCode = $this->dailyRoomRateCurrencyCode; + } + if (!is_null($this->dailyRoomTaxAmount)) { + $object->dailyRoomTaxAmount = $this->dailyRoomTaxAmount; + } + if (!is_null($this->dailyRoomTaxAmountCurrencyCode)) { + $object->dailyRoomTaxAmountCurrencyCode = $this->dailyRoomTaxAmountCurrencyCode; + } + if (!is_null($this->numberOfNightsAtRoomRate)) { + $object->numberOfNightsAtRoomRate = $this->numberOfNightsAtRoomRate; + } + if (!is_null($this->roomLocation)) { + $object->roomLocation = $this->roomLocation; + } + if (!is_null($this->roomNumber)) { + $object->roomNumber = $this->roomNumber; + } + if (!is_null($this->typeOfBed)) { + $object->typeOfBed = $this->typeOfBed; + } + if (!is_null($this->typeOfRoom)) { + $object->typeOfRoom = $this->typeOfRoom; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dailyRoomRate')) { + $this->dailyRoomRate = $object->dailyRoomRate; + } + if (property_exists($object, 'dailyRoomRateCurrencyCode')) { + $this->dailyRoomRateCurrencyCode = $object->dailyRoomRateCurrencyCode; + } + if (property_exists($object, 'dailyRoomTaxAmount')) { + $this->dailyRoomTaxAmount = $object->dailyRoomTaxAmount; + } + if (property_exists($object, 'dailyRoomTaxAmountCurrencyCode')) { + $this->dailyRoomTaxAmountCurrencyCode = $object->dailyRoomTaxAmountCurrencyCode; + } + if (property_exists($object, 'numberOfNightsAtRoomRate')) { + $this->numberOfNightsAtRoomRate = $object->numberOfNightsAtRoomRate; + } + if (property_exists($object, 'roomLocation')) { + $this->roomLocation = $object->roomLocation; + } + if (property_exists($object, 'roomNumber')) { + $this->roomNumber = $object->roomNumber; + } + if (property_exists($object, 'typeOfBed')) { + $this->typeOfBed = $object->typeOfBed; + } + if (property_exists($object, 'typeOfRoom')) { + $this->typeOfRoom = $object->typeOfRoom; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateAddress.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateAddress.php new file mode 100644 index 0000000..78d4bba --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateAddress.php @@ -0,0 +1,90 @@ +city)) { + $object->city = $this->city; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->houseNumber)) { + $object->houseNumber = $this->houseNumber; + } + if (!is_null($this->street)) { + $object->street = $this->street; + } + if (!is_null($this->zip)) { + $object->zip = $this->zip; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'city')) { + $this->city = $object->city; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'houseNumber')) { + $this->houseNumber = $object->houseNumber; + } + if (property_exists($object, 'street')) { + $this->street = $object->street; + } + if (property_exists($object, 'zip')) { + $this->zip = $object->zip; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateApproval.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateApproval.php new file mode 100644 index 0000000..6268f1a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateApproval.php @@ -0,0 +1,68 @@ +mandateSignatureDate)) { + $object->mandateSignatureDate = $this->mandateSignatureDate; + } + if (!is_null($this->mandateSignaturePlace)) { + $object->mandateSignaturePlace = $this->mandateSignaturePlace; + } + if (!is_null($this->mandateSigned)) { + $object->mandateSigned = $this->mandateSigned; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandateSignatureDate')) { + $this->mandateSignatureDate = $object->mandateSignatureDate; + } + if (property_exists($object, 'mandateSignaturePlace')) { + $this->mandateSignaturePlace = $object->mandateSignaturePlace; + } + if (property_exists($object, 'mandateSigned')) { + $this->mandateSigned = $object->mandateSigned; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateContactDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateContactDetails.php new file mode 100644 index 0000000..3216148 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateContactDetails.php @@ -0,0 +1,46 @@ +emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateCustomer.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateCustomer.php new file mode 100644 index 0000000..2e755b2 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateCustomer.php @@ -0,0 +1,106 @@ +bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->companyName)) { + $object->companyName = $this->companyName; + } + if (!is_null($this->contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + if (!is_null($this->mandateAddress)) { + $object->mandateAddress = $this->mandateAddress->toObject(); + } + if (!is_null($this->personalInformation)) { + $object->personalInformation = $this->personalInformation->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'companyName')) { + $this->companyName = $object->companyName; + } + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new MandateContactDetails(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + if (property_exists($object, 'mandateAddress')) { + if (!is_object($object->mandateAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandateAddress, true) . '\' is not an object'); + } + $value = new MandateAddress(); + $this->mandateAddress = $value->fromObject($object->mandateAddress); + } + if (property_exists($object, 'personalInformation')) { + if (!is_object($object->personalInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); + } + $value = new MandatePersonalInformation(); + $this->personalInformation = $value->fromObject($object->personalInformation); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateMerchantAction.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateMerchantAction.php new file mode 100644 index 0000000..b09e2d5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateMerchantAction.php @@ -0,0 +1,61 @@ +actionType)) { + $object->actionType = $this->actionType; + } + if (!is_null($this->redirectData)) { + $object->redirectData = $this->redirectData->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'actionType')) { + $this->actionType = $object->actionType; + } + if (property_exists($object, 'redirectData')) { + if (!is_object($object->redirectData)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectData, true) . '\' is not an object'); + } + $value = new MandateRedirectData(); + $this->redirectData = $value->fromObject($object->redirectData); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateNonSepaDirectDebit.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateNonSepaDirectDebit.php new file mode 100644 index 0000000..4bcd748 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateNonSepaDirectDebit.php @@ -0,0 +1,65 @@ +paymentProduct705SpecificData)) { + $object->paymentProduct705SpecificData = $this->paymentProduct705SpecificData->toObject(); + } + if (!is_null($this->paymentProduct730SpecificData)) { + $object->paymentProduct730SpecificData = $this->paymentProduct730SpecificData->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct705SpecificData')) { + if (!is_object($object->paymentProduct705SpecificData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct705SpecificData, true) . '\' is not an object'); + } + $value = new TokenNonSepaDirectDebitPaymentProduct705SpecificData(); + $this->paymentProduct705SpecificData = $value->fromObject($object->paymentProduct705SpecificData); + } + if (property_exists($object, 'paymentProduct730SpecificData')) { + if (!is_object($object->paymentProduct730SpecificData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct730SpecificData, true) . '\' is not an object'); + } + $value = new TokenNonSepaDirectDebitPaymentProduct730SpecificData(); + $this->paymentProduct730SpecificData = $value->fromObject($object->paymentProduct730SpecificData); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalInformation.php new file mode 100644 index 0000000..5fe6a6e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalInformation.php @@ -0,0 +1,61 @@ +name)) { + $object->name = $this->name->toObject(); + } + if (!is_null($this->title)) { + $object->title = $this->title; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new MandatePersonalName(); + $this->name = $value->fromObject($object->name); + } + if (property_exists($object, 'title')) { + $this->title = $object->title; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalName.php b/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalName.php new file mode 100644 index 0000000..82c9ea4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandatePersonalName.php @@ -0,0 +1,57 @@ +firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateRedirectData.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateRedirectData.php new file mode 100644 index 0000000..027055f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateRedirectData.php @@ -0,0 +1,34 @@ +alias)) { + $object->alias = $this->alias; + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->recurrenceType)) { + $object->recurrenceType = $this->recurrenceType; + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->uniqueMandateReference)) { + $object->uniqueMandateReference = $this->uniqueMandateReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alias')) { + $this->alias = $object->alias; + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new MandateCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'recurrenceType')) { + $this->recurrenceType = $object->recurrenceType; + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'uniqueMandateReference')) { + $this->uniqueMandateReference = $object->uniqueMandateReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebit.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebit.php new file mode 100644 index 0000000..ffd03f8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebit.php @@ -0,0 +1,49 @@ +creditor)) { + $object->creditor = $this->creditor->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'creditor')) { + if (!is_object($object->creditor)) { + throw new UnexpectedValueException('value \'' . print_r($object->creditor, true) . '\' is not an object'); + } + $value = new Creditor(); + $this->creditor = $value->fromObject($object->creditor); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithMandateId.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithMandateId.php new file mode 100644 index 0000000..ad43f1e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithMandateId.php @@ -0,0 +1,45 @@ +mandateId)) { + $object->mandateId = $this->mandateId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandateId')) { + $this->mandateId = $object->mandateId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithoutCreditor.php b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithoutCreditor.php new file mode 100644 index 0000000..1c1b54c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MandateSepaDirectDebitWithoutCreditor.php @@ -0,0 +1,113 @@ +bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->customerContractIdentifier)) { + $object->customerContractIdentifier = $this->customerContractIdentifier; + } + if (!is_null($this->debtor)) { + $object->debtor = $this->debtor->toObject(); + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->mandateApproval)) { + $object->mandateApproval = $this->mandateApproval->toObject(); + } + if (!is_null($this->preNotification)) { + $object->preNotification = $this->preNotification; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'customerContractIdentifier')) { + $this->customerContractIdentifier = $object->customerContractIdentifier; + } + if (property_exists($object, 'debtor')) { + if (!is_object($object->debtor)) { + throw new UnexpectedValueException('value \'' . print_r($object->debtor, true) . '\' is not an object'); + } + $value = new Debtor(); + $this->debtor = $value->fromObject($object->debtor); + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'mandateApproval')) { + if (!is_object($object->mandateApproval)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandateApproval, true) . '\' is not an object'); + } + $value = new MandateApproval(); + $this->mandateApproval = $value->fromObject($object->mandateApproval); + } + if (property_exists($object, 'preNotification')) { + $this->preNotification = $object->preNotification; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Merchant.php b/src/Worldline/Connect/Sdk/V1/Domain/Merchant.php new file mode 100644 index 0000000..6cd7bd6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Merchant.php @@ -0,0 +1,83 @@ +configurationId)) { + $object->configurationId = $this->configurationId; + } + if (!is_null($this->contactWebsiteUrl)) { + $object->contactWebsiteUrl = $this->contactWebsiteUrl; + } + if (!is_null($this->seller)) { + $object->seller = $this->seller->toObject(); + } + if (!is_null($this->websiteUrl)) { + $object->websiteUrl = $this->websiteUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'configurationId')) { + $this->configurationId = $object->configurationId; + } + if (property_exists($object, 'contactWebsiteUrl')) { + $this->contactWebsiteUrl = $object->contactWebsiteUrl; + } + if (property_exists($object, 'seller')) { + if (!is_object($object->seller)) { + throw new UnexpectedValueException('value \'' . print_r($object->seller, true) . '\' is not an object'); + } + $value = new Seller(); + $this->seller = $value->fromObject($object->seller); + } + if (property_exists($object, 'websiteUrl')) { + $this->websiteUrl = $object->websiteUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MerchantAction.php b/src/Worldline/Connect/Sdk/V1/Domain/MerchantAction.php new file mode 100644 index 0000000..2373a00 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MerchantAction.php @@ -0,0 +1,148 @@ +actionType)) { + $object->actionType = $this->actionType; + } + if (!is_null($this->formFields)) { + $object->formFields = []; + foreach ($this->formFields as $element) { + if (!is_null($element)) { + $object->formFields[] = $element->toObject(); + } + } + } + if (!is_null($this->mobileThreeDSecureChallengeParameters)) { + $object->mobileThreeDSecureChallengeParameters = $this->mobileThreeDSecureChallengeParameters->toObject(); + } + if (!is_null($this->redirectData)) { + $object->redirectData = $this->redirectData->toObject(); + } + if (!is_null($this->renderingData)) { + $object->renderingData = $this->renderingData; + } + if (!is_null($this->showData)) { + $object->showData = []; + foreach ($this->showData as $element) { + if (!is_null($element)) { + $object->showData[] = $element->toObject(); + } + } + } + if (!is_null($this->thirdPartyData)) { + $object->thirdPartyData = $this->thirdPartyData->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'actionType')) { + $this->actionType = $object->actionType; + } + if (property_exists($object, 'formFields')) { + if (!is_array($object->formFields) && !is_object($object->formFields)) { + throw new UnexpectedValueException('value \'' . print_r($object->formFields, true) . '\' is not an array or object'); + } + $this->formFields = []; + foreach ($object->formFields as $element) { + $value = new PaymentProductField(); + $this->formFields[] = $value->fromObject($element); + } + } + if (property_exists($object, 'mobileThreeDSecureChallengeParameters')) { + if (!is_object($object->mobileThreeDSecureChallengeParameters)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobileThreeDSecureChallengeParameters, true) . '\' is not an object'); + } + $value = new MobileThreeDSecureChallengeParameters(); + $this->mobileThreeDSecureChallengeParameters = $value->fromObject($object->mobileThreeDSecureChallengeParameters); + } + if (property_exists($object, 'redirectData')) { + if (!is_object($object->redirectData)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectData, true) . '\' is not an object'); + } + $value = new RedirectData(); + $this->redirectData = $value->fromObject($object->redirectData); + } + if (property_exists($object, 'renderingData')) { + $this->renderingData = $object->renderingData; + } + if (property_exists($object, 'showData')) { + if (!is_array($object->showData) && !is_object($object->showData)) { + throw new UnexpectedValueException('value \'' . print_r($object->showData, true) . '\' is not an array or object'); + } + $this->showData = []; + foreach ($object->showData as $element) { + $value = new KeyValuePair(); + $this->showData[] = $value->fromObject($element); + } + } + if (property_exists($object, 'thirdPartyData')) { + if (!is_object($object->thirdPartyData)) { + throw new UnexpectedValueException('value \'' . print_r($object->thirdPartyData, true) . '\' is not an object'); + } + $value = new ThirdPartyData(); + $this->thirdPartyData = $value->fromObject($object->thirdPartyData); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MerchantRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/MerchantRiskAssessment.php new file mode 100644 index 0000000..39e2b98 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MerchantRiskAssessment.php @@ -0,0 +1,46 @@ +websiteUrl)) { + $object->websiteUrl = $this->websiteUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'websiteUrl')) { + $this->websiteUrl = $object->websiteUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MicrosoftFraudResults.php b/src/Worldline/Connect/Sdk/V1/Domain/MicrosoftFraudResults.php new file mode 100644 index 0000000..0c8d178 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MicrosoftFraudResults.php @@ -0,0 +1,112 @@ +clauseName)) { + $object->clauseName = $this->clauseName; + } + if (!is_null($this->deviceCountryCode)) { + $object->deviceCountryCode = $this->deviceCountryCode; + } + if (!is_null($this->deviceId)) { + $object->deviceId = $this->deviceId; + } + if (!is_null($this->fraudScore)) { + $object->fraudScore = $this->fraudScore; + } + if (!is_null($this->policyApplied)) { + $object->policyApplied = $this->policyApplied; + } + if (!is_null($this->trueIpAddress)) { + $object->trueIpAddress = $this->trueIpAddress; + } + if (!is_null($this->userDeviceType)) { + $object->userDeviceType = $this->userDeviceType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'clauseName')) { + $this->clauseName = $object->clauseName; + } + if (property_exists($object, 'deviceCountryCode')) { + $this->deviceCountryCode = $object->deviceCountryCode; + } + if (property_exists($object, 'deviceId')) { + $this->deviceId = $object->deviceId; + } + if (property_exists($object, 'fraudScore')) { + $this->fraudScore = $object->fraudScore; + } + if (property_exists($object, 'policyApplied')) { + $this->policyApplied = $object->policyApplied; + } + if (property_exists($object, 'trueIpAddress')) { + $this->trueIpAddress = $object->trueIpAddress; + } + if (property_exists($object, 'userDeviceType')) { + $this->userDeviceType = $object->userDeviceType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentData.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentData.php new file mode 100644 index 0000000..25f4775 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentData.php @@ -0,0 +1,57 @@ +dpan)) { + $object->dpan = $this->dpan; + } + if (!is_null($this->expiryDate)) { + $object->expiryDate = $this->expiryDate; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dpan')) { + $this->dpan = $object->dpan; + } + if (property_exists($object, 'expiryDate')) { + $this->expiryDate = $object->expiryDate; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInput.php new file mode 100644 index 0000000..41d1a30 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInput.php @@ -0,0 +1,119 @@ +authorizationMode)) { + $object->authorizationMode = $this->authorizationMode; + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->decryptedPaymentData)) { + $object->decryptedPaymentData = $this->decryptedPaymentData->toObject(); + } + if (!is_null($this->encryptedPaymentData)) { + $object->encryptedPaymentData = $this->encryptedPaymentData; + } + if (!is_null($this->paymentProduct320SpecificInput)) { + $object->paymentProduct320SpecificInput = $this->paymentProduct320SpecificInput->toObject(); + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->skipFraudService)) { + $object->skipFraudService = $this->skipFraudService; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorizationMode')) { + $this->authorizationMode = $object->authorizationMode; + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'decryptedPaymentData')) { + if (!is_object($object->decryptedPaymentData)) { + throw new UnexpectedValueException('value \'' . print_r($object->decryptedPaymentData, true) . '\' is not an object'); + } + $value = new DecryptedPaymentData(); + $this->decryptedPaymentData = $value->fromObject($object->decryptedPaymentData); + } + if (property_exists($object, 'encryptedPaymentData')) { + $this->encryptedPaymentData = $object->encryptedPaymentData; + } + if (property_exists($object, 'paymentProduct320SpecificInput')) { + if (!is_object($object->paymentProduct320SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct320SpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentProduct320SpecificInput(); + $this->paymentProduct320SpecificInput = $value->fromObject($object->paymentProduct320SpecificInput); + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'skipFraudService')) { + $this->skipFraudService = $object->skipFraudService; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInputHostedCheckout.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInputHostedCheckout.php new file mode 100644 index 0000000..84f7479 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificInputHostedCheckout.php @@ -0,0 +1,108 @@ +authorizationMode)) { + $object->authorizationMode = $this->authorizationMode; + } + if (!is_null($this->customerReference)) { + $object->customerReference = $this->customerReference; + } + if (!is_null($this->paymentProduct302SpecificInput)) { + $object->paymentProduct302SpecificInput = $this->paymentProduct302SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct320SpecificInput)) { + $object->paymentProduct320SpecificInput = $this->paymentProduct320SpecificInput->toObject(); + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->skipFraudService)) { + $object->skipFraudService = $this->skipFraudService; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorizationMode')) { + $this->authorizationMode = $object->authorizationMode; + } + if (property_exists($object, 'customerReference')) { + $this->customerReference = $object->customerReference; + } + if (property_exists($object, 'paymentProduct302SpecificInput')) { + if (!is_object($object->paymentProduct302SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct302SpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentProduct302SpecificInputHostedCheckout(); + $this->paymentProduct302SpecificInput = $value->fromObject($object->paymentProduct302SpecificInput); + } + if (property_exists($object, 'paymentProduct320SpecificInput')) { + if (!is_object($object->paymentProduct320SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct320SpecificInput, true) . '\' is not an object'); + } + $value = new MobilePaymentProduct320SpecificInputHostedCheckout(); + $this->paymentProduct320SpecificInput = $value->fromObject($object->paymentProduct320SpecificInput); + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'skipFraudService')) { + $this->skipFraudService = $object->skipFraudService; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificOutput.php new file mode 100644 index 0000000..c9ad382 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentMethodSpecificOutput.php @@ -0,0 +1,101 @@ +authorisationCode)) { + $object->authorisationCode = $this->authorisationCode; + } + if (!is_null($this->fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + if (!is_null($this->network)) { + $object->network = $this->network; + } + if (!is_null($this->paymentData)) { + $object->paymentData = $this->paymentData->toObject(); + } + if (!is_null($this->threeDSecureResults)) { + $object->threeDSecureResults = $this->threeDSecureResults->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorisationCode')) { + $this->authorisationCode = $object->authorisationCode; + } + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new CardFraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + if (property_exists($object, 'network')) { + $this->network = $object->network; + } + if (property_exists($object, 'paymentData')) { + if (!is_object($object->paymentData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentData, true) . '\' is not an object'); + } + $value = new MobilePaymentData(); + $this->paymentData = $value->fromObject($object->paymentData); + } + if (property_exists($object, 'threeDSecureResults')) { + if (!is_object($object->threeDSecureResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecureResults, true) . '\' is not an object'); + } + $value = new ThreeDSecureResults(); + $this->threeDSecureResults = $value->fromObject($object->threeDSecureResults); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct302SpecificInputHostedCheckout.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct302SpecificInputHostedCheckout.php new file mode 100644 index 0000000..f73dd92 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct302SpecificInputHostedCheckout.php @@ -0,0 +1,46 @@ +businessName)) { + $object->businessName = $this->businessName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'businessName')) { + $this->businessName = $object->businessName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInput.php new file mode 100644 index 0000000..6f8d0a6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInput.php @@ -0,0 +1,61 @@ +cardholderName)) { + $object->cardholderName = $this->cardholderName; + } + if (!is_null($this->threeDSecure)) { + $object->threeDSecure = $this->threeDSecure->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardholderName')) { + $this->cardholderName = $object->cardholderName; + } + if (property_exists($object, 'threeDSecure')) { + if (!is_object($object->threeDSecure)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecure, true) . '\' is not an object'); + } + $value = new GPayThreeDSecure(); + $this->threeDSecure = $value->fromObject($object->threeDSecure); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInputHostedCheckout.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInputHostedCheckout.php new file mode 100644 index 0000000..9ec4509 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProduct320SpecificInputHostedCheckout.php @@ -0,0 +1,72 @@ +merchantName)) { + $object->merchantName = $this->merchantName; + } + if (!is_null($this->merchantOrigin)) { + $object->merchantOrigin = $this->merchantOrigin; + } + if (!is_null($this->threeDSecure)) { + $object->threeDSecure = $this->threeDSecure->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'merchantName')) { + $this->merchantName = $object->merchantName; + } + if (property_exists($object, 'merchantOrigin')) { + $this->merchantOrigin = $object->merchantOrigin; + } + if (property_exists($object, 'threeDSecure')) { + if (!is_object($object->threeDSecure)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecure, true) . '\' is not an object'); + } + $value = new GPayThreeDSecure(); + $this->threeDSecure = $value->fromObject($object->threeDSecure); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificInput.php new file mode 100644 index 0000000..00be0ef --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificInput.php @@ -0,0 +1,68 @@ +displayName)) { + $object->displayName = $this->displayName; + } + if (!is_null($this->domainName)) { + $object->domainName = $this->domainName; + } + if (!is_null($this->validationUrl)) { + $object->validationUrl = $this->validationUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayName')) { + $this->displayName = $object->displayName; + } + if (property_exists($object, 'domainName')) { + $this->domainName = $object->domainName; + } + if (property_exists($object, 'validationUrl')) { + $this->validationUrl = $object->validationUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificOutput.php new file mode 100644 index 0000000..91c9030 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobilePaymentProductSession302SpecificOutput.php @@ -0,0 +1,46 @@ +sessionObject)) { + $object->sessionObject = $this->sessionObject; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'sessionObject')) { + $this->sessionObject = $object->sessionObject; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/MobileThreeDSecureChallengeParameters.php b/src/Worldline/Connect/Sdk/V1/Domain/MobileThreeDSecureChallengeParameters.php new file mode 100644 index 0000000..7e5742a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/MobileThreeDSecureChallengeParameters.php @@ -0,0 +1,79 @@ +acsReferenceNumber)) { + $object->acsReferenceNumber = $this->acsReferenceNumber; + } + if (!is_null($this->acsSignedContent)) { + $object->acsSignedContent = $this->acsSignedContent; + } + if (!is_null($this->acsTransactionId)) { + $object->acsTransactionId = $this->acsTransactionId; + } + if (!is_null($this->threeDServerTransactionId)) { + $object->threeDServerTransactionId = $this->threeDServerTransactionId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acsReferenceNumber')) { + $this->acsReferenceNumber = $object->acsReferenceNumber; + } + if (property_exists($object, 'acsSignedContent')) { + $this->acsSignedContent = $object->acsSignedContent; + } + if (property_exists($object, 'acsTransactionId')) { + $this->acsTransactionId = $object->acsTransactionId; + } + if (property_exists($object, 'threeDServerTransactionId')) { + $this->threeDServerTransactionId = $object->threeDServerTransactionId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..442d6a4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,141 @@ +dateCollect)) { + $object->dateCollect = $this->dateCollect; + } + if (!is_null($this->directDebitText)) { + $object->directDebitText = $this->directDebitText; + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->paymentProduct705SpecificInput)) { + $object->paymentProduct705SpecificInput = $this->paymentProduct705SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct730SpecificInput)) { + $object->paymentProduct730SpecificInput = $this->paymentProduct730SpecificInput->toObject(); + } + if (!is_null($this->recurringPaymentSequenceIndicator)) { + $object->recurringPaymentSequenceIndicator = $this->recurringPaymentSequenceIndicator; + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + if (!is_null($this->tokenize)) { + $object->tokenize = $this->tokenize; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dateCollect')) { + $this->dateCollect = $object->dateCollect; + } + if (property_exists($object, 'directDebitText')) { + $this->directDebitText = $object->directDebitText; + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'paymentProduct705SpecificInput')) { + if (!is_object($object->paymentProduct705SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct705SpecificInput, true) . '\' is not an object'); + } + $value = new NonSepaDirectDebitPaymentProduct705SpecificInput(); + $this->paymentProduct705SpecificInput = $value->fromObject($object->paymentProduct705SpecificInput); + } + if (property_exists($object, 'paymentProduct730SpecificInput')) { + if (!is_object($object->paymentProduct730SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct730SpecificInput, true) . '\' is not an object'); + } + $value = new NonSepaDirectDebitPaymentProduct730SpecificInput(); + $this->paymentProduct730SpecificInput = $value->fromObject($object->paymentProduct730SpecificInput); + } + if (property_exists($object, 'recurringPaymentSequenceIndicator')) { + $this->recurringPaymentSequenceIndicator = $object->recurringPaymentSequenceIndicator; + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + if (property_exists($object, 'tokenize')) { + $this->tokenize = $object->tokenize; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..ea7f374 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentMethodSpecificOutput.php @@ -0,0 +1,49 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct705SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct705SpecificInput.php new file mode 100644 index 0000000..8b5c3ee --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct705SpecificInput.php @@ -0,0 +1,72 @@ +authorisationId)) { + $object->authorisationId = $this->authorisationId; + } + if (!is_null($this->bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->transactionType)) { + $object->transactionType = $this->transactionType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorisationId')) { + $this->authorisationId = $object->authorisationId; + } + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'transactionType')) { + $this->transactionType = $object->transactionType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct730SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct730SpecificInput.php new file mode 100644 index 0000000..34613f4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/NonSepaDirectDebitPaymentProduct730SpecificInput.php @@ -0,0 +1,50 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Order.php b/src/Worldline/Connect/Sdk/V1/Domain/Order.php new file mode 100644 index 0000000..d96419f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Order.php @@ -0,0 +1,165 @@ +additionalInput)) { + $object->additionalInput = $this->additionalInput->toObject(); + } + if (!is_null($this->amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->items)) { + $object->items = []; + foreach ($this->items as $element) { + if (!is_null($element)) { + $object->items[] = $element->toObject(); + } + } + } + if (!is_null($this->references)) { + $object->references = $this->references->toObject(); + } + if (!is_null($this->seller)) { + $object->seller = $this->seller->toObject(); + } + if (!is_null($this->shipping)) { + $object->shipping = $this->shipping->toObject(); + } + if (!is_null($this->shoppingCart)) { + $object->shoppingCart = $this->shoppingCart->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalInput')) { + if (!is_object($object->additionalInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->additionalInput, true) . '\' is not an object'); + } + $value = new AdditionalOrderInput(); + $this->additionalInput = $value->fromObject($object->additionalInput); + } + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new Customer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'items')) { + if (!is_array($object->items) && !is_object($object->items)) { + throw new UnexpectedValueException('value \'' . print_r($object->items, true) . '\' is not an array or object'); + } + $this->items = []; + foreach ($object->items as $element) { + $value = new LineItem(); + $this->items[] = $value->fromObject($element); + } + } + if (property_exists($object, 'references')) { + if (!is_object($object->references)) { + throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); + } + $value = new OrderReferences(); + $this->references = $value->fromObject($object->references); + } + if (property_exists($object, 'seller')) { + if (!is_object($object->seller)) { + throw new UnexpectedValueException('value \'' . print_r($object->seller, true) . '\' is not an object'); + } + $value = new Seller(); + $this->seller = $value->fromObject($object->seller); + } + if (property_exists($object, 'shipping')) { + if (!is_object($object->shipping)) { + throw new UnexpectedValueException('value \'' . print_r($object->shipping, true) . '\' is not an object'); + } + $value = new Shipping(); + $this->shipping = $value->fromObject($object->shipping); + } + if (property_exists($object, 'shoppingCart')) { + if (!is_object($object->shoppingCart)) { + throw new UnexpectedValueException('value \'' . print_r($object->shoppingCart, true) . '\' is not an object'); + } + $value = new ShoppingCart(); + $this->shoppingCart = $value->fromObject($object->shoppingCart); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderApprovePayment.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderApprovePayment.php new file mode 100644 index 0000000..e995df1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderApprovePayment.php @@ -0,0 +1,80 @@ +additionalInput)) { + $object->additionalInput = $this->additionalInput->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->references)) { + $object->references = $this->references->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalInput')) { + if (!is_object($object->additionalInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->additionalInput, true) . '\' is not an object'); + } + $value = new AdditionalOrderInputAirlineData(); + $this->additionalInput = $value->fromObject($object->additionalInput); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerApprovePayment(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'references')) { + if (!is_object($object->references)) { + throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); + } + $value = new OrderReferencesApprovePayment(); + $this->references = $value->fromObject($object->references); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderInvoiceData.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderInvoiceData.php new file mode 100644 index 0000000..a2f4b2d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderInvoiceData.php @@ -0,0 +1,90 @@ +additionalData)) { + $object->additionalData = $this->additionalData; + } + if (!is_null($this->invoiceDate)) { + $object->invoiceDate = $this->invoiceDate; + } + if (!is_null($this->invoiceNumber)) { + $object->invoiceNumber = $this->invoiceNumber; + } + if (!is_null($this->textQualifiers)) { + $object->textQualifiers = []; + foreach ($this->textQualifiers as $element) { + if (!is_null($element)) { + $object->textQualifiers[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalData')) { + $this->additionalData = $object->additionalData; + } + if (property_exists($object, 'invoiceDate')) { + $this->invoiceDate = $object->invoiceDate; + } + if (property_exists($object, 'invoiceNumber')) { + $this->invoiceNumber = $object->invoiceNumber; + } + if (property_exists($object, 'textQualifiers')) { + if (!is_array($object->textQualifiers) && !is_object($object->textQualifiers)) { + throw new UnexpectedValueException('value \'' . print_r($object->textQualifiers, true) . '\' is not an array or object'); + } + $this->textQualifiers = []; + foreach ($object->textQualifiers as $element) { + $this->textQualifiers[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderLineDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderLineDetails.php new file mode 100644 index 0000000..9f0d723 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderLineDetails.php @@ -0,0 +1,167 @@ +discountAmount)) { + $object->discountAmount = $this->discountAmount; + } + if (!is_null($this->googleProductCategoryId)) { + $object->googleProductCategoryId = $this->googleProductCategoryId; + } + if (!is_null($this->lineAmountTotal)) { + $object->lineAmountTotal = $this->lineAmountTotal; + } + if (!is_null($this->productCategory)) { + $object->productCategory = $this->productCategory; + } + if (!is_null($this->productCode)) { + $object->productCode = $this->productCode; + } + if (!is_null($this->productName)) { + $object->productName = $this->productName; + } + if (!is_null($this->productPrice)) { + $object->productPrice = $this->productPrice; + } + if (!is_null($this->productSku)) { + $object->productSku = $this->productSku; + } + if (!is_null($this->productType)) { + $object->productType = $this->productType; + } + if (!is_null($this->quantity)) { + $object->quantity = $this->quantity; + } + if (!is_null($this->taxAmount)) { + $object->taxAmount = $this->taxAmount; + } + if (!is_null($this->unit)) { + $object->unit = $this->unit; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'discountAmount')) { + $this->discountAmount = $object->discountAmount; + } + if (property_exists($object, 'googleProductCategoryId')) { + $this->googleProductCategoryId = $object->googleProductCategoryId; + } + if (property_exists($object, 'lineAmountTotal')) { + $this->lineAmountTotal = $object->lineAmountTotal; + } + if (property_exists($object, 'productCategory')) { + $this->productCategory = $object->productCategory; + } + if (property_exists($object, 'productCode')) { + $this->productCode = $object->productCode; + } + if (property_exists($object, 'productName')) { + $this->productName = $object->productName; + } + if (property_exists($object, 'productPrice')) { + $this->productPrice = $object->productPrice; + } + if (property_exists($object, 'productSku')) { + $this->productSku = $object->productSku; + } + if (property_exists($object, 'productType')) { + $this->productType = $object->productType; + } + if (property_exists($object, 'quantity')) { + $this->quantity = $object->quantity; + } + if (property_exists($object, 'taxAmount')) { + $this->taxAmount = $object->taxAmount; + } + if (property_exists($object, 'unit')) { + $this->unit = $object->unit; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderOutput.php new file mode 100644 index 0000000..4f61ce8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderOutput.php @@ -0,0 +1,65 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->references)) { + $object->references = $this->references->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'references')) { + if (!is_object($object->references)) { + throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); + } + $value = new PaymentReferences(); + $this->references = $value->fromObject($object->references); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderReferences.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderReferences.php new file mode 100644 index 0000000..660fb5c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderReferences.php @@ -0,0 +1,105 @@ +descriptor)) { + $object->descriptor = $this->descriptor; + } + if (!is_null($this->invoiceData)) { + $object->invoiceData = $this->invoiceData->toObject(); + } + if (!is_null($this->merchantOrderId)) { + $object->merchantOrderId = $this->merchantOrderId; + } + if (!is_null($this->merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + if (!is_null($this->providerId)) { + $object->providerId = $this->providerId; + } + if (!is_null($this->providerMerchantId)) { + $object->providerMerchantId = $this->providerMerchantId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'descriptor')) { + $this->descriptor = $object->descriptor; + } + if (property_exists($object, 'invoiceData')) { + if (!is_object($object->invoiceData)) { + throw new UnexpectedValueException('value \'' . print_r($object->invoiceData, true) . '\' is not an object'); + } + $value = new OrderInvoiceData(); + $this->invoiceData = $value->fromObject($object->invoiceData); + } + if (property_exists($object, 'merchantOrderId')) { + $this->merchantOrderId = $object->merchantOrderId; + } + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + if (property_exists($object, 'providerId')) { + $this->providerId = $object->providerId; + } + if (property_exists($object, 'providerMerchantId')) { + $this->providerMerchantId = $object->providerMerchantId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderReferencesApprovePayment.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderReferencesApprovePayment.php new file mode 100644 index 0000000..b679471 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderReferencesApprovePayment.php @@ -0,0 +1,46 @@ +merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderRiskAssessment.php new file mode 100644 index 0000000..d19dc92 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderRiskAssessment.php @@ -0,0 +1,95 @@ +additionalInput)) { + $object->additionalInput = $this->additionalInput->toObject(); + } + if (!is_null($this->amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->shipping)) { + $object->shipping = $this->shipping->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalInput')) { + if (!is_object($object->additionalInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->additionalInput, true) . '\' is not an object'); + } + $value = new AdditionalOrderInputAirlineData(); + $this->additionalInput = $value->fromObject($object->additionalInput); + } + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerRiskAssessment(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'shipping')) { + if (!is_object($object->shipping)) { + throw new UnexpectedValueException('value \'' . print_r($object->shipping, true) . '\' is not an object'); + } + $value = new ShippingRiskAssessment(); + $this->shipping = $value->fromObject($object->shipping); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderStatusOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderStatusOutput.php new file mode 100644 index 0000000..2da49ca --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderStatusOutput.php @@ -0,0 +1,136 @@ +errors)) { + $object->errors = []; + foreach ($this->errors as $element) { + if (!is_null($element)) { + $object->errors[] = $element->toObject(); + } + } + } + if (!is_null($this->isCancellable)) { + $object->isCancellable = $this->isCancellable; + } + if (!is_null($this->isRetriable)) { + $object->isRetriable = $this->isRetriable; + } + if (!is_null($this->providerRawOutput)) { + $object->providerRawOutput = []; + foreach ($this->providerRawOutput as $element) { + if (!is_null($element)) { + $object->providerRawOutput[] = $element->toObject(); + } + } + } + if (!is_null($this->statusCategory)) { + $object->statusCategory = $this->statusCategory; + } + if (!is_null($this->statusCode)) { + $object->statusCode = $this->statusCode; + } + if (!is_null($this->statusCodeChangeDateTime)) { + $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'errors')) { + if (!is_array($object->errors) && !is_object($object->errors)) { + throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); + } + $this->errors = []; + foreach ($object->errors as $element) { + $value = new APIError(); + $this->errors[] = $value->fromObject($element); + } + } + if (property_exists($object, 'isCancellable')) { + $this->isCancellable = $object->isCancellable; + } + if (property_exists($object, 'isRetriable')) { + $this->isRetriable = $object->isRetriable; + } + if (property_exists($object, 'providerRawOutput')) { + if (!is_array($object->providerRawOutput) && !is_object($object->providerRawOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->providerRawOutput, true) . '\' is not an array or object'); + } + $this->providerRawOutput = []; + foreach ($object->providerRawOutput as $element) { + $value = new KeyValuePair(); + $this->providerRawOutput[] = $value->fromObject($element); + } + } + if (property_exists($object, 'statusCategory')) { + $this->statusCategory = $object->statusCategory; + } + if (property_exists($object, 'statusCode')) { + $this->statusCode = $object->statusCode; + } + if (property_exists($object, 'statusCodeChangeDateTime')) { + $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/OrderTypeInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/OrderTypeInformation.php new file mode 100644 index 0000000..d28950c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/OrderTypeInformation.php @@ -0,0 +1,79 @@ +fundingType)) { + $object->fundingType = $this->fundingType; + } + if (!is_null($this->purchaseType)) { + $object->purchaseType = $this->purchaseType; + } + if (!is_null($this->transactionType)) { + $object->transactionType = $this->transactionType; + } + if (!is_null($this->usageType)) { + $object->usageType = $this->usageType; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fundingType')) { + $this->fundingType = $object->fundingType; + } + if (property_exists($object, 'purchaseType')) { + $this->purchaseType = $object->purchaseType; + } + if (property_exists($object, 'transactionType')) { + $this->transactionType = $object->transactionType; + } + if (property_exists($object, 'usageType')) { + $this->usageType = $object->usageType; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Payment.php b/src/Worldline/Connect/Sdk/V1/Domain/Payment.php new file mode 100644 index 0000000..072c2bd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Payment.php @@ -0,0 +1,90 @@ +hostedCheckoutSpecificOutput)) { + $object->hostedCheckoutSpecificOutput = $this->hostedCheckoutSpecificOutput->toObject(); + } + if (!is_null($this->paymentOutput)) { + $object->paymentOutput = $this->paymentOutput->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->statusOutput)) { + $object->statusOutput = $this->statusOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'hostedCheckoutSpecificOutput')) { + if (!is_object($object->hostedCheckoutSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->hostedCheckoutSpecificOutput, true) . '\' is not an object'); + } + $value = new HostedCheckoutSpecificOutput(); + $this->hostedCheckoutSpecificOutput = $value->fromObject($object->hostedCheckoutSpecificOutput); + } + if (property_exists($object, 'paymentOutput')) { + if (!is_object($object->paymentOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentOutput, true) . '\' is not an object'); + } + $value = new PaymentOutput(); + $this->paymentOutput = $value->fromObject($object->paymentOutput); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'statusOutput')) { + if (!is_object($object->statusOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); + } + $value = new PaymentStatusOutput(); + $this->statusOutput = $value->fromObject($object->statusOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentAccountOnFile.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentAccountOnFile.php new file mode 100644 index 0000000..9714b5b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentAccountOnFile.php @@ -0,0 +1,57 @@ +createDate)) { + $object->createDate = $this->createDate; + } + if (!is_null($this->numberOfCardOnFileCreationAttemptsLast24Hours)) { + $object->numberOfCardOnFileCreationAttemptsLast24Hours = $this->numberOfCardOnFileCreationAttemptsLast24Hours; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'createDate')) { + $this->createDate = $object->createDate; + } + if (property_exists($object, 'numberOfCardOnFileCreationAttemptsLast24Hours')) { + $this->numberOfCardOnFileCreationAttemptsLast24Hours = $object->numberOfCardOnFileCreationAttemptsLast24Hours; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentApprovalResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentApprovalResponse.php new file mode 100644 index 0000000..71ce7fd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentApprovalResponse.php @@ -0,0 +1,96 @@ +cardPaymentMethodSpecificOutput)) { + $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificOutput)) { + $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->payment)) { + $object->payment = $this->payment->toObject(); + } + if (!is_null($this->paymentMethodSpecificOutput)) { + $object->paymentMethodSpecificOutput = $this->paymentMethodSpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { + if (!is_object($object->cardPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new ApprovePaymentCardPaymentMethodSpecificOutput(); + $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); + } + if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { + if (!is_object($object->mobilePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new ApprovePaymentMobilePaymentMethodSpecificOutput(); + $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); + } + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new Payment(); + $this->payment = $value->fromObject($object->payment); + } + if (property_exists($object, 'paymentMethodSpecificOutput')) { + if (!is_object($object->paymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new ApprovePaymentCardPaymentMethodSpecificOutput(); + $this->paymentMethodSpecificOutput = $value->fromObject($object->paymentMethodSpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentContext.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentContext.php new file mode 100644 index 0000000..a8b531d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentContext.php @@ -0,0 +1,83 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->isInstallments)) { + $object->isInstallments = $this->isInstallments; + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'isInstallments')) { + $this->isInstallments = $object->isInstallments; + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationOutput.php new file mode 100644 index 0000000..ff8b4a9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationOutput.php @@ -0,0 +1,78 @@ +isCheckedRememberMe)) { + $object->isCheckedRememberMe = $this->isCheckedRememberMe; + } + if (!is_null($this->isNewToken)) { + $object->isNewToken = $this->isNewToken; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + if (!is_null($this->tokenizationSucceeded)) { + $object->tokenizationSucceeded = $this->tokenizationSucceeded; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isCheckedRememberMe')) { + $this->isCheckedRememberMe = $object->isCheckedRememberMe; + } + if (property_exists($object, 'isNewToken')) { + $this->isNewToken = $object->isNewToken; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + if (property_exists($object, 'tokenizationSucceeded')) { + $this->tokenizationSucceeded = $object->tokenizationSucceeded; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationReferences.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationReferences.php new file mode 100644 index 0000000..24000d6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentCreationReferences.php @@ -0,0 +1,57 @@ +additionalReference)) { + $object->additionalReference = $this->additionalReference; + } + if (!is_null($this->externalReference)) { + $object->externalReference = $this->externalReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'additionalReference')) { + $this->additionalReference = $object->additionalReference; + } + if (property_exists($object, 'externalReference')) { + $this->externalReference = $object->externalReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentErrorResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentErrorResponse.php new file mode 100644 index 0000000..6690158 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentErrorResponse.php @@ -0,0 +1,84 @@ +errorId)) { + $object->errorId = $this->errorId; + } + if (!is_null($this->errors)) { + $object->errors = []; + foreach ($this->errors as $element) { + if (!is_null($element)) { + $object->errors[] = $element->toObject(); + } + } + } + if (!is_null($this->paymentResult)) { + $object->paymentResult = $this->paymentResult->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'errorId')) { + $this->errorId = $object->errorId; + } + if (property_exists($object, 'errors')) { + if (!is_array($object->errors) && !is_object($object->errors)) { + throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); + } + $this->errors = []; + foreach ($object->errors as $element) { + $value = new APIError(); + $this->errors[] = $value->fromObject($element); + } + } + if (property_exists($object, 'paymentResult')) { + if (!is_object($object->paymentResult)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentResult, true) . '\' is not an object'); + } + $value = new CreatePaymentResult(); + $this->paymentResult = $value->fromObject($object->paymentResult); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentOutput.php new file mode 100644 index 0000000..10587fa --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentOutput.php @@ -0,0 +1,213 @@ +amountPaid)) { + $object->amountPaid = $this->amountPaid; + } + if (!is_null($this->amountReversed)) { + $object->amountReversed = $this->amountReversed; + } + if (!is_null($this->bankTransferPaymentMethodSpecificOutput)) { + $object->bankTransferPaymentMethodSpecificOutput = $this->bankTransferPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->cardPaymentMethodSpecificOutput)) { + $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->cashPaymentMethodSpecificOutput)) { + $object->cashPaymentMethodSpecificOutput = $this->cashPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->directDebitPaymentMethodSpecificOutput)) { + $object->directDebitPaymentMethodSpecificOutput = $this->directDebitPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->eInvoicePaymentMethodSpecificOutput)) { + $object->eInvoicePaymentMethodSpecificOutput = $this->eInvoicePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->invoicePaymentMethodSpecificOutput)) { + $object->invoicePaymentMethodSpecificOutput = $this->invoicePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->mobilePaymentMethodSpecificOutput)) { + $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->paymentMethod)) { + $object->paymentMethod = $this->paymentMethod; + } + if (!is_null($this->redirectPaymentMethodSpecificOutput)) { + $object->redirectPaymentMethodSpecificOutput = $this->redirectPaymentMethodSpecificOutput->toObject(); + } + if (!is_null($this->reversalReason)) { + $object->reversalReason = $this->reversalReason; + } + if (!is_null($this->sepaDirectDebitPaymentMethodSpecificOutput)) { + $object->sepaDirectDebitPaymentMethodSpecificOutput = $this->sepaDirectDebitPaymentMethodSpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountPaid')) { + $this->amountPaid = $object->amountPaid; + } + if (property_exists($object, 'amountReversed')) { + $this->amountReversed = $object->amountReversed; + } + if (property_exists($object, 'bankTransferPaymentMethodSpecificOutput')) { + if (!is_object($object->bankTransferPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new BankTransferPaymentMethodSpecificOutput(); + $this->bankTransferPaymentMethodSpecificOutput = $value->fromObject($object->bankTransferPaymentMethodSpecificOutput); + } + if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { + if (!is_object($object->cardPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CardPaymentMethodSpecificOutput(); + $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); + } + if (property_exists($object, 'cashPaymentMethodSpecificOutput')) { + if (!is_object($object->cashPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new CashPaymentMethodSpecificOutput(); + $this->cashPaymentMethodSpecificOutput = $value->fromObject($object->cashPaymentMethodSpecificOutput); + } + if (property_exists($object, 'directDebitPaymentMethodSpecificOutput')) { + if (!is_object($object->directDebitPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new NonSepaDirectDebitPaymentMethodSpecificOutput(); + $this->directDebitPaymentMethodSpecificOutput = $value->fromObject($object->directDebitPaymentMethodSpecificOutput); + } + if (property_exists($object, 'eInvoicePaymentMethodSpecificOutput')) { + if (!is_object($object->eInvoicePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new EInvoicePaymentMethodSpecificOutput(); + $this->eInvoicePaymentMethodSpecificOutput = $value->fromObject($object->eInvoicePaymentMethodSpecificOutput); + } + if (property_exists($object, 'invoicePaymentMethodSpecificOutput')) { + if (!is_object($object->invoicePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->invoicePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new InvoicePaymentMethodSpecificOutput(); + $this->invoicePaymentMethodSpecificOutput = $value->fromObject($object->invoicePaymentMethodSpecificOutput); + } + if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { + if (!is_object($object->mobilePaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new MobilePaymentMethodSpecificOutput(); + $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); + } + if (property_exists($object, 'paymentMethod')) { + $this->paymentMethod = $object->paymentMethod; + } + if (property_exists($object, 'redirectPaymentMethodSpecificOutput')) { + if (!is_object($object->redirectPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RedirectPaymentMethodSpecificOutput(); + $this->redirectPaymentMethodSpecificOutput = $value->fromObject($object->redirectPaymentMethodSpecificOutput); + } + if (property_exists($object, 'reversalReason')) { + $this->reversalReason = $object->reversalReason; + } + if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificOutput')) { + if (!is_object($object->sepaDirectDebitPaymentMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentMethodSpecificOutput(); + $this->sepaDirectDebitPaymentMethodSpecificOutput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct.php new file mode 100644 index 0000000..028d0c6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct.php @@ -0,0 +1,354 @@ +accountsOnFile)) { + $object->accountsOnFile = []; + foreach ($this->accountsOnFile as $element) { + if (!is_null($element)) { + $object->accountsOnFile[] = $element->toObject(); + } + } + } + if (!is_null($this->acquirerCountry)) { + $object->acquirerCountry = $this->acquirerCountry; + } + if (!is_null($this->allowsInstallments)) { + $object->allowsInstallments = $this->allowsInstallments; + } + if (!is_null($this->allowsRecurring)) { + $object->allowsRecurring = $this->allowsRecurring; + } + if (!is_null($this->allowsTokenization)) { + $object->allowsTokenization = $this->allowsTokenization; + } + if (!is_null($this->authenticationIndicator)) { + $object->authenticationIndicator = $this->authenticationIndicator->toObject(); + } + if (!is_null($this->autoTokenized)) { + $object->autoTokenized = $this->autoTokenized; + } + if (!is_null($this->canBeIframed)) { + $object->canBeIframed = $this->canBeIframed; + } + if (!is_null($this->deviceFingerprintEnabled)) { + $object->deviceFingerprintEnabled = $this->deviceFingerprintEnabled; + } + if (!is_null($this->displayHints)) { + $object->displayHints = $this->displayHints->toObject(); + } + if (!is_null($this->fields)) { + $object->fields = []; + foreach ($this->fields as $element) { + if (!is_null($element)) { + $object->fields[] = $element->toObject(); + } + } + } + if (!is_null($this->fieldsWarning)) { + $object->fieldsWarning = $this->fieldsWarning; + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->isAuthenticationSupported)) { + $object->isAuthenticationSupported = $this->isAuthenticationSupported; + } + if (!is_null($this->isJavaScriptRequired)) { + $object->isJavaScriptRequired = $this->isJavaScriptRequired; + } + if (!is_null($this->maxAmount)) { + $object->maxAmount = $this->maxAmount; + } + if (!is_null($this->minAmount)) { + $object->minAmount = $this->minAmount; + } + if (!is_null($this->mobileIntegrationLevel)) { + $object->mobileIntegrationLevel = $this->mobileIntegrationLevel; + } + if (!is_null($this->paymentMethod)) { + $object->paymentMethod = $this->paymentMethod; + } + if (!is_null($this->paymentProduct302SpecificData)) { + $object->paymentProduct302SpecificData = $this->paymentProduct302SpecificData->toObject(); + } + if (!is_null($this->paymentProduct320SpecificData)) { + $object->paymentProduct320SpecificData = $this->paymentProduct320SpecificData->toObject(); + } + if (!is_null($this->paymentProduct863SpecificData)) { + $object->paymentProduct863SpecificData = $this->paymentProduct863SpecificData->toObject(); + } + if (!is_null($this->paymentProductGroup)) { + $object->paymentProductGroup = $this->paymentProductGroup; + } + if (!is_null($this->supportsMandates)) { + $object->supportsMandates = $this->supportsMandates; + } + if (!is_null($this->usesRedirectionTo3rdParty)) { + $object->usesRedirectionTo3rdParty = $this->usesRedirectionTo3rdParty; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountsOnFile')) { + if (!is_array($object->accountsOnFile) && !is_object($object->accountsOnFile)) { + throw new UnexpectedValueException('value \'' . print_r($object->accountsOnFile, true) . '\' is not an array or object'); + } + $this->accountsOnFile = []; + foreach ($object->accountsOnFile as $element) { + $value = new AccountOnFile(); + $this->accountsOnFile[] = $value->fromObject($element); + } + } + if (property_exists($object, 'acquirerCountry')) { + $this->acquirerCountry = $object->acquirerCountry; + } + if (property_exists($object, 'allowsInstallments')) { + $this->allowsInstallments = $object->allowsInstallments; + } + if (property_exists($object, 'allowsRecurring')) { + $this->allowsRecurring = $object->allowsRecurring; + } + if (property_exists($object, 'allowsTokenization')) { + $this->allowsTokenization = $object->allowsTokenization; + } + if (property_exists($object, 'authenticationIndicator')) { + if (!is_object($object->authenticationIndicator)) { + throw new UnexpectedValueException('value \'' . print_r($object->authenticationIndicator, true) . '\' is not an object'); + } + $value = new AuthenticationIndicator(); + $this->authenticationIndicator = $value->fromObject($object->authenticationIndicator); + } + if (property_exists($object, 'autoTokenized')) { + $this->autoTokenized = $object->autoTokenized; + } + if (property_exists($object, 'canBeIframed')) { + $this->canBeIframed = $object->canBeIframed; + } + if (property_exists($object, 'deviceFingerprintEnabled')) { + $this->deviceFingerprintEnabled = $object->deviceFingerprintEnabled; + } + if (property_exists($object, 'displayHints')) { + if (!is_object($object->displayHints)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); + } + $value = new PaymentProductDisplayHints(); + $this->displayHints = $value->fromObject($object->displayHints); + } + if (property_exists($object, 'fields')) { + if (!is_array($object->fields) && !is_object($object->fields)) { + throw new UnexpectedValueException('value \'' . print_r($object->fields, true) . '\' is not an array or object'); + } + $this->fields = []; + foreach ($object->fields as $element) { + $value = new PaymentProductField(); + $this->fields[] = $value->fromObject($element); + } + } + if (property_exists($object, 'fieldsWarning')) { + $this->fieldsWarning = $object->fieldsWarning; + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'isAuthenticationSupported')) { + $this->isAuthenticationSupported = $object->isAuthenticationSupported; + } + if (property_exists($object, 'isJavaScriptRequired')) { + $this->isJavaScriptRequired = $object->isJavaScriptRequired; + } + if (property_exists($object, 'maxAmount')) { + $this->maxAmount = $object->maxAmount; + } + if (property_exists($object, 'minAmount')) { + $this->minAmount = $object->minAmount; + } + if (property_exists($object, 'mobileIntegrationLevel')) { + $this->mobileIntegrationLevel = $object->mobileIntegrationLevel; + } + if (property_exists($object, 'paymentMethod')) { + $this->paymentMethod = $object->paymentMethod; + } + if (property_exists($object, 'paymentProduct302SpecificData')) { + if (!is_object($object->paymentProduct302SpecificData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct302SpecificData, true) . '\' is not an object'); + } + $value = new PaymentProduct302SpecificData(); + $this->paymentProduct302SpecificData = $value->fromObject($object->paymentProduct302SpecificData); + } + if (property_exists($object, 'paymentProduct320SpecificData')) { + if (!is_object($object->paymentProduct320SpecificData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct320SpecificData, true) . '\' is not an object'); + } + $value = new PaymentProduct320SpecificData(); + $this->paymentProduct320SpecificData = $value->fromObject($object->paymentProduct320SpecificData); + } + if (property_exists($object, 'paymentProduct863SpecificData')) { + if (!is_object($object->paymentProduct863SpecificData)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct863SpecificData, true) . '\' is not an object'); + } + $value = new PaymentProduct863SpecificData(); + $this->paymentProduct863SpecificData = $value->fromObject($object->paymentProduct863SpecificData); + } + if (property_exists($object, 'paymentProductGroup')) { + $this->paymentProductGroup = $object->paymentProductGroup; + } + if (property_exists($object, 'supportsMandates')) { + $this->supportsMandates = $object->supportsMandates; + } + if (property_exists($object, 'usesRedirectionTo3rdParty')) { + $this->usesRedirectionTo3rdParty = $object->usesRedirectionTo3rdParty; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct302SpecificData.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct302SpecificData.php new file mode 100644 index 0000000..3cfc16b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct302SpecificData.php @@ -0,0 +1,57 @@ +networks)) { + $object->networks = []; + foreach ($this->networks as $element) { + if (!is_null($element)) { + $object->networks[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'networks')) { + if (!is_array($object->networks) && !is_object($object->networks)) { + throw new UnexpectedValueException('value \'' . print_r($object->networks, true) . '\' is not an array or object'); + } + $this->networks = []; + foreach ($object->networks as $element) { + $this->networks[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct3201SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct3201SpecificOutput.php new file mode 100644 index 0000000..1ae4cd1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct3201SpecificOutput.php @@ -0,0 +1,50 @@ +card)) { + $object->card = $this->card->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new CardEssentials(); + $this->card = $value->fromObject($object->card); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct320SpecificData.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct320SpecificData.php new file mode 100644 index 0000000..73b9575 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct320SpecificData.php @@ -0,0 +1,68 @@ +gateway)) { + $object->gateway = $this->gateway; + } + if (!is_null($this->networks)) { + $object->networks = []; + foreach ($this->networks as $element) { + if (!is_null($element)) { + $object->networks[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'gateway')) { + $this->gateway = $object->gateway; + } + if (property_exists($object, 'networks')) { + if (!is_array($object->networks) && !is_object($object->networks)) { + throw new UnexpectedValueException('value \'' . print_r($object->networks, true) . '\' is not an array or object'); + } + $this->networks = []; + foreach ($object->networks as $element) { + $this->networks[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct771SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct771SpecificOutput.php new file mode 100644 index 0000000..3c96ee8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct771SpecificOutput.php @@ -0,0 +1,46 @@ +mandateReference)) { + $object->mandateReference = $this->mandateReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mandateReference')) { + $this->mandateReference = $object->mandateReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct806SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct806SpecificOutput.php new file mode 100644 index 0000000..26f649d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct806SpecificOutput.php @@ -0,0 +1,65 @@ +billingAddress)) { + $object->billingAddress = $this->billingAddress->toObject(); + } + if (!is_null($this->customerAccount)) { + $object->customerAccount = $this->customerAccount->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'billingAddress')) { + if (!is_object($object->billingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->billingAddress = $value->fromObject($object->billingAddress); + } + if (property_exists($object, 'customerAccount')) { + if (!is_object($object->customerAccount)) { + throw new UnexpectedValueException('value \'' . print_r($object->customerAccount, true) . '\' is not an object'); + } + $value = new TrustlyBankAccount(); + $this->customerAccount = $value->fromObject($object->customerAccount); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct836SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct836SpecificOutput.php new file mode 100644 index 0000000..fd9b67c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct836SpecificOutput.php @@ -0,0 +1,46 @@ +securityIndicator)) { + $object->securityIndicator = $this->securityIndicator; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'securityIndicator')) { + $this->securityIndicator = $object->securityIndicator; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840CustomerAccount.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840CustomerAccount.php new file mode 100644 index 0000000..e9adc3d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840CustomerAccount.php @@ -0,0 +1,145 @@ +accountId)) { + $object->accountId = $this->accountId; + } + if (!is_null($this->billingAgreementId)) { + $object->billingAgreementId = $this->billingAgreementId; + } + if (!is_null($this->companyName)) { + $object->companyName = $this->companyName; + } + if (!is_null($this->contactPhone)) { + $object->contactPhone = $this->contactPhone; + } + if (!is_null($this->countryCode)) { + $object->countryCode = $this->countryCode; + } + if (!is_null($this->customerAccountStatus)) { + $object->customerAccountStatus = $this->customerAccountStatus; + } + if (!is_null($this->customerAddressStatus)) { + $object->customerAddressStatus = $this->customerAddressStatus; + } + if (!is_null($this->firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->payerId)) { + $object->payerId = $this->payerId; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountId')) { + $this->accountId = $object->accountId; + } + if (property_exists($object, 'billingAgreementId')) { + $this->billingAgreementId = $object->billingAgreementId; + } + if (property_exists($object, 'companyName')) { + $this->companyName = $object->companyName; + } + if (property_exists($object, 'contactPhone')) { + $this->contactPhone = $object->contactPhone; + } + if (property_exists($object, 'countryCode')) { + $this->countryCode = $object->countryCode; + } + if (property_exists($object, 'customerAccountStatus')) { + $this->customerAccountStatus = $object->customerAccountStatus; + } + if (property_exists($object, 'customerAddressStatus')) { + $this->customerAddressStatus = $object->customerAddressStatus; + } + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'payerId')) { + $this->payerId = $object->payerId; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840SpecificOutput.php new file mode 100644 index 0000000..6037de5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct840SpecificOutput.php @@ -0,0 +1,95 @@ +billingAddress)) { + $object->billingAddress = $this->billingAddress->toObject(); + } + if (!is_null($this->customerAccount)) { + $object->customerAccount = $this->customerAccount->toObject(); + } + if (!is_null($this->customerAddress)) { + $object->customerAddress = $this->customerAddress->toObject(); + } + if (!is_null($this->protectionEligibility)) { + $object->protectionEligibility = $this->protectionEligibility->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'billingAddress')) { + if (!is_object($object->billingAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->billingAddress = $value->fromObject($object->billingAddress); + } + if (property_exists($object, 'customerAccount')) { + if (!is_object($object->customerAccount)) { + throw new UnexpectedValueException('value \'' . print_r($object->customerAccount, true) . '\' is not an object'); + } + $value = new PaymentProduct840CustomerAccount(); + $this->customerAccount = $value->fromObject($object->customerAccount); + } + if (property_exists($object, 'customerAddress')) { + if (!is_object($object->customerAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->customerAddress, true) . '\' is not an object'); + } + $value = new Address(); + $this->customerAddress = $value->fromObject($object->customerAddress); + } + if (property_exists($object, 'protectionEligibility')) { + if (!is_object($object->protectionEligibility)) { + throw new UnexpectedValueException('value \'' . print_r($object->protectionEligibility, true) . '\' is not an object'); + } + $value = new ProtectionEligibility(); + $this->protectionEligibility = $value->fromObject($object->protectionEligibility); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863SpecificData.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863SpecificData.php new file mode 100644 index 0000000..c65d75e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863SpecificData.php @@ -0,0 +1,57 @@ +integrationTypes)) { + $object->integrationTypes = []; + foreach ($this->integrationTypes as $element) { + if (!is_null($element)) { + $object->integrationTypes[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'integrationTypes')) { + if (!is_array($object->integrationTypes) && !is_object($object->integrationTypes)) { + throw new UnexpectedValueException('value \'' . print_r($object->integrationTypes, true) . '\' is not an array or object'); + } + $this->integrationTypes = []; + foreach ($object->integrationTypes as $element) { + $this->integrationTypes[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863ThirdPartyData.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863ThirdPartyData.php new file mode 100644 index 0000000..58c8749 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProduct863ThirdPartyData.php @@ -0,0 +1,112 @@ +appId)) { + $object->appId = $this->appId; + } + if (!is_null($this->nonceStr)) { + $object->nonceStr = $this->nonceStr; + } + if (!is_null($this->packageSign)) { + $object->packageSign = $this->packageSign; + } + if (!is_null($this->paySign)) { + $object->paySign = $this->paySign; + } + if (!is_null($this->prepayId)) { + $object->prepayId = $this->prepayId; + } + if (!is_null($this->signType)) { + $object->signType = $this->signType; + } + if (!is_null($this->timeStamp)) { + $object->timeStamp = $this->timeStamp; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'appId')) { + $this->appId = $object->appId; + } + if (property_exists($object, 'nonceStr')) { + $this->nonceStr = $object->nonceStr; + } + if (property_exists($object, 'packageSign')) { + $this->packageSign = $object->packageSign; + } + if (property_exists($object, 'paySign')) { + $this->paySign = $object->paySign; + } + if (property_exists($object, 'prepayId')) { + $this->prepayId = $object->prepayId; + } + if (property_exists($object, 'signType')) { + $this->signType = $object->signType; + } + if (property_exists($object, 'timeStamp')) { + $this->timeStamp = $object->timeStamp; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductDisplayHints.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductDisplayHints.php new file mode 100644 index 0000000..93464d5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductDisplayHints.php @@ -0,0 +1,68 @@ +displayOrder)) { + $object->displayOrder = $this->displayOrder; + } + if (!is_null($this->label)) { + $object->label = $this->label; + } + if (!is_null($this->logo)) { + $object->logo = $this->logo; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayOrder')) { + $this->displayOrder = $object->displayOrder; + } + if (property_exists($object, 'label')) { + $this->label = $object->label; + } + if (property_exists($object, 'logo')) { + $this->logo = $object->logo; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductField.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductField.php new file mode 100644 index 0000000..3625609 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductField.php @@ -0,0 +1,98 @@ +dataRestrictions)) { + $object->dataRestrictions = $this->dataRestrictions->toObject(); + } + if (!is_null($this->displayHints)) { + $object->displayHints = $this->displayHints->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + if (!is_null($this->usedForLookup)) { + $object->usedForLookup = $this->usedForLookup; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dataRestrictions')) { + if (!is_object($object->dataRestrictions)) { + throw new UnexpectedValueException('value \'' . print_r($object->dataRestrictions, true) . '\' is not an object'); + } + $value = new PaymentProductFieldDataRestrictions(); + $this->dataRestrictions = $value->fromObject($object->dataRestrictions); + } + if (property_exists($object, 'displayHints')) { + if (!is_object($object->displayHints)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); + } + $value = new PaymentProductFieldDisplayHints(); + $this->displayHints = $value->fromObject($object->displayHints); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + if (property_exists($object, 'usedForLookup')) { + $this->usedForLookup = $object->usedForLookup; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDataRestrictions.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDataRestrictions.php new file mode 100644 index 0000000..ade4cad --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDataRestrictions.php @@ -0,0 +1,61 @@ +isRequired)) { + $object->isRequired = $this->isRequired; + } + if (!is_null($this->validators)) { + $object->validators = $this->validators->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isRequired')) { + $this->isRequired = $object->isRequired; + } + if (property_exists($object, 'validators')) { + if (!is_object($object->validators)) { + throw new UnexpectedValueException('value \'' . print_r($object->validators, true) . '\' is not an object'); + } + $value = new PaymentProductFieldValidators(); + $this->validators = $value->fromObject($object->validators); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayElement.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayElement.php new file mode 100644 index 0000000..4b8438d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayElement.php @@ -0,0 +1,79 @@ +id)) { + $object->id = $this->id; + } + if (!is_null($this->label)) { + $object->label = $this->label; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + if (!is_null($this->value)) { + $object->value = $this->value; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'label')) { + $this->label = $object->label; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + if (property_exists($object, 'value')) { + $this->value = $object->value; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayHints.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayHints.php new file mode 100644 index 0000000..9cd5c5c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldDisplayHints.php @@ -0,0 +1,153 @@ +alwaysShow)) { + $object->alwaysShow = $this->alwaysShow; + } + if (!is_null($this->displayOrder)) { + $object->displayOrder = $this->displayOrder; + } + if (!is_null($this->formElement)) { + $object->formElement = $this->formElement->toObject(); + } + if (!is_null($this->label)) { + $object->label = $this->label; + } + if (!is_null($this->link)) { + $object->link = $this->link; + } + if (!is_null($this->mask)) { + $object->mask = $this->mask; + } + if (!is_null($this->obfuscate)) { + $object->obfuscate = $this->obfuscate; + } + if (!is_null($this->placeholderLabel)) { + $object->placeholderLabel = $this->placeholderLabel; + } + if (!is_null($this->preferredInputType)) { + $object->preferredInputType = $this->preferredInputType; + } + if (!is_null($this->tooltip)) { + $object->tooltip = $this->tooltip->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alwaysShow')) { + $this->alwaysShow = $object->alwaysShow; + } + if (property_exists($object, 'displayOrder')) { + $this->displayOrder = $object->displayOrder; + } + if (property_exists($object, 'formElement')) { + if (!is_object($object->formElement)) { + throw new UnexpectedValueException('value \'' . print_r($object->formElement, true) . '\' is not an object'); + } + $value = new PaymentProductFieldFormElement(); + $this->formElement = $value->fromObject($object->formElement); + } + if (property_exists($object, 'label')) { + $this->label = $object->label; + } + if (property_exists($object, 'link')) { + $this->link = $object->link; + } + if (property_exists($object, 'mask')) { + $this->mask = $object->mask; + } + if (property_exists($object, 'obfuscate')) { + $this->obfuscate = $object->obfuscate; + } + if (property_exists($object, 'placeholderLabel')) { + $this->placeholderLabel = $object->placeholderLabel; + } + if (property_exists($object, 'preferredInputType')) { + $this->preferredInputType = $object->preferredInputType; + } + if (property_exists($object, 'tooltip')) { + if (!is_object($object->tooltip)) { + throw new UnexpectedValueException('value \'' . print_r($object->tooltip, true) . '\' is not an object'); + } + $value = new PaymentProductFieldTooltip(); + $this->tooltip = $value->fromObject($object->tooltip); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldFormElement.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldFormElement.php new file mode 100644 index 0000000..0eed9a3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldFormElement.php @@ -0,0 +1,69 @@ +type)) { + $object->type = $this->type; + } + if (!is_null($this->valueMapping)) { + $object->valueMapping = []; + foreach ($this->valueMapping as $element) { + if (!is_null($element)) { + $object->valueMapping[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + if (property_exists($object, 'valueMapping')) { + if (!is_array($object->valueMapping) && !is_object($object->valueMapping)) { + throw new UnexpectedValueException('value \'' . print_r($object->valueMapping, true) . '\' is not an array or object'); + } + $this->valueMapping = []; + foreach ($object->valueMapping as $element) { + $value = new ValueMappingElement(); + $this->valueMapping[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldTooltip.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldTooltip.php new file mode 100644 index 0000000..2c0dc65 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldTooltip.php @@ -0,0 +1,57 @@ +image)) { + $object->image = $this->image; + } + if (!is_null($this->label)) { + $object->label = $this->label; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'image')) { + $this->image = $object->image; + } + if (property_exists($object, 'label')) { + $this->label = $object->label; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldValidators.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldValidators.php new file mode 100644 index 0000000..9151989 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFieldValidators.php @@ -0,0 +1,200 @@ +boletoBancarioRequiredness)) { + $object->boletoBancarioRequiredness = $this->boletoBancarioRequiredness->toObject(); + } + if (!is_null($this->emailAddress)) { + $object->emailAddress = $this->emailAddress->toObject(); + } + if (!is_null($this->expirationDate)) { + $object->expirationDate = $this->expirationDate->toObject(); + } + if (!is_null($this->fixedList)) { + $object->fixedList = $this->fixedList->toObject(); + } + if (!is_null($this->iban)) { + $object->iban = $this->iban->toObject(); + } + if (!is_null($this->length)) { + $object->length = $this->length->toObject(); + } + if (!is_null($this->luhn)) { + $object->luhn = $this->luhn->toObject(); + } + if (!is_null($this->range)) { + $object->range = $this->range->toObject(); + } + if (!is_null($this->regularExpression)) { + $object->regularExpression = $this->regularExpression->toObject(); + } + if (!is_null($this->residentIdNumber)) { + $object->residentIdNumber = $this->residentIdNumber->toObject(); + } + if (!is_null($this->termsAndConditions)) { + $object->termsAndConditions = $this->termsAndConditions->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'boletoBancarioRequiredness')) { + if (!is_object($object->boletoBancarioRequiredness)) { + throw new UnexpectedValueException('value \'' . print_r($object->boletoBancarioRequiredness, true) . '\' is not an object'); + } + $value = new BoletoBancarioRequirednessValidator(); + $this->boletoBancarioRequiredness = $value->fromObject($object->boletoBancarioRequiredness); + } + if (property_exists($object, 'emailAddress')) { + if (!is_object($object->emailAddress)) { + throw new UnexpectedValueException('value \'' . print_r($object->emailAddress, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->emailAddress = $value->fromObject($object->emailAddress); + } + if (property_exists($object, 'expirationDate')) { + if (!is_object($object->expirationDate)) { + throw new UnexpectedValueException('value \'' . print_r($object->expirationDate, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->expirationDate = $value->fromObject($object->expirationDate); + } + if (property_exists($object, 'fixedList')) { + if (!is_object($object->fixedList)) { + throw new UnexpectedValueException('value \'' . print_r($object->fixedList, true) . '\' is not an object'); + } + $value = new FixedListValidator(); + $this->fixedList = $value->fromObject($object->fixedList); + } + if (property_exists($object, 'iban')) { + if (!is_object($object->iban)) { + throw new UnexpectedValueException('value \'' . print_r($object->iban, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->iban = $value->fromObject($object->iban); + } + if (property_exists($object, 'length')) { + if (!is_object($object->length)) { + throw new UnexpectedValueException('value \'' . print_r($object->length, true) . '\' is not an object'); + } + $value = new LengthValidator(); + $this->length = $value->fromObject($object->length); + } + if (property_exists($object, 'luhn')) { + if (!is_object($object->luhn)) { + throw new UnexpectedValueException('value \'' . print_r($object->luhn, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->luhn = $value->fromObject($object->luhn); + } + if (property_exists($object, 'range')) { + if (!is_object($object->range)) { + throw new UnexpectedValueException('value \'' . print_r($object->range, true) . '\' is not an object'); + } + $value = new RangeValidator(); + $this->range = $value->fromObject($object->range); + } + if (property_exists($object, 'regularExpression')) { + if (!is_object($object->regularExpression)) { + throw new UnexpectedValueException('value \'' . print_r($object->regularExpression, true) . '\' is not an object'); + } + $value = new RegularExpressionValidator(); + $this->regularExpression = $value->fromObject($object->regularExpression); + } + if (property_exists($object, 'residentIdNumber')) { + if (!is_object($object->residentIdNumber)) { + throw new UnexpectedValueException('value \'' . print_r($object->residentIdNumber, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->residentIdNumber = $value->fromObject($object->residentIdNumber); + } + if (property_exists($object, 'termsAndConditions')) { + if (!is_object($object->termsAndConditions)) { + throw new UnexpectedValueException('value \'' . print_r($object->termsAndConditions, true) . '\' is not an object'); + } + $value = new EmptyValidator(); + $this->termsAndConditions = $value->fromObject($object->termsAndConditions); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFilter.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFilter.php new file mode 100644 index 0000000..259c4a2 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFilter.php @@ -0,0 +1,79 @@ +groups)) { + $object->groups = []; + foreach ($this->groups as $element) { + if (!is_null($element)) { + $object->groups[] = $element; + } + } + } + if (!is_null($this->products)) { + $object->products = []; + foreach ($this->products as $element) { + if (!is_null($element)) { + $object->products[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'groups')) { + if (!is_array($object->groups) && !is_object($object->groups)) { + throw new UnexpectedValueException('value \'' . print_r($object->groups, true) . '\' is not an array or object'); + } + $this->groups = []; + foreach ($object->groups as $element) { + $this->groups[] = $element; + } + } + if (property_exists($object, 'products')) { + if (!is_array($object->products) && !is_object($object->products)) { + throw new UnexpectedValueException('value \'' . print_r($object->products, true) . '\' is not an array or object'); + } + $this->products = []; + foreach ($object->products as $element) { + $this->products[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersClientSession.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersClientSession.php new file mode 100644 index 0000000..c2b983d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersClientSession.php @@ -0,0 +1,65 @@ +exclude)) { + $object->exclude = $this->exclude->toObject(); + } + if (!is_null($this->restrictTo)) { + $object->restrictTo = $this->restrictTo->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'exclude')) { + if (!is_object($object->exclude)) { + throw new UnexpectedValueException('value \'' . print_r($object->exclude, true) . '\' is not an object'); + } + $value = new PaymentProductFilter(); + $this->exclude = $value->fromObject($object->exclude); + } + if (property_exists($object, 'restrictTo')) { + if (!is_object($object->restrictTo)) { + throw new UnexpectedValueException('value \'' . print_r($object->restrictTo, true) . '\' is not an object'); + } + $value = new PaymentProductFilter(); + $this->restrictTo = $value->fromObject($object->restrictTo); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersHostedCheckout.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersHostedCheckout.php new file mode 100644 index 0000000..c1ed966 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductFiltersHostedCheckout.php @@ -0,0 +1,76 @@ +exclude)) { + $object->exclude = $this->exclude->toObject(); + } + if (!is_null($this->restrictTo)) { + $object->restrictTo = $this->restrictTo->toObject(); + } + if (!is_null($this->tokensOnly)) { + $object->tokensOnly = $this->tokensOnly; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'exclude')) { + if (!is_object($object->exclude)) { + throw new UnexpectedValueException('value \'' . print_r($object->exclude, true) . '\' is not an object'); + } + $value = new PaymentProductFilter(); + $this->exclude = $value->fromObject($object->exclude); + } + if (property_exists($object, 'restrictTo')) { + if (!is_object($object->restrictTo)) { + throw new UnexpectedValueException('value \'' . print_r($object->restrictTo, true) . '\' is not an object'); + } + $value = new PaymentProductFilter(); + $this->restrictTo = $value->fromObject($object->restrictTo); + } + if (property_exists($object, 'tokensOnly')) { + $this->tokensOnly = $object->tokensOnly; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroup.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroup.php new file mode 100644 index 0000000..9a130d5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroup.php @@ -0,0 +1,129 @@ +accountsOnFile)) { + $object->accountsOnFile = []; + foreach ($this->accountsOnFile as $element) { + if (!is_null($element)) { + $object->accountsOnFile[] = $element->toObject(); + } + } + } + if (!is_null($this->allowsInstallments)) { + $object->allowsInstallments = $this->allowsInstallments; + } + if (!is_null($this->deviceFingerprintEnabled)) { + $object->deviceFingerprintEnabled = $this->deviceFingerprintEnabled; + } + if (!is_null($this->displayHints)) { + $object->displayHints = $this->displayHints->toObject(); + } + if (!is_null($this->fields)) { + $object->fields = []; + foreach ($this->fields as $element) { + if (!is_null($element)) { + $object->fields[] = $element->toObject(); + } + } + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountsOnFile')) { + if (!is_array($object->accountsOnFile) && !is_object($object->accountsOnFile)) { + throw new UnexpectedValueException('value \'' . print_r($object->accountsOnFile, true) . '\' is not an array or object'); + } + $this->accountsOnFile = []; + foreach ($object->accountsOnFile as $element) { + $value = new AccountOnFile(); + $this->accountsOnFile[] = $value->fromObject($element); + } + } + if (property_exists($object, 'allowsInstallments')) { + $this->allowsInstallments = $object->allowsInstallments; + } + if (property_exists($object, 'deviceFingerprintEnabled')) { + $this->deviceFingerprintEnabled = $object->deviceFingerprintEnabled; + } + if (property_exists($object, 'displayHints')) { + if (!is_object($object->displayHints)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); + } + $value = new PaymentProductDisplayHints(); + $this->displayHints = $value->fromObject($object->displayHints); + } + if (property_exists($object, 'fields')) { + if (!is_array($object->fields) && !is_object($object->fields)) { + throw new UnexpectedValueException('value \'' . print_r($object->fields, true) . '\' is not an array or object'); + } + $this->fields = []; + foreach ($object->fields as $element) { + $value = new PaymentProductField(); + $this->fields[] = $value->fromObject($element); + } + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroupResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroupResponse.php new file mode 100644 index 0000000..f62f017 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductGroupResponse.php @@ -0,0 +1,34 @@ +paymentProductGroups)) { + $object->paymentProductGroups = []; + foreach ($this->paymentProductGroups as $element) { + if (!is_null($element)) { + $object->paymentProductGroups[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductGroups')) { + if (!is_array($object->paymentProductGroups) && !is_object($object->paymentProductGroups)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProductGroups, true) . '\' is not an array or object'); + } + $this->paymentProductGroups = []; + foreach ($object->paymentProductGroups as $element) { + $value = new PaymentProductGroup(); + $this->paymentProductGroups[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductNetworksResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductNetworksResponse.php new file mode 100644 index 0000000..259deda --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductNetworksResponse.php @@ -0,0 +1,57 @@ +networks)) { + $object->networks = []; + foreach ($this->networks as $element) { + if (!is_null($element)) { + $object->networks[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'networks')) { + if (!is_array($object->networks) && !is_object($object->networks)) { + throw new UnexpectedValueException('value \'' . print_r($object->networks, true) . '\' is not an array or object'); + } + $this->networks = []; + foreach ($object->networks as $element) { + $this->networks[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductResponse.php new file mode 100644 index 0000000..33ad533 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentProductResponse.php @@ -0,0 +1,34 @@ +paymentProducts)) { + $object->paymentProducts = []; + foreach ($this->paymentProducts as $element) { + if (!is_null($element)) { + $object->paymentProducts[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProducts')) { + if (!is_array($object->paymentProducts) && !is_object($object->paymentProducts)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProducts, true) . '\' is not an array or object'); + } + $this->paymentProducts = []; + foreach ($object->paymentProducts as $element) { + $value = new PaymentProduct(); + $this->paymentProducts[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentReferences.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentReferences.php new file mode 100644 index 0000000..1a2f958 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentReferences.php @@ -0,0 +1,112 @@ +merchantOrderId)) { + $object->merchantOrderId = $this->merchantOrderId; + } + if (!is_null($this->merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + if (!is_null($this->paymentReference)) { + $object->paymentReference = $this->paymentReference; + } + if (!is_null($this->providerId)) { + $object->providerId = $this->providerId; + } + if (!is_null($this->providerMerchantId)) { + $object->providerMerchantId = $this->providerMerchantId; + } + if (!is_null($this->providerReference)) { + $object->providerReference = $this->providerReference; + } + if (!is_null($this->referenceOrigPayment)) { + $object->referenceOrigPayment = $this->referenceOrigPayment; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'merchantOrderId')) { + $this->merchantOrderId = $object->merchantOrderId; + } + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + if (property_exists($object, 'paymentReference')) { + $this->paymentReference = $object->paymentReference; + } + if (property_exists($object, 'providerId')) { + $this->providerId = $object->providerId; + } + if (property_exists($object, 'providerMerchantId')) { + $this->providerMerchantId = $object->providerMerchantId; + } + if (property_exists($object, 'providerReference')) { + $this->providerReference = $object->providerReference; + } + if (property_exists($object, 'referenceOrigPayment')) { + $this->referenceOrigPayment = $object->referenceOrigPayment; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PaymentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PaymentResponse.php new file mode 100644 index 0000000..1f42946 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PaymentResponse.php @@ -0,0 +1,34 @@ +isAuthorized)) { + $object->isAuthorized = $this->isAuthorized; + } + if (!is_null($this->isRefundable)) { + $object->isRefundable = $this->isRefundable; + } + if (!is_null($this->threeDSecureStatus)) { + $object->threeDSecureStatus = $this->threeDSecureStatus; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isAuthorized')) { + $this->isAuthorized = $object->isAuthorized; + } + if (property_exists($object, 'isRefundable')) { + $this->isRefundable = $object->isRefundable; + } + if (property_exists($object, 'threeDSecureStatus')) { + $this->threeDSecureStatus = $object->threeDSecureStatus; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutCustomer.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutCustomer.php new file mode 100644 index 0000000..7649d20 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutCustomer.php @@ -0,0 +1,106 @@ +address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->companyInformation)) { + $object->companyInformation = $this->companyInformation->toObject(); + } + if (!is_null($this->contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + if (!is_null($this->merchantCustomerId)) { + $object->merchantCustomerId = $this->merchantCustomerId; + } + if (!is_null($this->name)) { + $object->name = $this->name->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new Address(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'companyInformation')) { + if (!is_object($object->companyInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); + } + $value = new CompanyInformation(); + $this->companyInformation = $value->fromObject($object->companyInformation); + } + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new ContactDetailsBase(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + if (property_exists($object, 'merchantCustomerId')) { + $this->merchantCustomerId = $object->merchantCustomerId; + } + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new PersonalName(); + $this->name = $value->fromObject($object->name); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutDetails.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutDetails.php new file mode 100644 index 0000000..141e592 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutDetails.php @@ -0,0 +1,80 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->references)) { + $object->references = $this->references->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new PayoutCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'references')) { + if (!is_object($object->references)) { + throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); + } + $value = new PayoutReferences(); + $this->references = $value->fromObject($object->references); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutErrorResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutErrorResponse.php new file mode 100644 index 0000000..bcc292b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutErrorResponse.php @@ -0,0 +1,84 @@ +errorId)) { + $object->errorId = $this->errorId; + } + if (!is_null($this->errors)) { + $object->errors = []; + foreach ($this->errors as $element) { + if (!is_null($element)) { + $object->errors[] = $element->toObject(); + } + } + } + if (!is_null($this->payoutResult)) { + $object->payoutResult = $this->payoutResult->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'errorId')) { + $this->errorId = $object->errorId; + } + if (property_exists($object, 'errors')) { + if (!is_array($object->errors) && !is_object($object->errors)) { + throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); + } + $this->errors = []; + foreach ($object->errors as $element) { + $value = new APIError(); + $this->errors[] = $value->fromObject($element); + } + } + if (property_exists($object, 'payoutResult')) { + if (!is_object($object->payoutResult)) { + throw new UnexpectedValueException('value \'' . print_r($object->payoutResult, true) . '\' is not an object'); + } + $value = new PayoutResult(); + $this->payoutResult = $value->fromObject($object->payoutResult); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutMerchant.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutMerchant.php new file mode 100644 index 0000000..5deb6b0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutMerchant.php @@ -0,0 +1,46 @@ +configurationId)) { + $object->configurationId = $this->configurationId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'configurationId')) { + $this->configurationId = $object->configurationId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutRecipient.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutRecipient.php new file mode 100644 index 0000000..388d783 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutRecipient.php @@ -0,0 +1,68 @@ +firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->surnamePrefix)) { + $object->surnamePrefix = $this->surnamePrefix; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'surnamePrefix')) { + $this->surnamePrefix = $object->surnamePrefix; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutReferences.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutReferences.php new file mode 100644 index 0000000..cab71d4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutReferences.php @@ -0,0 +1,68 @@ +invoiceNumber)) { + $object->invoiceNumber = $this->invoiceNumber; + } + if (!is_null($this->merchantOrderId)) { + $object->merchantOrderId = $this->merchantOrderId; + } + if (!is_null($this->merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'invoiceNumber')) { + $this->invoiceNumber = $object->invoiceNumber; + } + if (property_exists($object, 'merchantOrderId')) { + $this->merchantOrderId = $object->merchantOrderId; + } + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PayoutResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/PayoutResponse.php new file mode 100644 index 0000000..0c78367 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PayoutResponse.php @@ -0,0 +1,34 @@ +payoutOutput)) { + $object->payoutOutput = $this->payoutOutput->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->statusOutput)) { + $object->statusOutput = $this->statusOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'payoutOutput')) { + if (!is_object($object->payoutOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->payoutOutput, true) . '\' is not an object'); + } + $value = new OrderOutput(); + $this->payoutOutput = $value->fromObject($object->payoutOutput); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'statusOutput')) { + if (!is_object($object->statusOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); + } + $value = new OrderStatusOutput(); + $this->statusOutput = $value->fromObject($object->statusOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalIdentification.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalIdentification.php new file mode 100644 index 0000000..e5b2fc6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalIdentification.php @@ -0,0 +1,68 @@ +idIssuingCountryCode)) { + $object->idIssuingCountryCode = $this->idIssuingCountryCode; + } + if (!is_null($this->idType)) { + $object->idType = $this->idType; + } + if (!is_null($this->idValue)) { + $object->idValue = $this->idValue; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'idIssuingCountryCode')) { + $this->idIssuingCountryCode = $object->idIssuingCountryCode; + } + if (property_exists($object, 'idType')) { + $this->idType = $object->idType; + } + if (property_exists($object, 'idValue')) { + $this->idValue = $object->idValue; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformation.php new file mode 100644 index 0000000..5018e40 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformation.php @@ -0,0 +1,87 @@ +dateOfBirth)) { + $object->dateOfBirth = $this->dateOfBirth; + } + if (!is_null($this->gender)) { + $object->gender = $this->gender; + } + if (!is_null($this->identification)) { + $object->identification = $this->identification->toObject(); + } + if (!is_null($this->name)) { + $object->name = $this->name->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dateOfBirth')) { + $this->dateOfBirth = $object->dateOfBirth; + } + if (property_exists($object, 'gender')) { + $this->gender = $object->gender; + } + if (property_exists($object, 'identification')) { + if (!is_object($object->identification)) { + throw new UnexpectedValueException('value \'' . print_r($object->identification, true) . '\' is not an object'); + } + $value = new PersonalIdentification(); + $this->identification = $value->fromObject($object->identification); + } + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new PersonalName(); + $this->name = $value->fromObject($object->name); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationRiskAssessment.php new file mode 100644 index 0000000..ea4330a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationRiskAssessment.php @@ -0,0 +1,50 @@ +name)) { + $object->name = $this->name->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new PersonalNameRiskAssessment(); + $this->name = $value->fromObject($object->name); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationToken.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationToken.php new file mode 100644 index 0000000..5602c75 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalInformationToken.php @@ -0,0 +1,50 @@ +name)) { + $object->name = $this->name->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'name')) { + if (!is_object($object->name)) { + throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); + } + $value = new PersonalNameToken(); + $this->name = $value->fromObject($object->name); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalName.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalName.php new file mode 100644 index 0000000..ba4bdda --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalName.php @@ -0,0 +1,45 @@ +title)) { + $object->title = $this->title; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'title')) { + $this->title = $object->title; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameBase.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameBase.php new file mode 100644 index 0000000..35998e1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameBase.php @@ -0,0 +1,68 @@ +firstName)) { + $object->firstName = $this->firstName; + } + if (!is_null($this->surname)) { + $object->surname = $this->surname; + } + if (!is_null($this->surnamePrefix)) { + $object->surnamePrefix = $this->surnamePrefix; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'firstName')) { + $this->firstName = $object->firstName; + } + if (property_exists($object, 'surname')) { + $this->surname = $object->surname; + } + if (property_exists($object, 'surnamePrefix')) { + $this->surnamePrefix = $object->surnamePrefix; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameRiskAssessment.php new file mode 100644 index 0000000..6fdded4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/PersonalNameRiskAssessment.php @@ -0,0 +1,34 @@ +eligibility)) { + $object->eligibility = $this->eligibility; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'eligibility')) { + $this->eligibility = $object->eligibility; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RangeValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/RangeValidator.php new file mode 100644 index 0000000..24c136d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RangeValidator.php @@ -0,0 +1,57 @@ +maxValue)) { + $object->maxValue = $this->maxValue; + } + if (!is_null($this->minValue)) { + $object->minValue = $this->minValue; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'maxValue')) { + $this->maxValue = $object->maxValue; + } + if (property_exists($object, 'minValue')) { + $this->minValue = $object->minValue; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RecurringPaymentsData.php b/src/Worldline/Connect/Sdk/V1/Domain/RecurringPaymentsData.php new file mode 100644 index 0000000..c149337 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RecurringPaymentsData.php @@ -0,0 +1,65 @@ +recurringInterval)) { + $object->recurringInterval = $this->recurringInterval->toObject(); + } + if (!is_null($this->trialInformation)) { + $object->trialInformation = $this->trialInformation->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'recurringInterval')) { + if (!is_object($object->recurringInterval)) { + throw new UnexpectedValueException('value \'' . print_r($object->recurringInterval, true) . '\' is not an object'); + } + $value = new Frequency(); + $this->recurringInterval = $value->fromObject($object->recurringInterval); + } + if (property_exists($object, 'trialInformation')) { + if (!is_object($object->trialInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->trialInformation, true) . '\' is not an object'); + } + $value = new TrialInformation(); + $this->trialInformation = $value->fromObject($object->trialInformation); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectData.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectData.php new file mode 100644 index 0000000..b107740 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectData.php @@ -0,0 +1,34 @@ +RETURNMAC)) { + $object->RETURNMAC = $this->RETURNMAC; + } + if (!is_null($this->redirectURL)) { + $object->redirectURL = $this->redirectURL; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'RETURNMAC')) { + $this->RETURNMAC = $object->RETURNMAC; + } + if (property_exists($object, 'redirectURL')) { + $this->redirectURL = $object->redirectURL; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInput.php new file mode 100644 index 0000000..536f580 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInput.php @@ -0,0 +1,192 @@ +isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->paymentProduct4101SpecificInput)) { + $object->paymentProduct4101SpecificInput = $this->paymentProduct4101SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct809SpecificInput)) { + $object->paymentProduct809SpecificInput = $this->paymentProduct809SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct816SpecificInput)) { + $object->paymentProduct816SpecificInput = $this->paymentProduct816SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct840SpecificInput)) { + $object->paymentProduct840SpecificInput = $this->paymentProduct840SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct861SpecificInput)) { + $object->paymentProduct861SpecificInput = $this->paymentProduct861SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct863SpecificInput)) { + $object->paymentProduct863SpecificInput = $this->paymentProduct863SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct869SpecificInput)) { + $object->paymentProduct869SpecificInput = $this->paymentProduct869SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct882SpecificInput)) { + $object->paymentProduct882SpecificInput = $this->paymentProduct882SpecificInput->toObject(); + } + if (!is_null($this->redirectionData)) { + $object->redirectionData = $this->redirectionData->toObject(); + } + if (!is_null($this->returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'paymentProduct4101SpecificInput')) { + if (!is_object($object->paymentProduct4101SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct4101SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct4101SpecificInput(); + $this->paymentProduct4101SpecificInput = $value->fromObject($object->paymentProduct4101SpecificInput); + } + if (property_exists($object, 'paymentProduct809SpecificInput')) { + if (!is_object($object->paymentProduct809SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct809SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct809SpecificInput(); + $this->paymentProduct809SpecificInput = $value->fromObject($object->paymentProduct809SpecificInput); + } + if (property_exists($object, 'paymentProduct816SpecificInput')) { + if (!is_object($object->paymentProduct816SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct816SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct816SpecificInput(); + $this->paymentProduct816SpecificInput = $value->fromObject($object->paymentProduct816SpecificInput); + } + if (property_exists($object, 'paymentProduct840SpecificInput')) { + if (!is_object($object->paymentProduct840SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct840SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct840SpecificInput(); + $this->paymentProduct840SpecificInput = $value->fromObject($object->paymentProduct840SpecificInput); + } + if (property_exists($object, 'paymentProduct861SpecificInput')) { + if (!is_object($object->paymentProduct861SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct861SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct861SpecificInput(); + $this->paymentProduct861SpecificInput = $value->fromObject($object->paymentProduct861SpecificInput); + } + if (property_exists($object, 'paymentProduct863SpecificInput')) { + if (!is_object($object->paymentProduct863SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct863SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct863SpecificInput(); + $this->paymentProduct863SpecificInput = $value->fromObject($object->paymentProduct863SpecificInput); + } + if (property_exists($object, 'paymentProduct869SpecificInput')) { + if (!is_object($object->paymentProduct869SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct869SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct869SpecificInput(); + $this->paymentProduct869SpecificInput = $value->fromObject($object->paymentProduct869SpecificInput); + } + if (property_exists($object, 'paymentProduct882SpecificInput')) { + if (!is_object($object->paymentProduct882SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct882SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct882SpecificInput(); + $this->paymentProduct882SpecificInput = $value->fromObject($object->paymentProduct882SpecificInput); + } + if (property_exists($object, 'redirectionData')) { + if (!is_object($object->redirectionData)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectionData, true) . '\' is not an object'); + } + $value = new RedirectionData(); + $this->redirectionData = $value->fromObject($object->redirectionData); + } + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInputBase.php new file mode 100644 index 0000000..52b633d --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificInputBase.php @@ -0,0 +1,64 @@ +paymentProduct4101SpecificInput)) { + $object->paymentProduct4101SpecificInput = $this->paymentProduct4101SpecificInput->toObject(); + } + if (!is_null($this->paymentProduct840SpecificInput)) { + $object->paymentProduct840SpecificInput = $this->paymentProduct840SpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct4101SpecificInput')) { + if (!is_object($object->paymentProduct4101SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct4101SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct4101SpecificInputBase(); + $this->paymentProduct4101SpecificInput = $value->fromObject($object->paymentProduct4101SpecificInput); + } + if (property_exists($object, 'paymentProduct840SpecificInput')) { + if (!is_object($object->paymentProduct840SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct840SpecificInput, true) . '\' is not an object'); + } + $value = new RedirectPaymentProduct840SpecificInputBase(); + $this->paymentProduct840SpecificInput = $value->fromObject($object->paymentProduct840SpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..27e92a8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentMethodSpecificOutput.php @@ -0,0 +1,161 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + if (!is_null($this->bic)) { + $object->bic = $this->bic; + } + if (!is_null($this->fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + if (!is_null($this->paymentProduct3201SpecificOutput)) { + $object->paymentProduct3201SpecificOutput = $this->paymentProduct3201SpecificOutput->toObject(); + } + if (!is_null($this->paymentProduct806SpecificOutput)) { + $object->paymentProduct806SpecificOutput = $this->paymentProduct806SpecificOutput->toObject(); + } + if (!is_null($this->paymentProduct836SpecificOutput)) { + $object->paymentProduct836SpecificOutput = $this->paymentProduct836SpecificOutput->toObject(); + } + if (!is_null($this->paymentProduct840SpecificOutput)) { + $object->paymentProduct840SpecificOutput = $this->paymentProduct840SpecificOutput->toObject(); + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + if (property_exists($object, 'bic')) { + $this->bic = $object->bic; + } + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + if (property_exists($object, 'paymentProduct3201SpecificOutput')) { + if (!is_object($object->paymentProduct3201SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct3201SpecificOutput, true) . '\' is not an object'); + } + $value = new PaymentProduct3201SpecificOutput(); + $this->paymentProduct3201SpecificOutput = $value->fromObject($object->paymentProduct3201SpecificOutput); + } + if (property_exists($object, 'paymentProduct806SpecificOutput')) { + if (!is_object($object->paymentProduct806SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct806SpecificOutput, true) . '\' is not an object'); + } + $value = new PaymentProduct806SpecificOutput(); + $this->paymentProduct806SpecificOutput = $value->fromObject($object->paymentProduct806SpecificOutput); + } + if (property_exists($object, 'paymentProduct836SpecificOutput')) { + if (!is_object($object->paymentProduct836SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct836SpecificOutput, true) . '\' is not an object'); + } + $value = new PaymentProduct836SpecificOutput(); + $this->paymentProduct836SpecificOutput = $value->fromObject($object->paymentProduct836SpecificOutput); + } + if (property_exists($object, 'paymentProduct840SpecificOutput')) { + if (!is_object($object->paymentProduct840SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct840SpecificOutput, true) . '\' is not an object'); + } + $value = new PaymentProduct840SpecificOutput(); + $this->paymentProduct840SpecificOutput = $value->fromObject($object->paymentProduct840SpecificOutput); + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInput.php new file mode 100644 index 0000000..0213503 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInput.php @@ -0,0 +1,68 @@ +displayName)) { + $object->displayName = $this->displayName; + } + if (!is_null($this->integrationType)) { + $object->integrationType = $this->integrationType; + } + if (!is_null($this->virtualPaymentAddress)) { + $object->virtualPaymentAddress = $this->virtualPaymentAddress; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayName')) { + $this->displayName = $object->displayName; + } + if (property_exists($object, 'integrationType')) { + $this->integrationType = $object->integrationType; + } + if (property_exists($object, 'virtualPaymentAddress')) { + $this->virtualPaymentAddress = $object->virtualPaymentAddress; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInputBase.php new file mode 100644 index 0000000..be462d1 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct4101SpecificInputBase.php @@ -0,0 +1,45 @@ +displayName)) { + $object->displayName = $this->displayName; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayName')) { + $this->displayName = $object->displayName; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct809SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct809SpecificInput.php new file mode 100644 index 0000000..e4774db --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct809SpecificInput.php @@ -0,0 +1,58 @@ +expirationPeriod)) { + $object->expirationPeriod = $this->expirationPeriod; + } + if (!is_null($this->issuerId)) { + $object->issuerId = $this->issuerId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'expirationPeriod')) { + $this->expirationPeriod = $object->expirationPeriod; + } + if (property_exists($object, 'issuerId')) { + $this->issuerId = $object->issuerId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct816SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct816SpecificInput.php new file mode 100644 index 0000000..2fbf597 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct816SpecificInput.php @@ -0,0 +1,50 @@ +bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInput.php new file mode 100644 index 0000000..27232e6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInput.php @@ -0,0 +1,57 @@ +custom)) { + $object->custom = $this->custom; + } + if (!is_null($this->isShortcut)) { + $object->isShortcut = $this->isShortcut; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'custom')) { + $this->custom = $object->custom; + } + if (property_exists($object, 'isShortcut')) { + $this->isShortcut = $object->isShortcut; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInputBase.php new file mode 100644 index 0000000..d77e55b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct840SpecificInputBase.php @@ -0,0 +1,34 @@ +mobileDevice)) { + $object->mobileDevice = $this->mobileDevice; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'mobileDevice')) { + $this->mobileDevice = $object->mobileDevice; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct863SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct863SpecificInput.php new file mode 100644 index 0000000..c2b44d5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct863SpecificInput.php @@ -0,0 +1,57 @@ +integrationType)) { + $object->integrationType = $this->integrationType; + } + if (!is_null($this->openId)) { + $object->openId = $this->openId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'integrationType')) { + $this->integrationType = $object->integrationType; + } + if (property_exists($object, 'openId')) { + $this->openId = $object->openId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct869SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct869SpecificInput.php new file mode 100644 index 0000000..c05cb08 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct869SpecificInput.php @@ -0,0 +1,68 @@ +issuerId)) { + $object->issuerId = $this->issuerId; + } + if (!is_null($this->residentIdName)) { + $object->residentIdName = $this->residentIdName; + } + if (!is_null($this->residentIdNumber)) { + $object->residentIdNumber = $this->residentIdNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'issuerId')) { + $this->issuerId = $object->issuerId; + } + if (property_exists($object, 'residentIdName')) { + $this->residentIdName = $object->residentIdName; + } + if (property_exists($object, 'residentIdNumber')) { + $this->residentIdNumber = $object->residentIdNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct882SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct882SpecificInput.php new file mode 100644 index 0000000..613d5ef --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectPaymentProduct882SpecificInput.php @@ -0,0 +1,46 @@ +issuerId)) { + $object->issuerId = $this->issuerId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'issuerId')) { + $this->issuerId = $object->issuerId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RedirectionData.php b/src/Worldline/Connect/Sdk/V1/Domain/RedirectionData.php new file mode 100644 index 0000000..d73999f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RedirectionData.php @@ -0,0 +1,57 @@ +returnUrl)) { + $object->returnUrl = $this->returnUrl; + } + if (!is_null($this->variant)) { + $object->variant = $this->variant; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'returnUrl')) { + $this->returnUrl = $object->returnUrl; + } + if (property_exists($object, 'variant')) { + $this->variant = $object->variant; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundBankMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundBankMethodSpecificOutput.php new file mode 100644 index 0000000..f47f249 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundBankMethodSpecificOutput.php @@ -0,0 +1,34 @@ +authorisationCode)) { + $object->authorisationCode = $this->authorisationCode; + } + if (!is_null($this->card)) { + $object->card = $this->card->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorisationCode')) { + $this->authorisationCode = $object->authorisationCode; + } + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new CardEssentials(); + $this->card = $value->fromObject($object->card); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundCashMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundCashMethodSpecificOutput.php new file mode 100644 index 0000000..483d1be --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundCashMethodSpecificOutput.php @@ -0,0 +1,34 @@ +address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->companyInformation)) { + $object->companyInformation = $this->companyInformation->toObject(); + } + if (!is_null($this->contactDetails)) { + $object->contactDetails = $this->contactDetails->toObject(); + } + if (!is_null($this->fiscalNumber)) { + $object->fiscalNumber = $this->fiscalNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new AddressPersonal(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'companyInformation')) { + if (!is_object($object->companyInformation)) { + throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); + } + $value = new CompanyInformation(); + $this->companyInformation = $value->fromObject($object->companyInformation); + } + if (property_exists($object, 'contactDetails')) { + if (!is_object($object->contactDetails)) { + throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); + } + $value = new ContactDetailsBase(); + $this->contactDetails = $value->fromObject($object->contactDetails); + } + if (property_exists($object, 'fiscalNumber')) { + $this->fiscalNumber = $object->fiscalNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundEInvoiceMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundEInvoiceMethodSpecificOutput.php new file mode 100644 index 0000000..e781cb9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundEInvoiceMethodSpecificOutput.php @@ -0,0 +1,34 @@ +paymentProduct840SpecificOutput)) { + $object->paymentProduct840SpecificOutput = $this->paymentProduct840SpecificOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct840SpecificOutput')) { + if (!is_object($object->paymentProduct840SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct840SpecificOutput, true) . '\' is not an object'); + } + $value = new RefundPaymentProduct840SpecificOutput(); + $this->paymentProduct840SpecificOutput = $value->fromObject($object->paymentProduct840SpecificOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundErrorResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundErrorResponse.php new file mode 100644 index 0000000..01c4734 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundErrorResponse.php @@ -0,0 +1,84 @@ +errorId)) { + $object->errorId = $this->errorId; + } + if (!is_null($this->errors)) { + $object->errors = []; + foreach ($this->errors as $element) { + if (!is_null($element)) { + $object->errors[] = $element->toObject(); + } + } + } + if (!is_null($this->refundResult)) { + $object->refundResult = $this->refundResult->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'errorId')) { + $this->errorId = $object->errorId; + } + if (property_exists($object, 'errors')) { + if (!is_array($object->errors) && !is_object($object->errors)) { + throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); + } + $this->errors = []; + foreach ($object->errors as $element) { + $value = new APIError(); + $this->errors[] = $value->fromObject($element); + } + } + if (property_exists($object, 'refundResult')) { + if (!is_object($object->refundResult)) { + throw new UnexpectedValueException('value \'' . print_r($object->refundResult, true) . '\' is not an object'); + } + $value = new RefundResult(); + $this->refundResult = $value->fromObject($object->refundResult); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundMethodSpecificOutput.php new file mode 100644 index 0000000..2cf483e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundMethodSpecificOutput.php @@ -0,0 +1,68 @@ +refundProductId)) { + $object->refundProductId = $this->refundProductId; + } + if (!is_null($this->totalAmountPaid)) { + $object->totalAmountPaid = $this->totalAmountPaid; + } + if (!is_null($this->totalAmountRefunded)) { + $object->totalAmountRefunded = $this->totalAmountRefunded; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'refundProductId')) { + $this->refundProductId = $object->refundProductId; + } + if (property_exists($object, 'totalAmountPaid')) { + $this->totalAmountPaid = $object->totalAmountPaid; + } + if (property_exists($object, 'totalAmountRefunded')) { + $this->totalAmountRefunded = $object->totalAmountRefunded; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundMobileMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundMobileMethodSpecificOutput.php new file mode 100644 index 0000000..24f7fa8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundMobileMethodSpecificOutput.php @@ -0,0 +1,45 @@ +network)) { + $object->network = $this->network; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'network')) { + $this->network = $object->network; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundOutput.php new file mode 100644 index 0000000..09251d4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundOutput.php @@ -0,0 +1,146 @@ +amountPaid)) { + $object->amountPaid = $this->amountPaid; + } + if (!is_null($this->bankRefundMethodSpecificOutput)) { + $object->bankRefundMethodSpecificOutput = $this->bankRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->cardRefundMethodSpecificOutput)) { + $object->cardRefundMethodSpecificOutput = $this->cardRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->cashRefundMethodSpecificOutput)) { + $object->cashRefundMethodSpecificOutput = $this->cashRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->eInvoiceRefundMethodSpecificOutput)) { + $object->eInvoiceRefundMethodSpecificOutput = $this->eInvoiceRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->eWalletRefundMethodSpecificOutput)) { + $object->eWalletRefundMethodSpecificOutput = $this->eWalletRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->mobileRefundMethodSpecificOutput)) { + $object->mobileRefundMethodSpecificOutput = $this->mobileRefundMethodSpecificOutput->toObject(); + } + if (!is_null($this->paymentMethod)) { + $object->paymentMethod = $this->paymentMethod; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountPaid')) { + $this->amountPaid = $object->amountPaid; + } + if (property_exists($object, 'bankRefundMethodSpecificOutput')) { + if (!is_object($object->bankRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundBankMethodSpecificOutput(); + $this->bankRefundMethodSpecificOutput = $value->fromObject($object->bankRefundMethodSpecificOutput); + } + if (property_exists($object, 'cardRefundMethodSpecificOutput')) { + if (!is_object($object->cardRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundCardMethodSpecificOutput(); + $this->cardRefundMethodSpecificOutput = $value->fromObject($object->cardRefundMethodSpecificOutput); + } + if (property_exists($object, 'cashRefundMethodSpecificOutput')) { + if (!is_object($object->cashRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->cashRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundCashMethodSpecificOutput(); + $this->cashRefundMethodSpecificOutput = $value->fromObject($object->cashRefundMethodSpecificOutput); + } + if (property_exists($object, 'eInvoiceRefundMethodSpecificOutput')) { + if (!is_object($object->eInvoiceRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eInvoiceRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundEInvoiceMethodSpecificOutput(); + $this->eInvoiceRefundMethodSpecificOutput = $value->fromObject($object->eInvoiceRefundMethodSpecificOutput); + } + if (property_exists($object, 'eWalletRefundMethodSpecificOutput')) { + if (!is_object($object->eWalletRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->eWalletRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundEWalletMethodSpecificOutput(); + $this->eWalletRefundMethodSpecificOutput = $value->fromObject($object->eWalletRefundMethodSpecificOutput); + } + if (property_exists($object, 'mobileRefundMethodSpecificOutput')) { + if (!is_object($object->mobileRefundMethodSpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->mobileRefundMethodSpecificOutput, true) . '\' is not an object'); + } + $value = new RefundMobileMethodSpecificOutput(); + $this->mobileRefundMethodSpecificOutput = $value->fromObject($object->mobileRefundMethodSpecificOutput); + } + if (property_exists($object, 'paymentMethod')) { + $this->paymentMethod = $object->paymentMethod; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840CustomerAccount.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840CustomerAccount.php new file mode 100644 index 0000000..5f867b0 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840CustomerAccount.php @@ -0,0 +1,68 @@ +customerAccountStatus)) { + $object->customerAccountStatus = $this->customerAccountStatus; + } + if (!is_null($this->customerAddressStatus)) { + $object->customerAddressStatus = $this->customerAddressStatus; + } + if (!is_null($this->payerId)) { + $object->payerId = $this->payerId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customerAccountStatus')) { + $this->customerAccountStatus = $object->customerAccountStatus; + } + if (property_exists($object, 'customerAddressStatus')) { + $this->customerAddressStatus = $object->customerAddressStatus; + } + if (property_exists($object, 'payerId')) { + $this->payerId = $object->payerId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840SpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840SpecificOutput.php new file mode 100644 index 0000000..77e2684 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundPaymentProduct840SpecificOutput.php @@ -0,0 +1,50 @@ +customerAccount)) { + $object->customerAccount = $this->customerAccount->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customerAccount')) { + if (!is_object($object->customerAccount)) { + throw new UnexpectedValueException('value \'' . print_r($object->customerAccount, true) . '\' is not an object'); + } + $value = new RefundPaymentProduct840CustomerAccount(); + $this->customerAccount = $value->fromObject($object->customerAccount); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundReferences.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundReferences.php new file mode 100644 index 0000000..df2a327 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundReferences.php @@ -0,0 +1,46 @@ +merchantReference)) { + $object->merchantReference = $this->merchantReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'merchantReference')) { + $this->merchantReference = $object->merchantReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundRequest.php new file mode 100644 index 0000000..5087f2a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundRequest.php @@ -0,0 +1,106 @@ +amountOfMoney)) { + $object->amountOfMoney = $this->amountOfMoney->toObject(); + } + if (!is_null($this->bankRefundMethodSpecificInput)) { + $object->bankRefundMethodSpecificInput = $this->bankRefundMethodSpecificInput->toObject(); + } + if (!is_null($this->customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->refundDate)) { + $object->refundDate = $this->refundDate; + } + if (!is_null($this->refundReferences)) { + $object->refundReferences = $this->refundReferences->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoney')) { + if (!is_object($object->amountOfMoney)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoney = $value->fromObject($object->amountOfMoney); + } + if (property_exists($object, 'bankRefundMethodSpecificInput')) { + if (!is_object($object->bankRefundMethodSpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificInput, true) . '\' is not an object'); + } + $value = new BankRefundMethodSpecificInput(); + $this->bankRefundMethodSpecificInput = $value->fromObject($object->bankRefundMethodSpecificInput); + } + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new RefundCustomer(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'refundDate')) { + $this->refundDate = $object->refundDate; + } + if (property_exists($object, 'refundReferences')) { + if (!is_object($object->refundReferences)) { + throw new UnexpectedValueException('value \'' . print_r($object->refundReferences, true) . '\' is not an object'); + } + $value = new RefundReferences(); + $this->refundReferences = $value->fromObject($object->refundReferences); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundResponse.php new file mode 100644 index 0000000..087bfc9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundResponse.php @@ -0,0 +1,34 @@ +refundOutput)) { + $object->refundOutput = $this->refundOutput->toObject(); + } + if (!is_null($this->status)) { + $object->status = $this->status; + } + if (!is_null($this->statusOutput)) { + $object->statusOutput = $this->statusOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'refundOutput')) { + if (!is_object($object->refundOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->refundOutput, true) . '\' is not an object'); + } + $value = new RefundOutput(); + $this->refundOutput = $value->fromObject($object->refundOutput); + } + if (property_exists($object, 'status')) { + $this->status = $object->status; + } + if (property_exists($object, 'statusOutput')) { + if (!is_object($object->statusOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); + } + $value = new OrderStatusOutput(); + $this->statusOutput = $value->fromObject($object->statusOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RefundsResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/RefundsResponse.php new file mode 100644 index 0000000..2aa686f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RefundsResponse.php @@ -0,0 +1,58 @@ +refunds)) { + $object->refunds = []; + foreach ($this->refunds as $element) { + if (!is_null($element)) { + $object->refunds[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'refunds')) { + if (!is_array($object->refunds) && !is_object($object->refunds)) { + throw new UnexpectedValueException('value \'' . print_r($object->refunds, true) . '\' is not an array or object'); + } + $this->refunds = []; + foreach ($object->refunds as $element) { + $value = new RefundResult(); + $this->refunds[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RegularExpressionValidator.php b/src/Worldline/Connect/Sdk/V1/Domain/RegularExpressionValidator.php new file mode 100644 index 0000000..0d5cedd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RegularExpressionValidator.php @@ -0,0 +1,46 @@ +regularExpression)) { + $object->regularExpression = $this->regularExpression; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'regularExpression')) { + $this->regularExpression = $object->regularExpression; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ResultDoRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/ResultDoRiskAssessment.php new file mode 100644 index 0000000..a99c87a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ResultDoRiskAssessment.php @@ -0,0 +1,87 @@ +category)) { + $object->category = $this->category; + } + if (!is_null($this->result)) { + $object->result = $this->result; + } + if (!is_null($this->retaildecisionsCCFraudCheckOutput)) { + $object->retaildecisionsCCFraudCheckOutput = $this->retaildecisionsCCFraudCheckOutput->toObject(); + } + if (!is_null($this->validationBankAccountOutput)) { + $object->validationBankAccountOutput = $this->validationBankAccountOutput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'category')) { + $this->category = $object->category; + } + if (property_exists($object, 'result')) { + $this->result = $object->result; + } + if (property_exists($object, 'retaildecisionsCCFraudCheckOutput')) { + if (!is_object($object->retaildecisionsCCFraudCheckOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->retaildecisionsCCFraudCheckOutput, true) . '\' is not an object'); + } + $value = new RetailDecisionsCCFraudCheckOutput(); + $this->retaildecisionsCCFraudCheckOutput = $value->fromObject($object->retaildecisionsCCFraudCheckOutput); + } + if (property_exists($object, 'validationBankAccountOutput')) { + if (!is_object($object->validationBankAccountOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->validationBankAccountOutput, true) . '\' is not an object'); + } + $value = new ValidationBankAccountOutput(); + $this->validationBankAccountOutput = $value->fromObject($object->validationBankAccountOutput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RetailDecisionsCCFraudCheckOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/RetailDecisionsCCFraudCheckOutput.php new file mode 100644 index 0000000..918be6b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RetailDecisionsCCFraudCheckOutput.php @@ -0,0 +1,68 @@ +fraudCode)) { + $object->fraudCode = $this->fraudCode; + } + if (!is_null($this->fraudNeural)) { + $object->fraudNeural = $this->fraudNeural; + } + if (!is_null($this->fraudRCF)) { + $object->fraudRCF = $this->fraudRCF; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudCode')) { + $this->fraudCode = $object->fraudCode; + } + if (property_exists($object, 'fraudNeural')) { + $this->fraudNeural = $object->fraudNeural; + } + if (property_exists($object, 'fraudRCF')) { + $this->fraudRCF = $object->fraudRCF; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessment.php new file mode 100644 index 0000000..8964e26 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessment.php @@ -0,0 +1,91 @@ +fraudFields)) { + $object->fraudFields = $this->fraudFields->toObject(); + } + if (!is_null($this->merchant)) { + $object->merchant = $this->merchant->toObject(); + } + if (!is_null($this->order)) { + $object->order = $this->order->toObject(); + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudFields')) { + if (!is_object($object->fraudFields)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object'); + } + $value = new FraudFields(); + $this->fraudFields = $value->fromObject($object->fraudFields); + } + if (property_exists($object, 'merchant')) { + if (!is_object($object->merchant)) { + throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); + } + $value = new MerchantRiskAssessment(); + $this->merchant = $value->fromObject($object->merchant); + } + if (property_exists($object, 'order')) { + if (!is_object($object->order)) { + throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); + } + $value = new OrderRiskAssessment(); + $this->order = $value->fromObject($object->order); + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentBankAccount.php b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentBankAccount.php new file mode 100644 index 0000000..0fa4fe9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentBankAccount.php @@ -0,0 +1,64 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + if (!is_null($this->bankAccountIban)) { + $object->bankAccountIban = $this->bankAccountIban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + if (property_exists($object, 'bankAccountIban')) { + if (!is_object($object->bankAccountIban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object'); + } + $value = new BankAccountIban(); + $this->bankAccountIban = $value->fromObject($object->bankAccountIban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentCard.php b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentCard.php new file mode 100644 index 0000000..31ce7db --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentCard.php @@ -0,0 +1,49 @@ +card)) { + $object->card = $this->card->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new Card(); + $this->card = $value->fromObject($object->card); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentResponse.php new file mode 100644 index 0000000..ba41990 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/RiskAssessmentResponse.php @@ -0,0 +1,58 @@ +results)) { + $object->results = []; + foreach ($this->results as $element) { + if (!is_null($element)) { + $object->results[] = $element->toObject(); + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'results')) { + if (!is_array($object->results) && !is_object($object->results)) { + throw new UnexpectedValueException('value \'' . print_r($object->results, true) . '\' is not an array or object'); + } + $this->results = []; + foreach ($object->results as $element) { + $value = new ResultDoRiskAssessment(); + $this->results[] = $value->fromObject($element); + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SchemeTokenData.php b/src/Worldline/Connect/Sdk/V1/Domain/SchemeTokenData.php new file mode 100644 index 0000000..e90fa5a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SchemeTokenData.php @@ -0,0 +1,90 @@ +cardholderName)) { + $object->cardholderName = $this->cardholderName; + } + if (!is_null($this->cryptogram)) { + $object->cryptogram = $this->cryptogram; + } + if (!is_null($this->eci)) { + $object->eci = $this->eci; + } + if (!is_null($this->networkToken)) { + $object->networkToken = $this->networkToken; + } + if (!is_null($this->tokenExpiryDate)) { + $object->tokenExpiryDate = $this->tokenExpiryDate; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardholderName')) { + $this->cardholderName = $object->cardholderName; + } + if (property_exists($object, 'cryptogram')) { + $this->cryptogram = $object->cryptogram; + } + if (property_exists($object, 'eci')) { + $this->eci = $object->eci; + } + if (property_exists($object, 'networkToken')) { + $this->networkToken = $object->networkToken; + } + if (property_exists($object, 'tokenExpiryDate')) { + $this->tokenExpiryDate = $object->tokenExpiryDate; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SdkDataInput.php b/src/Worldline/Connect/Sdk/V1/Domain/SdkDataInput.php new file mode 100644 index 0000000..49351c8 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SdkDataInput.php @@ -0,0 +1,116 @@ +deviceRenderOptions)) { + $object->deviceRenderOptions = $this->deviceRenderOptions->toObject(); + } + if (!is_null($this->sdkAppId)) { + $object->sdkAppId = $this->sdkAppId; + } + if (!is_null($this->sdkEncryptedData)) { + $object->sdkEncryptedData = $this->sdkEncryptedData; + } + if (!is_null($this->sdkEphemeralPublicKey)) { + $object->sdkEphemeralPublicKey = $this->sdkEphemeralPublicKey; + } + if (!is_null($this->sdkMaxTimeout)) { + $object->sdkMaxTimeout = $this->sdkMaxTimeout; + } + if (!is_null($this->sdkReferenceNumber)) { + $object->sdkReferenceNumber = $this->sdkReferenceNumber; + } + if (!is_null($this->sdkTransactionId)) { + $object->sdkTransactionId = $this->sdkTransactionId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'deviceRenderOptions')) { + if (!is_object($object->deviceRenderOptions)) { + throw new UnexpectedValueException('value \'' . print_r($object->deviceRenderOptions, true) . '\' is not an object'); + } + $value = new DeviceRenderOptions(); + $this->deviceRenderOptions = $value->fromObject($object->deviceRenderOptions); + } + if (property_exists($object, 'sdkAppId')) { + $this->sdkAppId = $object->sdkAppId; + } + if (property_exists($object, 'sdkEncryptedData')) { + $this->sdkEncryptedData = $object->sdkEncryptedData; + } + if (property_exists($object, 'sdkEphemeralPublicKey')) { + $this->sdkEphemeralPublicKey = $object->sdkEphemeralPublicKey; + } + if (property_exists($object, 'sdkMaxTimeout')) { + $this->sdkMaxTimeout = $object->sdkMaxTimeout; + } + if (property_exists($object, 'sdkReferenceNumber')) { + $this->sdkReferenceNumber = $object->sdkReferenceNumber; + } + if (property_exists($object, 'sdkTransactionId')) { + $this->sdkTransactionId = $object->sdkTransactionId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SdkDataOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/SdkDataOutput.php new file mode 100644 index 0000000..5ff786a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SdkDataOutput.php @@ -0,0 +1,46 @@ +sdkTransactionId)) { + $object->sdkTransactionId = $this->sdkTransactionId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'sdkTransactionId')) { + $this->sdkTransactionId = $object->sdkTransactionId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Seller.php b/src/Worldline/Connect/Sdk/V1/Domain/Seller.php new file mode 100644 index 0000000..ebec5ff --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Seller.php @@ -0,0 +1,171 @@ +address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->channelCode)) { + $object->channelCode = $this->channelCode; + } + if (!is_null($this->description)) { + $object->description = $this->description; + } + if (!is_null($this->externalReferenceId)) { + $object->externalReferenceId = $this->externalReferenceId; + } + if (!is_null($this->geocode)) { + $object->geocode = $this->geocode; + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->invoiceNumber)) { + $object->invoiceNumber = $this->invoiceNumber; + } + if (!is_null($this->isForeignRetailer)) { + $object->isForeignRetailer = $this->isForeignRetailer; + } + if (!is_null($this->mcc)) { + $object->mcc = $this->mcc; + } + if (!is_null($this->name)) { + $object->name = $this->name; + } + if (!is_null($this->phoneNumber)) { + $object->phoneNumber = $this->phoneNumber; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new Address(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'channelCode')) { + $this->channelCode = $object->channelCode; + } + if (property_exists($object, 'description')) { + $this->description = $object->description; + } + if (property_exists($object, 'externalReferenceId')) { + $this->externalReferenceId = $object->externalReferenceId; + } + if (property_exists($object, 'geocode')) { + $this->geocode = $object->geocode; + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'invoiceNumber')) { + $this->invoiceNumber = $object->invoiceNumber; + } + if (property_exists($object, 'isForeignRetailer')) { + $this->isForeignRetailer = $object->isForeignRetailer; + } + if (property_exists($object, 'mcc')) { + $this->mcc = $object->mcc; + } + if (property_exists($object, 'name')) { + $this->name = $object->name; + } + if (property_exists($object, 'phoneNumber')) { + $this->phoneNumber = $object->phoneNumber; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInput.php new file mode 100644 index 0000000..2850f13 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInput.php @@ -0,0 +1,126 @@ +dateCollect)) { + $object->dateCollect = $this->dateCollect; + } + if (!is_null($this->directDebitText)) { + $object->directDebitText = $this->directDebitText; + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->paymentProduct771SpecificInput)) { + $object->paymentProduct771SpecificInput = $this->paymentProduct771SpecificInput->toObject(); + } + if (!is_null($this->recurringPaymentSequenceIndicator)) { + $object->recurringPaymentSequenceIndicator = $this->recurringPaymentSequenceIndicator; + } + if (!is_null($this->requiresApproval)) { + $object->requiresApproval = $this->requiresApproval; + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + if (!is_null($this->tokenize)) { + $object->tokenize = $this->tokenize; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'dateCollect')) { + $this->dateCollect = $object->dateCollect; + } + if (property_exists($object, 'directDebitText')) { + $this->directDebitText = $object->directDebitText; + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'paymentProduct771SpecificInput')) { + if (!is_object($object->paymentProduct771SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct771SpecificInput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentProduct771SpecificInput(); + $this->paymentProduct771SpecificInput = $value->fromObject($object->paymentProduct771SpecificInput); + } + if (property_exists($object, 'recurringPaymentSequenceIndicator')) { + $this->recurringPaymentSequenceIndicator = $object->recurringPaymentSequenceIndicator; + } + if (property_exists($object, 'requiresApproval')) { + $this->requiresApproval = $object->requiresApproval; + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + if (property_exists($object, 'tokenize')) { + $this->tokenize = $object->tokenize; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInputBase.php new file mode 100644 index 0000000..7eefcdb --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificInputBase.php @@ -0,0 +1,49 @@ +paymentProduct771SpecificInput)) { + $object->paymentProduct771SpecificInput = $this->paymentProduct771SpecificInput->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct771SpecificInput')) { + if (!is_object($object->paymentProduct771SpecificInput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct771SpecificInput, true) . '\' is not an object'); + } + $value = new SepaDirectDebitPaymentProduct771SpecificInputBase(); + $this->paymentProduct771SpecificInput = $value->fromObject($object->paymentProduct771SpecificInput); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificOutput.php new file mode 100644 index 0000000..96d94ce --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentMethodSpecificOutput.php @@ -0,0 +1,75 @@ +fraudResults)) { + $object->fraudResults = $this->fraudResults->toObject(); + } + if (!is_null($this->paymentProduct771SpecificOutput)) { + $object->paymentProduct771SpecificOutput = $this->paymentProduct771SpecificOutput->toObject(); + } + if (!is_null($this->token)) { + $object->token = $this->token; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'fraudResults')) { + if (!is_object($object->fraudResults)) { + throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); + } + $value = new FraudResults(); + $this->fraudResults = $value->fromObject($object->fraudResults); + } + if (property_exists($object, 'paymentProduct771SpecificOutput')) { + if (!is_object($object->paymentProduct771SpecificOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct771SpecificOutput, true) . '\' is not an object'); + } + $value = new PaymentProduct771SpecificOutput(); + $this->paymentProduct771SpecificOutput = $value->fromObject($object->paymentProduct771SpecificOutput); + } + if (property_exists($object, 'token')) { + $this->token = $object->token; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInput.php b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInput.php new file mode 100644 index 0000000..b7479d7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInput.php @@ -0,0 +1,60 @@ +existingUniqueMandateReference)) { + $object->existingUniqueMandateReference = $this->existingUniqueMandateReference; + } + if (!is_null($this->mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'existingUniqueMandateReference')) { + $this->existingUniqueMandateReference = $object->existingUniqueMandateReference; + } + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new CreateMandateWithReturnUrl(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInputBase.php b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInputBase.php new file mode 100644 index 0000000..509d340 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SepaDirectDebitPaymentProduct771SpecificInputBase.php @@ -0,0 +1,60 @@ +existingUniqueMandateReference)) { + $object->existingUniqueMandateReference = $this->existingUniqueMandateReference; + } + if (!is_null($this->mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'existingUniqueMandateReference')) { + $this->existingUniqueMandateReference = $object->existingUniqueMandateReference; + } + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new CreateMandateBase(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SessionRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/SessionRequest.php new file mode 100644 index 0000000..801191b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SessionRequest.php @@ -0,0 +1,72 @@ +paymentProductFilters)) { + $object->paymentProductFilters = $this->paymentProductFilters->toObject(); + } + if (!is_null($this->tokens)) { + $object->tokens = []; + foreach ($this->tokens as $element) { + if (!is_null($element)) { + $object->tokens[] = $element; + } + } + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProductFilters')) { + if (!is_object($object->paymentProductFilters)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProductFilters, true) . '\' is not an object'); + } + $value = new PaymentProductFiltersClientSession(); + $this->paymentProductFilters = $value->fromObject($object->paymentProductFilters); + } + if (property_exists($object, 'tokens')) { + if (!is_array($object->tokens) && !is_object($object->tokens)) { + throw new UnexpectedValueException('value \'' . print_r($object->tokens, true) . '\' is not an array or object'); + } + $this->tokens = []; + foreach ($object->tokens as $element) { + $this->tokens[] = $element; + } + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/SessionResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/SessionResponse.php new file mode 100644 index 0000000..db57bdd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/SessionResponse.php @@ -0,0 +1,112 @@ +assetUrl)) { + $object->assetUrl = $this->assetUrl; + } + if (!is_null($this->clientApiUrl)) { + $object->clientApiUrl = $this->clientApiUrl; + } + if (!is_null($this->clientSessionId)) { + $object->clientSessionId = $this->clientSessionId; + } + if (!is_null($this->customerId)) { + $object->customerId = $this->customerId; + } + if (!is_null($this->invalidTokens)) { + $object->invalidTokens = []; + foreach ($this->invalidTokens as $element) { + if (!is_null($element)) { + $object->invalidTokens[] = $element; + } + } + } + if (!is_null($this->region)) { + $object->region = $this->region; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'assetUrl')) { + $this->assetUrl = $object->assetUrl; + } + if (property_exists($object, 'clientApiUrl')) { + $this->clientApiUrl = $object->clientApiUrl; + } + if (property_exists($object, 'clientSessionId')) { + $this->clientSessionId = $object->clientSessionId; + } + if (property_exists($object, 'customerId')) { + $this->customerId = $object->customerId; + } + if (property_exists($object, 'invalidTokens')) { + if (!is_array($object->invalidTokens) && !is_object($object->invalidTokens)) { + throw new UnexpectedValueException('value \'' . print_r($object->invalidTokens, true) . '\' is not an array or object'); + } + $this->invalidTokens = []; + foreach ($object->invalidTokens as $element) { + $this->invalidTokens[] = $element; + } + } + if (property_exists($object, 'region')) { + $this->region = $object->region; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Shipping.php b/src/Worldline/Connect/Sdk/V1/Domain/Shipping.php new file mode 100644 index 0000000..1426012 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Shipping.php @@ -0,0 +1,127 @@ +address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->addressIndicator)) { + $object->addressIndicator = $this->addressIndicator; + } + if (!is_null($this->comments)) { + $object->comments = $this->comments; + } + if (!is_null($this->emailAddress)) { + $object->emailAddress = $this->emailAddress; + } + if (!is_null($this->firstUsageDate)) { + $object->firstUsageDate = $this->firstUsageDate; + } + if (!is_null($this->isFirstUsage)) { + $object->isFirstUsage = $this->isFirstUsage; + } + if (!is_null($this->trackingNumber)) { + $object->trackingNumber = $this->trackingNumber; + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new AddressPersonal(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'addressIndicator')) { + $this->addressIndicator = $object->addressIndicator; + } + if (property_exists($object, 'comments')) { + $this->comments = $object->comments; + } + if (property_exists($object, 'emailAddress')) { + $this->emailAddress = $object->emailAddress; + } + if (property_exists($object, 'firstUsageDate')) { + $this->firstUsageDate = $object->firstUsageDate; + } + if (property_exists($object, 'isFirstUsage')) { + $this->isFirstUsage = $object->isFirstUsage; + } + if (property_exists($object, 'trackingNumber')) { + $this->trackingNumber = $object->trackingNumber; + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ShippingRiskAssessment.php b/src/Worldline/Connect/Sdk/V1/Domain/ShippingRiskAssessment.php new file mode 100644 index 0000000..20fa3a6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ShippingRiskAssessment.php @@ -0,0 +1,72 @@ +address)) { + $object->address = $this->address->toObject(); + } + if (!is_null($this->comments)) { + $object->comments = $this->comments; + } + if (!is_null($this->trackingNumber)) { + $object->trackingNumber = $this->trackingNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'address')) { + if (!is_object($object->address)) { + throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); + } + $value = new AddressPersonal(); + $this->address = $value->fromObject($object->address); + } + if (property_exists($object, 'comments')) { + $this->comments = $object->comments; + } + if (property_exists($object, 'trackingNumber')) { + $this->trackingNumber = $object->trackingNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ShoppingCart.php b/src/Worldline/Connect/Sdk/V1/Domain/ShoppingCart.php new file mode 100644 index 0000000..538a524 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ShoppingCart.php @@ -0,0 +1,129 @@ +amountBreakdown)) { + $object->amountBreakdown = []; + foreach ($this->amountBreakdown as $element) { + if (!is_null($element)) { + $object->amountBreakdown[] = $element->toObject(); + } + } + } + if (!is_null($this->giftCardPurchase)) { + $object->giftCardPurchase = $this->giftCardPurchase->toObject(); + } + if (!is_null($this->isPreOrder)) { + $object->isPreOrder = $this->isPreOrder; + } + if (!is_null($this->items)) { + $object->items = []; + foreach ($this->items as $element) { + if (!is_null($element)) { + $object->items[] = $element->toObject(); + } + } + } + if (!is_null($this->preOrderItemAvailabilityDate)) { + $object->preOrderItemAvailabilityDate = $this->preOrderItemAvailabilityDate; + } + if (!is_null($this->reOrderIndicator)) { + $object->reOrderIndicator = $this->reOrderIndicator; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountBreakdown')) { + if (!is_array($object->amountBreakdown) && !is_object($object->amountBreakdown)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountBreakdown, true) . '\' is not an array or object'); + } + $this->amountBreakdown = []; + foreach ($object->amountBreakdown as $element) { + $value = new AmountBreakdown(); + $this->amountBreakdown[] = $value->fromObject($element); + } + } + if (property_exists($object, 'giftCardPurchase')) { + if (!is_object($object->giftCardPurchase)) { + throw new UnexpectedValueException('value \'' . print_r($object->giftCardPurchase, true) . '\' is not an object'); + } + $value = new GiftCardPurchase(); + $this->giftCardPurchase = $value->fromObject($object->giftCardPurchase); + } + if (property_exists($object, 'isPreOrder')) { + $this->isPreOrder = $object->isPreOrder; + } + if (property_exists($object, 'items')) { + if (!is_array($object->items) && !is_object($object->items)) { + throw new UnexpectedValueException('value \'' . print_r($object->items, true) . '\' is not an array or object'); + } + $this->items = []; + foreach ($object->items as $element) { + $value = new LineItem(); + $this->items[] = $value->fromObject($element); + } + } + if (property_exists($object, 'preOrderItemAvailabilityDate')) { + $this->preOrderItemAvailabilityDate = $object->preOrderItemAvailabilityDate; + } + if (property_exists($object, 'reOrderIndicator')) { + $this->reOrderIndicator = $object->reOrderIndicator; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/Swift.php b/src/Worldline/Connect/Sdk/V1/Domain/Swift.php new file mode 100644 index 0000000..1574a0e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/Swift.php @@ -0,0 +1,145 @@ +bic)) { + $object->bic = $this->bic; + } + if (!is_null($this->category)) { + $object->category = $this->category; + } + if (!is_null($this->chipsUID)) { + $object->chipsUID = $this->chipsUID; + } + if (!is_null($this->extraInfo)) { + $object->extraInfo = $this->extraInfo; + } + if (!is_null($this->poBoxCountry)) { + $object->poBoxCountry = $this->poBoxCountry; + } + if (!is_null($this->poBoxLocation)) { + $object->poBoxLocation = $this->poBoxLocation; + } + if (!is_null($this->poBoxNumber)) { + $object->poBoxNumber = $this->poBoxNumber; + } + if (!is_null($this->poBoxZip)) { + $object->poBoxZip = $this->poBoxZip; + } + if (!is_null($this->routingBic)) { + $object->routingBic = $this->routingBic; + } + if (!is_null($this->services)) { + $object->services = $this->services; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bic')) { + $this->bic = $object->bic; + } + if (property_exists($object, 'category')) { + $this->category = $object->category; + } + if (property_exists($object, 'chipsUID')) { + $this->chipsUID = $object->chipsUID; + } + if (property_exists($object, 'extraInfo')) { + $this->extraInfo = $object->extraInfo; + } + if (property_exists($object, 'poBoxCountry')) { + $this->poBoxCountry = $object->poBoxCountry; + } + if (property_exists($object, 'poBoxLocation')) { + $this->poBoxLocation = $object->poBoxLocation; + } + if (property_exists($object, 'poBoxNumber')) { + $this->poBoxNumber = $object->poBoxNumber; + } + if (property_exists($object, 'poBoxZip')) { + $this->poBoxZip = $object->poBoxZip; + } + if (property_exists($object, 'routingBic')) { + $this->routingBic = $object->routingBic; + } + if (property_exists($object, 'services')) { + $this->services = $object->services; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TestConnection.php b/src/Worldline/Connect/Sdk/V1/Domain/TestConnection.php new file mode 100644 index 0000000..8042072 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TestConnection.php @@ -0,0 +1,46 @@ +result)) { + $object->result = $this->result; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'result')) { + $this->result = $object->result; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyData.php b/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyData.php new file mode 100644 index 0000000..4996fb7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyData.php @@ -0,0 +1,50 @@ +paymentProduct863)) { + $object->paymentProduct863 = $this->paymentProduct863->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'paymentProduct863')) { + if (!is_object($object->paymentProduct863)) { + throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct863, true) . '\' is not an object'); + } + $value = new PaymentProduct863ThirdPartyData(); + $this->paymentProduct863 = $value->fromObject($object->paymentProduct863); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyStatusResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyStatusResponse.php new file mode 100644 index 0000000..e7ef4e6 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ThirdPartyStatusResponse.php @@ -0,0 +1,46 @@ +thirdPartyStatus)) { + $object->thirdPartyStatus = $this->thirdPartyStatus; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'thirdPartyStatus')) { + $this->thirdPartyStatus = $object->thirdPartyStatus; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecure.php b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecure.php new file mode 100644 index 0000000..fbc8b0b --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecure.php @@ -0,0 +1,64 @@ +externalCardholderAuthenticationData)) { + $object->externalCardholderAuthenticationData = $this->externalCardholderAuthenticationData->toObject(); + } + if (!is_null($this->redirectionData)) { + $object->redirectionData = $this->redirectionData->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'externalCardholderAuthenticationData')) { + if (!is_object($object->externalCardholderAuthenticationData)) { + throw new UnexpectedValueException('value \'' . print_r($object->externalCardholderAuthenticationData, true) . '\' is not an object'); + } + $value = new ExternalCardholderAuthenticationData(); + $this->externalCardholderAuthenticationData = $value->fromObject($object->externalCardholderAuthenticationData); + } + if (property_exists($object, 'redirectionData')) { + if (!is_object($object->redirectionData)) { + throw new UnexpectedValueException('value \'' . print_r($object->redirectionData, true) . '\' is not an object'); + } + $value = new RedirectionData(); + $this->redirectionData = $value->fromObject($object->redirectionData); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureBase.php b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureBase.php new file mode 100644 index 0000000..79ec4c9 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureBase.php @@ -0,0 +1,34 @@ +acsTransactionId)) { + $object->acsTransactionId = $this->acsTransactionId; + } + if (!is_null($this->method)) { + $object->method = $this->method; + } + if (!is_null($this->utcTimestamp)) { + $object->utcTimestamp = $this->utcTimestamp; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acsTransactionId')) { + $this->acsTransactionId = $object->acsTransactionId; + } + if (property_exists($object, 'method')) { + $this->method = $object->method; + } + if (property_exists($object, 'utcTimestamp')) { + $this->utcTimestamp = $object->utcTimestamp; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureResults.php b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureResults.php new file mode 100644 index 0000000..5ed936a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ThreeDSecureResults.php @@ -0,0 +1,194 @@ +acsTransactionId)) { + $object->acsTransactionId = $this->acsTransactionId; + } + if (!is_null($this->appliedExemption)) { + $object->appliedExemption = $this->appliedExemption; + } + if (!is_null($this->authenticationAmount)) { + $object->authenticationAmount = $this->authenticationAmount->toObject(); + } + if (!is_null($this->cavv)) { + $object->cavv = $this->cavv; + } + if (!is_null($this->directoryServerTransactionId)) { + $object->directoryServerTransactionId = $this->directoryServerTransactionId; + } + if (!is_null($this->eci)) { + $object->eci = $this->eci; + } + if (!is_null($this->exemptionOutput)) { + $object->exemptionOutput = $this->exemptionOutput->toObject(); + } + if (!is_null($this->schemeRiskScore)) { + $object->schemeRiskScore = $this->schemeRiskScore; + } + if (!is_null($this->sdkData)) { + $object->sdkData = $this->sdkData->toObject(); + } + if (!is_null($this->threeDSecureData)) { + $object->threeDSecureData = $this->threeDSecureData->toObject(); + } + if (!is_null($this->threeDSecureVersion)) { + $object->threeDSecureVersion = $this->threeDSecureVersion; + } + if (!is_null($this->threeDServerTransactionId)) { + $object->threeDServerTransactionId = $this->threeDServerTransactionId; + } + if (!is_null($this->xid)) { + $object->xid = $this->xid; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'acsTransactionId')) { + $this->acsTransactionId = $object->acsTransactionId; + } + if (property_exists($object, 'appliedExemption')) { + $this->appliedExemption = $object->appliedExemption; + } + if (property_exists($object, 'authenticationAmount')) { + if (!is_object($object->authenticationAmount)) { + throw new UnexpectedValueException('value \'' . print_r($object->authenticationAmount, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->authenticationAmount = $value->fromObject($object->authenticationAmount); + } + if (property_exists($object, 'cavv')) { + $this->cavv = $object->cavv; + } + if (property_exists($object, 'directoryServerTransactionId')) { + $this->directoryServerTransactionId = $object->directoryServerTransactionId; + } + if (property_exists($object, 'eci')) { + $this->eci = $object->eci; + } + if (property_exists($object, 'exemptionOutput')) { + if (!is_object($object->exemptionOutput)) { + throw new UnexpectedValueException('value \'' . print_r($object->exemptionOutput, true) . '\' is not an object'); + } + $value = new ExemptionOutput(); + $this->exemptionOutput = $value->fromObject($object->exemptionOutput); + } + if (property_exists($object, 'schemeRiskScore')) { + $this->schemeRiskScore = $object->schemeRiskScore; + } + if (property_exists($object, 'sdkData')) { + if (!is_object($object->sdkData)) { + throw new UnexpectedValueException('value \'' . print_r($object->sdkData, true) . '\' is not an object'); + } + $value = new SdkDataOutput(); + $this->sdkData = $value->fromObject($object->sdkData); + } + if (property_exists($object, 'threeDSecureData')) { + if (!is_object($object->threeDSecureData)) { + throw new UnexpectedValueException('value \'' . print_r($object->threeDSecureData, true) . '\' is not an object'); + } + $value = new ThreeDSecureData(); + $this->threeDSecureData = $value->fromObject($object->threeDSecureData); + } + if (property_exists($object, 'threeDSecureVersion')) { + $this->threeDSecureVersion = $object->threeDSecureVersion; + } + if (property_exists($object, 'threeDServerTransactionId')) { + $this->threeDServerTransactionId = $object->threeDServerTransactionId; + } + if (property_exists($object, 'xid')) { + $this->xid = $object->xid; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenCard.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenCard.php new file mode 100644 index 0000000..f40c6fa --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenCard.php @@ -0,0 +1,64 @@ +customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->data)) { + $object->data = $this->data->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerToken(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'data')) { + if (!is_object($object->data)) { + throw new UnexpectedValueException('value \'' . print_r($object->data, true) . '\' is not an object'); + } + $value = new TokenCardData(); + $this->data = $value->fromObject($object->data); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenCardData.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenCardData.php new file mode 100644 index 0000000..671fa48 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenCardData.php @@ -0,0 +1,72 @@ +cardWithoutCvv)) { + $object->cardWithoutCvv = $this->cardWithoutCvv->toObject(); + } + if (!is_null($this->firstTransactionDate)) { + $object->firstTransactionDate = $this->firstTransactionDate; + } + if (!is_null($this->providerReference)) { + $object->providerReference = $this->providerReference; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'cardWithoutCvv')) { + if (!is_object($object->cardWithoutCvv)) { + throw new UnexpectedValueException('value \'' . print_r($object->cardWithoutCvv, true) . '\' is not an object'); + } + $value = new CardWithoutCvv(); + $this->cardWithoutCvv = $value->fromObject($object->cardWithoutCvv); + } + if (property_exists($object, 'firstTransactionDate')) { + $this->firstTransactionDate = $object->firstTransactionDate; + } + if (property_exists($object, 'providerReference')) { + $this->providerReference = $object->providerReference; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenEWallet.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenEWallet.php new file mode 100644 index 0000000..4cf31ee --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenEWallet.php @@ -0,0 +1,64 @@ +customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->data)) { + $object->data = $this->data->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerToken(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'data')) { + if (!is_object($object->data)) { + throw new UnexpectedValueException('value \'' . print_r($object->data, true) . '\' is not an object'); + } + $value = new TokenEWalletData(); + $this->data = $value->fromObject($object->data); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenEWalletData.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenEWalletData.php new file mode 100644 index 0000000..ce6cf82 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenEWalletData.php @@ -0,0 +1,46 @@ +billingAgreementId)) { + $object->billingAgreementId = $this->billingAgreementId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'billingAgreementId')) { + $this->billingAgreementId = $object->billingAgreementId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebit.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebit.php new file mode 100644 index 0000000..6fb70bd --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebit.php @@ -0,0 +1,64 @@ +customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerToken(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateNonSepaDirectDebit(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct705SpecificData.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct705SpecificData.php new file mode 100644 index 0000000..a98cf26 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct705SpecificData.php @@ -0,0 +1,61 @@ +authorisationId)) { + $object->authorisationId = $this->authorisationId; + } + if (!is_null($this->bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'authorisationId')) { + $this->authorisationId = $object->authorisationId; + } + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct730SpecificData.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct730SpecificData.php new file mode 100644 index 0000000..ebb8e7a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenNonSepaDirectDebitPaymentProduct730SpecificData.php @@ -0,0 +1,50 @@ +bankAccountBban)) { + $object->bankAccountBban = $this->bankAccountBban->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'bankAccountBban')) { + if (!is_object($object->bankAccountBban)) { + throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object'); + } + $value = new BankAccountBban(); + $this->bankAccountBban = $value->fromObject($object->bankAccountBban); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenResponse.php new file mode 100644 index 0000000..376b4ec --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenResponse.php @@ -0,0 +1,128 @@ +card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->eWallet)) { + $object->eWallet = $this->eWallet->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->nonSepaDirectDebit)) { + $object->nonSepaDirectDebit = $this->nonSepaDirectDebit->toObject(); + } + if (!is_null($this->originalPaymentId)) { + $object->originalPaymentId = $this->originalPaymentId; + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + if (!is_null($this->sepaDirectDebit)) { + $object->sepaDirectDebit = $this->sepaDirectDebit->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new TokenCard(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'eWallet')) { + if (!is_object($object->eWallet)) { + throw new UnexpectedValueException('value \'' . print_r($object->eWallet, true) . '\' is not an object'); + } + $value = new TokenEWallet(); + $this->eWallet = $value->fromObject($object->eWallet); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'nonSepaDirectDebit')) { + if (!is_object($object->nonSepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->nonSepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenNonSepaDirectDebit(); + $this->nonSepaDirectDebit = $value->fromObject($object->nonSepaDirectDebit); + } + if (property_exists($object, 'originalPaymentId')) { + $this->originalPaymentId = $object->originalPaymentId; + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + if (property_exists($object, 'sepaDirectDebit')) { + if (!is_object($object->sepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenSepaDirectDebit(); + $this->sepaDirectDebit = $value->fromObject($object->sepaDirectDebit); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebit.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebit.php new file mode 100644 index 0000000..1426106 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebit.php @@ -0,0 +1,64 @@ +customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerTokenWithContactDetails(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateSepaDirectDebit(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebitWithoutCreditor.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebitWithoutCreditor.php new file mode 100644 index 0000000..6654034 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenSepaDirectDebitWithoutCreditor.php @@ -0,0 +1,64 @@ +customer)) { + $object->customer = $this->customer->toObject(); + } + if (!is_null($this->mandate)) { + $object->mandate = $this->mandate->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'customer')) { + if (!is_object($object->customer)) { + throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); + } + $value = new CustomerTokenWithContactDetails(); + $this->customer = $value->fromObject($object->customer); + } + if (property_exists($object, 'mandate')) { + if (!is_object($object->mandate)) { + throw new UnexpectedValueException('value \'' . print_r($object->mandate, true) . '\' is not an object'); + } + $value = new MandateSepaDirectDebitWithoutCreditor(); + $this->mandate = $value->fromObject($object->mandate); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TokenizePaymentRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/TokenizePaymentRequest.php new file mode 100644 index 0000000..b314a68 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TokenizePaymentRequest.php @@ -0,0 +1,46 @@ +alias)) { + $object->alias = $this->alias; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'alias')) { + $this->alias = $object->alias; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TrialInformation.php b/src/Worldline/Connect/Sdk/V1/Domain/TrialInformation.php new file mode 100644 index 0000000..726b16c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TrialInformation.php @@ -0,0 +1,102 @@ +amountOfMoneyAfterTrial)) { + $object->amountOfMoneyAfterTrial = $this->amountOfMoneyAfterTrial->toObject(); + } + if (!is_null($this->endDate)) { + $object->endDate = $this->endDate; + } + if (!is_null($this->isRecurring)) { + $object->isRecurring = $this->isRecurring; + } + if (!is_null($this->trialPeriod)) { + $object->trialPeriod = $this->trialPeriod->toObject(); + } + if (!is_null($this->trialPeriodRecurring)) { + $object->trialPeriodRecurring = $this->trialPeriodRecurring->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'amountOfMoneyAfterTrial')) { + if (!is_object($object->amountOfMoneyAfterTrial)) { + throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoneyAfterTrial, true) . '\' is not an object'); + } + $value = new AmountOfMoney(); + $this->amountOfMoneyAfterTrial = $value->fromObject($object->amountOfMoneyAfterTrial); + } + if (property_exists($object, 'endDate')) { + $this->endDate = $object->endDate; + } + if (property_exists($object, 'isRecurring')) { + $this->isRecurring = $object->isRecurring; + } + if (property_exists($object, 'trialPeriod')) { + if (!is_object($object->trialPeriod)) { + throw new UnexpectedValueException('value \'' . print_r($object->trialPeriod, true) . '\' is not an object'); + } + $value = new TrialPeriod(); + $this->trialPeriod = $value->fromObject($object->trialPeriod); + } + if (property_exists($object, 'trialPeriodRecurring')) { + if (!is_object($object->trialPeriodRecurring)) { + throw new UnexpectedValueException('value \'' . print_r($object->trialPeriodRecurring, true) . '\' is not an object'); + } + $value = new Frequency(); + $this->trialPeriodRecurring = $value->fromObject($object->trialPeriodRecurring); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TrialPeriod.php b/src/Worldline/Connect/Sdk/V1/Domain/TrialPeriod.php new file mode 100644 index 0000000..b890855 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TrialPeriod.php @@ -0,0 +1,57 @@ +duration)) { + $object->duration = $this->duration; + } + if (!is_null($this->interval)) { + $object->interval = $this->interval; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'duration')) { + $this->duration = $object->duration; + } + if (property_exists($object, 'interval')) { + $this->interval = $object->interval; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/TrustlyBankAccount.php b/src/Worldline/Connect/Sdk/V1/Domain/TrustlyBankAccount.php new file mode 100644 index 0000000..1d09958 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/TrustlyBankAccount.php @@ -0,0 +1,79 @@ +accountLastDigits)) { + $object->accountLastDigits = $this->accountLastDigits; + } + if (!is_null($this->bankName)) { + $object->bankName = $this->bankName; + } + if (!is_null($this->clearinghouse)) { + $object->clearinghouse = $this->clearinghouse; + } + if (!is_null($this->personIdentificationNumber)) { + $object->personIdentificationNumber = $this->personIdentificationNumber; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'accountLastDigits')) { + $this->accountLastDigits = $object->accountLastDigits; + } + if (property_exists($object, 'bankName')) { + $this->bankName = $object->bankName; + } + if (property_exists($object, 'clearinghouse')) { + $this->clearinghouse = $object->clearinghouse; + } + if (property_exists($object, 'personIdentificationNumber')) { + $this->personIdentificationNumber = $object->personIdentificationNumber; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/UpdateTokenRequest.php b/src/Worldline/Connect/Sdk/V1/Domain/UpdateTokenRequest.php new file mode 100644 index 0000000..57f081c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/UpdateTokenRequest.php @@ -0,0 +1,106 @@ +card)) { + $object->card = $this->card->toObject(); + } + if (!is_null($this->eWallet)) { + $object->eWallet = $this->eWallet->toObject(); + } + if (!is_null($this->nonSepaDirectDebit)) { + $object->nonSepaDirectDebit = $this->nonSepaDirectDebit->toObject(); + } + if (!is_null($this->paymentProductId)) { + $object->paymentProductId = $this->paymentProductId; + } + if (!is_null($this->sepaDirectDebit)) { + $object->sepaDirectDebit = $this->sepaDirectDebit->toObject(); + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'card')) { + if (!is_object($object->card)) { + throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); + } + $value = new TokenCard(); + $this->card = $value->fromObject($object->card); + } + if (property_exists($object, 'eWallet')) { + if (!is_object($object->eWallet)) { + throw new UnexpectedValueException('value \'' . print_r($object->eWallet, true) . '\' is not an object'); + } + $value = new TokenEWallet(); + $this->eWallet = $value->fromObject($object->eWallet); + } + if (property_exists($object, 'nonSepaDirectDebit')) { + if (!is_object($object->nonSepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->nonSepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenNonSepaDirectDebit(); + $this->nonSepaDirectDebit = $value->fromObject($object->nonSepaDirectDebit); + } + if (property_exists($object, 'paymentProductId')) { + $this->paymentProductId = $object->paymentProductId; + } + if (property_exists($object, 'sepaDirectDebit')) { + if (!is_object($object->sepaDirectDebit)) { + throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebit, true) . '\' is not an object'); + } + $value = new TokenSepaDirectDebitWithoutCreditor(); + $this->sepaDirectDebit = $value->fromObject($object->sepaDirectDebit); + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/UploadDisputeFileResponse.php b/src/Worldline/Connect/Sdk/V1/Domain/UploadDisputeFileResponse.php new file mode 100644 index 0000000..c9d1c12 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/UploadDisputeFileResponse.php @@ -0,0 +1,57 @@ +disputeId)) { + $object->disputeId = $this->disputeId; + } + if (!is_null($this->fileId)) { + $object->fileId = $this->fileId; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'disputeId')) { + $this->disputeId = $object->disputeId; + } + if (property_exists($object, 'fileId')) { + $this->fileId = $object->fileId; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountCheck.php b/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountCheck.php new file mode 100644 index 0000000..99e3d12 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountCheck.php @@ -0,0 +1,68 @@ +code)) { + $object->code = $this->code; + } + if (!is_null($this->description)) { + $object->description = $this->description; + } + if (!is_null($this->result)) { + $object->result = $this->result; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'code')) { + $this->code = $object->code; + } + if (property_exists($object, 'description')) { + $this->description = $object->description; + } + if (property_exists($object, 'result')) { + $this->result = $object->result; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountOutput.php b/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountOutput.php new file mode 100644 index 0000000..986c522 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ValidationBankAccountOutput.php @@ -0,0 +1,102 @@ +checks)) { + $object->checks = []; + foreach ($this->checks as $element) { + if (!is_null($element)) { + $object->checks[] = $element->toObject(); + } + } + } + if (!is_null($this->newBankName)) { + $object->newBankName = $this->newBankName; + } + if (!is_null($this->reformattedAccountNumber)) { + $object->reformattedAccountNumber = $this->reformattedAccountNumber; + } + if (!is_null($this->reformattedBankCode)) { + $object->reformattedBankCode = $this->reformattedBankCode; + } + if (!is_null($this->reformattedBranchCode)) { + $object->reformattedBranchCode = $this->reformattedBranchCode; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'checks')) { + if (!is_array($object->checks) && !is_object($object->checks)) { + throw new UnexpectedValueException('value \'' . print_r($object->checks, true) . '\' is not an array or object'); + } + $this->checks = []; + foreach ($object->checks as $element) { + $value = new ValidationBankAccountCheck(); + $this->checks[] = $value->fromObject($element); + } + } + if (property_exists($object, 'newBankName')) { + $this->newBankName = $object->newBankName; + } + if (property_exists($object, 'reformattedAccountNumber')) { + $this->reformattedAccountNumber = $object->reformattedAccountNumber; + } + if (property_exists($object, 'reformattedBankCode')) { + $this->reformattedBankCode = $object->reformattedBankCode; + } + if (property_exists($object, 'reformattedBranchCode')) { + $this->reformattedBranchCode = $object->reformattedBranchCode; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/ValueMappingElement.php b/src/Worldline/Connect/Sdk/V1/Domain/ValueMappingElement.php new file mode 100644 index 0000000..0df931a --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/ValueMappingElement.php @@ -0,0 +1,81 @@ +displayElements)) { + $object->displayElements = []; + foreach ($this->displayElements as $element) { + if (!is_null($element)) { + $object->displayElements[] = $element->toObject(); + } + } + } + if (!is_null($this->displayName)) { + $object->displayName = $this->displayName; + } + if (!is_null($this->value)) { + $object->value = $this->value; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'displayElements')) { + if (!is_array($object->displayElements) && !is_object($object->displayElements)) { + throw new UnexpectedValueException('value \'' . print_r($object->displayElements, true) . '\' is not an array or object'); + } + $this->displayElements = []; + foreach ($object->displayElements as $element) { + $value = new PaymentProductFieldDisplayElement(); + $this->displayElements[] = $value->fromObject($element); + } + } + if (property_exists($object, 'displayName')) { + $this->displayName = $object->displayName; + } + if (property_exists($object, 'value')) { + $this->value = $object->value; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Domain/WebhooksEvent.php b/src/Worldline/Connect/Sdk/V1/Domain/WebhooksEvent.php new file mode 100644 index 0000000..39fbbc3 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Domain/WebhooksEvent.php @@ -0,0 +1,165 @@ +apiVersion)) { + $object->apiVersion = $this->apiVersion; + } + if (!is_null($this->created)) { + $object->created = $this->created; + } + if (!is_null($this->dispute)) { + $object->dispute = $this->dispute->toObject(); + } + if (!is_null($this->id)) { + $object->id = $this->id; + } + if (!is_null($this->merchantId)) { + $object->merchantId = $this->merchantId; + } + if (!is_null($this->payment)) { + $object->payment = $this->payment->toObject(); + } + if (!is_null($this->payout)) { + $object->payout = $this->payout->toObject(); + } + if (!is_null($this->refund)) { + $object->refund = $this->refund->toObject(); + } + if (!is_null($this->token)) { + $object->token = $this->token->toObject(); + } + if (!is_null($this->type)) { + $object->type = $this->type; + } + return $object; + } + + /** + * @param object $object + * @return $this + * @throws UnexpectedValueException + */ + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'apiVersion')) { + $this->apiVersion = $object->apiVersion; + } + if (property_exists($object, 'created')) { + $this->created = $object->created; + } + if (property_exists($object, 'dispute')) { + if (!is_object($object->dispute)) { + throw new UnexpectedValueException('value \'' . print_r($object->dispute, true) . '\' is not an object'); + } + $value = new DisputeResponse(); + $this->dispute = $value->fromObject($object->dispute); + } + if (property_exists($object, 'id')) { + $this->id = $object->id; + } + if (property_exists($object, 'merchantId')) { + $this->merchantId = $object->merchantId; + } + if (property_exists($object, 'payment')) { + if (!is_object($object->payment)) { + throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); + } + $value = new PaymentResponse(); + $this->payment = $value->fromObject($object->payment); + } + if (property_exists($object, 'payout')) { + if (!is_object($object->payout)) { + throw new UnexpectedValueException('value \'' . print_r($object->payout, true) . '\' is not an object'); + } + $value = new PayoutResponse(); + $this->payout = $value->fromObject($object->payout); + } + if (property_exists($object, 'refund')) { + if (!is_object($object->refund)) { + throw new UnexpectedValueException('value \'' . print_r($object->refund, true) . '\' is not an object'); + } + $value = new RefundResponse(); + $this->refund = $value->fromObject($object->refund); + } + if (property_exists($object, 'token')) { + if (!is_object($object->token)) { + throw new UnexpectedValueException('value \'' . print_r($object->token, true) . '\' is not an object'); + } + $value = new TokenResponse(); + $this->token = $value->fromObject($object->token); + } + if (property_exists($object, 'type')) { + $this->type = $object->type; + } + return $this; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/ExceptionFactory.php b/src/Worldline/Connect/Sdk/V1/ExceptionFactory.php new file mode 100644 index 0000000..14537ae --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/ExceptionFactory.php @@ -0,0 +1,100 @@ +paymentResult)) { + return new DeclinedPaymentException($httpStatusCode, $errorObject); + } + if ($errorObject instanceof PayoutErrorResponse && !is_null($errorObject->payoutResult)) { + return new DeclinedPayoutException($httpStatusCode, $errorObject); + } + if ($errorObject instanceof RefundErrorResponse && !is_null($errorObject->refundResult)) { + return new DeclinedRefundException($httpStatusCode, $errorObject); + } + if ($httpStatusCode == 400) { + return new ValidationException($httpStatusCode, $errorObject); + } + if ($httpStatusCode == 403) { + return new AuthorizationException($httpStatusCode, $errorObject); + } + if ($httpStatusCode == 409 && $callContext && strlen($callContext->getIdempotenceKey()) > 0 && + $this->isIdempotenceError($errorObject) + ) { + return new IdempotenceException( + $httpStatusCode, + $errorObject, + null, + $callContext->getIdempotenceKey(), + $callContext->getIdempotenceRequestTimestamp() + ); + } + + $httpClassCode = floor($httpStatusCode / 100); + // If a different HTTP status code was sent, then either the user made an error, or the server is in trouble. + // If the user made an error, the server will give class 4 response. If the server made an error and realises + // this, it will send an appropriate error message with a class 5 response. It should not be sending other + // status codes; if it does, we raise an UnexpectedResponseException to signal this. + switch ($httpClassCode) { + case 4: + return new ReferenceException($httpStatusCode, $errorObject); + case 5: + return new PlatformException($httpStatusCode, $errorObject); + default: + return new ApiException($httpStatusCode, $errorObject); + } + } + + /** + * @param DataObject $errorObject + * @return bool + */ + protected function isIdempotenceError(DataObject $errorObject) + { + $errorObjectVariables = get_object_vars($errorObject); + if (!array_key_exists('errors', $errorObjectVariables)) { + return false; + } + $errors = $errorObjectVariables['errors']; + if (!is_array($errors)) { + return false; + } + if (count($errors) != 1) { + return false; + } + $error = $errors[0]; + if (!$error instanceof APIError) { + return false; + } + return $error->code == static::IDEMPOTENCE_ERROR_CODE; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/IdempotenceException.php b/src/Worldline/Connect/Sdk/V1/IdempotenceException.php new file mode 100644 index 0000000..45783de --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/IdempotenceException.php @@ -0,0 +1,57 @@ +idempotenceKey = $idempotenceKey; + $this->idempotenceRequestTimestamp = $idempotenceRequestTimestamp; + } + + /** + * @return string + */ + public function getIdempotenceKey() + { + return $this->idempotenceKey; + } + + /** + * @return string + */ + public function getIdempotenceRequestTimestamp() + { + return $this->idempotenceRequestTimestamp; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Captures/CapturesClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Captures/CapturesClient.php new file mode 100644 index 0000000..4b89f2c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Captures/CapturesClient.php @@ -0,0 +1,122 @@ +context['captureId'] = $captureId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CaptureResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/captures/{captureId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/captures/{captureId}/refund - Create Refund + * + * @param string $captureId + * @param RefundRequest $body + * @param CallContext $callContext + * @return RefundResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @throws DeclinedRefundException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/captures/refund.html Create Refund + */ + public function refund($captureId, RefundRequest $body, CallContext $callContext = null) + { + $this->context['captureId'] = $captureId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/captures/{captureId}/refund'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/DisputesClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/DisputesClient.php new file mode 100644 index 0000000..856fb8c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/DisputesClient.php @@ -0,0 +1,199 @@ +context['disputeId'] = $disputeId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/disputes/{disputeId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/disputes/{disputeId}/submit - Submit dispute + * + * @param string $disputeId + * @param CallContext $callContext + * @return DisputeResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/disputes/submit.html Submit dispute + */ + public function submit($disputeId, CallContext $callContext = null) + { + $this->context['disputeId'] = $disputeId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/disputes/{disputeId}/submit'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/disputes/{disputeId}/cancel - Cancel dispute + * + * @param string $disputeId + * @param CallContext $callContext + * @return DisputeResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/disputes/cancel.html Cancel dispute + */ + public function cancel($disputeId, CallContext $callContext = null) + { + $this->context['disputeId'] = $disputeId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/disputes/{disputeId}/cancel'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/disputes/{disputeId} - Upload File + * + * @param string $disputeId + * @param UploadFileRequest $body + * @param CallContext $callContext + * @return UploadDisputeFileResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/fileserviceapi/v1/en_US/php/disputes/uploadFile.html Upload File + */ + public function uploadFile($disputeId, UploadFileRequest $body, CallContext $callContext = null) + { + $this->context['disputeId'] = $disputeId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\UploadDisputeFileResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/files/v1/{merchantId}/disputes/{disputeId}'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/UploadFileRequest.php b/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/UploadFileRequest.php new file mode 100644 index 0000000..e8b2304 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Disputes/UploadFileRequest.php @@ -0,0 +1,33 @@ +file)) { + $result->addFile("file", $this->file); + } + return $result; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Files/FilesClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Files/FilesClient.php new file mode 100644 index 0000000..653c08e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Files/FilesClient.php @@ -0,0 +1,76 @@ +context['fileId'] = $fileId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + $this->getCommunicator()->getWithBinaryResponse( + $bodyHandler, + $responseClassMap, + $this->instantiateUri('/files/v1/{merchantId}/files/{fileId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Hostedcheckouts/HostedcheckoutsClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Hostedcheckouts/HostedcheckoutsClient.php new file mode 100644 index 0000000..9f61bd7 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Hostedcheckouts/HostedcheckoutsClient.php @@ -0,0 +1,156 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateHostedCheckoutResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/hostedcheckouts'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/hostedcheckouts/{hostedCheckoutId} - Get hosted checkout status + * + * @param string $hostedCheckoutId + * @param CallContext $callContext + * @return GetHostedCheckoutResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/hostedcheckouts/get.html Get hosted checkout status + */ + public function get($hostedCheckoutId, CallContext $callContext = null) + { + $this->context['hostedCheckoutId'] = $hostedCheckoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetHostedCheckoutResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/hostedcheckouts/{hostedCheckoutId} - Delete hosted checkout + * + * @param string $hostedCheckoutId + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/hostedcheckouts/delete.html Delete hosted checkout + */ + public function delete($hostedCheckoutId, CallContext $callContext = null) + { + $this->context['hostedCheckoutId'] = $hostedCheckoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->delete( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Hostedmandatemanagements/HostedmandatemanagementsClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Hostedmandatemanagements/HostedmandatemanagementsClient.php new file mode 100644 index 0000000..55c4617 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Hostedmandatemanagements/HostedmandatemanagementsClient.php @@ -0,0 +1,118 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateHostedMandateManagementResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/hostedmandatemanagements'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/hostedmandatemanagements/{hostedMandateManagementId} - Get hosted mandate management status + * + * @param string $hostedMandateManagementId + * @param CallContext $callContext + * @return GetHostedMandateManagementResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/hostedmandatemanagements/get.html Get hosted mandate management status + */ + public function get($hostedMandateManagementId, CallContext $callContext = null) + { + $this->context['hostedMandateManagementId'] = $hostedMandateManagementId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetHostedMandateManagementResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/hostedmandatemanagements/{hostedMandateManagementId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Installments/InstallmentsClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Installments/InstallmentsClient.php new file mode 100644 index 0000000..c92e285 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Installments/InstallmentsClient.php @@ -0,0 +1,78 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\InstallmentOptionsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/installments/getInstallmentsInfo'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Mandates/MandatesClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Mandates/MandatesClient.php new file mode 100644 index 0000000..85b1a7f --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Mandates/MandatesClient.php @@ -0,0 +1,279 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/mandates/{uniqueMandateReference} - Create mandate with mandatereference + * + * @param string $uniqueMandateReference + * @param CreateMandateRequest $body + * @param CallContext $callContext + * @return CreateMandateResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/mandates/createWithMandateReference.html Create mandate with mandatereference + */ + public function createWithMandateReference($uniqueMandateReference, CreateMandateRequest $body, CallContext $callContext = null) + { + $this->context['uniqueMandateReference'] = $uniqueMandateReference; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->put( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates/{uniqueMandateReference}'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/mandates/{uniqueMandateReference} - Get mandate + * + * @param string $uniqueMandateReference + * @param CallContext $callContext + * @return GetMandateResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/mandates/get.html Get mandate + */ + public function get($uniqueMandateReference, CallContext $callContext = null) + { + $this->context['uniqueMandateReference'] = $uniqueMandateReference; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates/{uniqueMandateReference}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/mandates/{uniqueMandateReference}/block - Block mandate + * + * @param string $uniqueMandateReference + * @param CallContext $callContext + * @return GetMandateResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/mandates/block.html Block mandate + */ + public function block($uniqueMandateReference, CallContext $callContext = null) + { + $this->context['uniqueMandateReference'] = $uniqueMandateReference; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates/{uniqueMandateReference}/block'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/mandates/{uniqueMandateReference}/unblock - Unblock mandate + * + * @param string $uniqueMandateReference + * @param CallContext $callContext + * @return GetMandateResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/mandates/unblock.html Unblock mandate + */ + public function unblock($uniqueMandateReference, CallContext $callContext = null) + { + $this->context['uniqueMandateReference'] = $uniqueMandateReference; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates/{uniqueMandateReference}/unblock'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/mandates/{uniqueMandateReference}/revoke - Revoke mandate + * + * @param string $uniqueMandateReference + * @param CallContext $callContext + * @return GetMandateResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/mandates/revoke.html Revoke mandate + */ + public function revoke($uniqueMandateReference, CallContext $callContext = null) + { + $this->context['uniqueMandateReference'] = $uniqueMandateReference; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetMandateResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/mandates/{uniqueMandateReference}/revoke'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/MerchantClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/MerchantClient.php new file mode 100644 index 0000000..569e971 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/MerchantClient.php @@ -0,0 +1,187 @@ +context); + } + + /** + * Resource /{merchantId}/hostedmandatemanagements + * + * @return HostedmandatemanagementsClient + */ + public function hostedmandatemanagements() + { + return new HostedmandatemanagementsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/payments + * + * @return PaymentsClient + */ + public function payments() + { + return new PaymentsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/captures + * + * @return CapturesClient + */ + public function captures() + { + return new CapturesClient($this, $this->context); + } + + /** + * Resource /{merchantId}/refunds + * + * @return RefundsClient + */ + public function refunds() + { + return new RefundsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/disputes + * + * @return DisputesClient + */ + public function disputes() + { + return new DisputesClient($this, $this->context); + } + + /** + * Resource /{merchantId}/payouts + * + * @return PayoutsClient + */ + public function payouts() + { + return new PayoutsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/productgroups + * + * @return ProductgroupsClient + */ + public function productgroups() + { + return new ProductgroupsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/products + * + * @return ProductsClient + */ + public function products() + { + return new ProductsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/riskassessments + * + * @return RiskassessmentsClient + */ + public function riskassessments() + { + return new RiskassessmentsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/services + * + * @return ServicesClient + */ + public function services() + { + return new ServicesClient($this, $this->context); + } + + /** + * Resource /{merchantId}/tokens + * + * @return TokensClient + */ + public function tokens() + { + return new TokensClient($this, $this->context); + } + + /** + * Resource /{merchantId}/mandates + * + * @return MandatesClient + */ + public function mandates() + { + return new MandatesClient($this, $this->context); + } + + /** + * Resource /{merchantId}/sessions + * + * @return SessionsClient + */ + public function sessions() + { + return new SessionsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/installments + * + * @return InstallmentsClient + */ + public function installments() + { + return new InstallmentsClient($this, $this->context); + } + + /** + * Resource /{merchantId}/files + * + * @return FilesClient + */ + public function files() + { + return new FilesClient($this, $this->context); + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Payments/FindPaymentsParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Payments/FindPaymentsParams.php new file mode 100644 index 0000000..44c1941 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Payments/FindPaymentsParams.php @@ -0,0 +1,42 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreatePaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments - Find payments + * + * @param FindPaymentsParams $query + * @param CallContext $callContext + * @return FindPaymentsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/find.html Find payments + */ + public function find(FindPaymentsParams $query, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\FindPaymentsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId} - Get payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return PaymentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/get.html Get payment + */ + public function get($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/complete - Complete payment + * + * @param string $paymentId + * @param CompletePaymentRequest $body + * @param CallContext $callContext + * @return CompletePaymentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/complete.html Complete payment + */ + public function complete($paymentId, CompletePaymentRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CompletePaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/complete'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/thirdpartystatus - Third party status poll + * + * @param string $paymentId + * @param CallContext $callContext + * @return ThirdPartyStatusResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/thirdPartyStatus.html Third party status poll + */ + public function thirdPartyStatus($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ThirdPartyStatusResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/thirdpartystatus'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/tokenize - Create a token from payment + * + * @param string $paymentId + * @param TokenizePaymentRequest $body + * @param CallContext $callContext + * @return CreateTokenResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/tokenize.html Create a token from payment + */ + public function tokenize($paymentId, TokenizePaymentRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/tokenize'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/processchallenged - Approves challenged payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return PaymentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/processchallenged.html Approves challenged payment + */ + public function processchallenged($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/processchallenged'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/approve - Approve payment + * + * @param string $paymentId + * @param ApprovePaymentRequest $body + * @param CallContext $callContext + * @return PaymentApprovalResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/approve.html Approve payment + */ + public function approve($paymentId, ApprovePaymentRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentApprovalResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/approve'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/capture - Capture payment + * + * @param string $paymentId + * @param CapturePaymentRequest $body + * @param CallContext $callContext + * @return CaptureResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/capture.html Capture payment + */ + public function capture($paymentId, CapturePaymentRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CaptureResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/capture'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/cancelapproval - Undo capture payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return CancelApprovalPaymentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/cancelapproval.html Undo capture payment + */ + public function cancelapproval($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelApprovalPaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancelapproval'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/captures - Get captures of payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return CapturesResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/captures.html Get captures of payment + */ + public function captures($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CapturesResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/captures'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/refund - Create refund + * + * @param string $paymentId + * @param RefundRequest $body + * @param CallContext $callContext + * @return RefundResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @throws DeclinedRefundException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/refund.html Create refund + */ + public function refund($paymentId, RefundRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refund'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/refunds - Get refunds of payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return RefundsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/refunds.html Get refunds of payment + */ + public function refunds($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refunds'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/cancel - Cancel payment + * + * @param string $paymentId + * @param CallContext $callContext + * @return CancelPaymentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/cancel.html Cancel payment + */ + public function cancel($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelPaymentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancel'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/dispute - Create dispute + * + * @param string $paymentId + * @param CreateDisputeRequest $body + * @param CallContext $callContext + * @return DisputeResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/dispute.html Create dispute + */ + public function dispute($paymentId, CreateDisputeRequest $body, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/dispute'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/disputes - Get disputes + * + * @param string $paymentId + * @param CallContext $callContext + * @return DisputesResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/disputes.html Get disputes + */ + public function disputes($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputesResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/disputes'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payments/{paymentId}/devicefingerprint - Get Device Fingerprint details + * + * @param string $paymentId + * @param CallContext $callContext + * @return DeviceFingerprintDetails + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payments/devicefingerprint.html Get Device Fingerprint details + */ + public function devicefingerprint($paymentId, CallContext $callContext = null) + { + $this->context['paymentId'] = $paymentId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintDetails'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/devicefingerprint'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Payouts/FindPayoutsParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Payouts/FindPayoutsParams.php new file mode 100644 index 0000000..c5464d5 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Payouts/FindPayoutsParams.php @@ -0,0 +1,37 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PayoutResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PayoutErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payouts - Find payouts + * + * @param FindPayoutsParams $query + * @param CallContext $callContext + * @return FindPayoutsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payouts/find.html Find payouts + */ + public function find(FindPayoutsParams $query, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\FindPayoutsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payouts/{payoutId} - Get payout + * + * @param string $payoutId + * @param CallContext $callContext + * @return PayoutResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payouts/get.html Get payout + */ + public function get($payoutId, CallContext $callContext = null) + { + $this->context['payoutId'] = $payoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PayoutResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts/{payoutId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payouts/{payoutId}/approve - Approve payout + * + * @param string $payoutId + * @param ApprovePayoutRequest $body + * @param CallContext $callContext + * @return PayoutResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payouts/approve.html Approve payout + */ + public function approve($payoutId, ApprovePayoutRequest $body, CallContext $callContext = null) + { + $this->context['payoutId'] = $payoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PayoutResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts/{payoutId}/approve'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payouts/{payoutId}/cancel - Cancel payout + * + * @param string $payoutId + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payouts/cancel.html Cancel payout + */ + public function cancel($payoutId, CallContext $callContext = null) + { + $this->context['payoutId'] = $payoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts/{payoutId}/cancel'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/payouts/{payoutId}/cancelapproval - Undo approve payout + * + * @param string $payoutId + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/payouts/cancelapproval.html Undo approve payout + */ + public function cancelapproval($payoutId, CallContext $callContext = null) + { + $this->context['payoutId'] = $payoutId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/payouts/{payoutId}/cancelapproval'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/FindProductgroupsParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/FindProductgroupsParams.php new file mode 100644 index 0000000..521452e --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Productgroups/FindProductgroupsParams.php @@ -0,0 +1,52 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentProductGroups'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/productgroups'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/productgroups/{paymentProductGroupId} - Get payment product group + * + * @param string $paymentProductGroupId + * @param GetProductgroupParams $query + * @param CallContext $callContext + * @return PaymentProductGroupResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/productgroups/get.html Get payment product group + */ + public function get($paymentProductGroupId, GetProductgroupParams $query, CallContext $callContext = null) + { + $this->context['paymentProductGroupId'] = $paymentProductGroupId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentProductGroupResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/productgroups/{paymentProductGroupId}'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/productgroups/{paymentProductGroupId}/deviceFingerprint - Get device fingerprint + * + * @param string $paymentProductGroupId + * @param DeviceFingerprintRequest $body + * @param CallContext $callContext + * @return DeviceFingerprintResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/productgroups/deviceFingerprint.html Get device fingerprint + */ + public function deviceFingerprint($paymentProductGroupId, DeviceFingerprintRequest $body, CallContext $callContext = null) + { + $this->context['paymentProductGroupId'] = $paymentProductGroupId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/productgroups/{paymentProductGroupId}/deviceFingerprint'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Products/DirectoryParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Products/DirectoryParams.php new file mode 100644 index 0000000..7de9e28 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Products/DirectoryParams.php @@ -0,0 +1,27 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentProducts'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId} - Get payment product + * + * @param int $paymentProductId + * @param GetProductParams $query + * @param CallContext $callContext + * @return PaymentProductResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/get.html Get payment product + */ + public function get($paymentProductId, GetProductParams $query, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentProductResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId}/directory - Get payment product directory + * + * @param int $paymentProductId + * @param DirectoryParams $query + * @param CallContext $callContext + * @return Directory + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/directory.html Get payment product directory + */ + public function directory($paymentProductId, DirectoryParams $query, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\Directory'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}/directory'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId}/customerDetails - Get customer details + * + * @param int $paymentProductId + * @param GetCustomerDetailsRequest $body + * @param CallContext $callContext + * @return GetCustomerDetailsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/customerDetails.html Get customer details + */ + public function customerDetails($paymentProductId, GetCustomerDetailsRequest $body, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetCustomerDetailsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}/customerDetails'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId}/deviceFingerprint - Get device fingerprint + * + * @param int $paymentProductId + * @param DeviceFingerprintRequest $body + * @param CallContext $callContext + * @return DeviceFingerprintResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/deviceFingerprint.html Get device fingerprint + */ + public function deviceFingerprint($paymentProductId, DeviceFingerprintRequest $body, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}/deviceFingerprint'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId}/networks - Get payment product networks + * + * @param int $paymentProductId + * @param NetworksParams $query + * @param CallContext $callContext + * @return PaymentProductNetworksResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/networks.html Get payment product networks + */ + public function networks($paymentProductId, NetworksParams $query, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentProductNetworksResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}/networks'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/products/{paymentProductId}/sessions - Create session for payment product + * + * @param int $paymentProductId + * @param CreatePaymentProductSessionRequest $body + * @param CallContext $callContext + * @return CreatePaymentProductSessionResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/products/sessions.html Create session for payment product + */ + public function sessions($paymentProductId, CreatePaymentProductSessionRequest $body, CallContext $callContext = null) + { + $this->context['paymentProductId'] = $paymentProductId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreatePaymentProductSessionResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/products/{paymentProductId}/sessions'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Refunds/FindRefundsParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Refunds/FindRefundsParams.php new file mode 100644 index 0000000..f82e9d4 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Refunds/FindRefundsParams.php @@ -0,0 +1,42 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\FindRefundsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/refunds'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/refunds/{refundId} - Get refund + * + * @param string $refundId + * @param CallContext $callContext + * @return RefundResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/refunds/get.html Get refund + */ + public function get($refundId, CallContext $callContext = null) + { + $this->context['refundId'] = $refundId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/refunds/{refundId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/refunds/{refundId}/approve - Approve refund + * + * @param string $refundId + * @param ApproveRefundRequest $body + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/refunds/approve.html Approve refund + */ + public function approve($refundId, ApproveRefundRequest $body, CallContext $callContext = null) + { + $this->context['refundId'] = $refundId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/refunds/{refundId}/approve'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/refunds/{refundId}/cancel - Cancel refund + * + * @param string $refundId + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/refunds/cancel.html Cancel refund + */ + public function cancel($refundId, CallContext $callContext = null) + { + $this->context['refundId'] = $refundId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/refunds/{refundId}/cancel'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/refunds/{refundId}/cancelapproval - Undo approve refund + * + * @param string $refundId + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/refunds/cancelapproval.html Undo approve refund + */ + public function cancelapproval($refundId, CallContext $callContext = null) + { + $this->context['refundId'] = $refundId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/refunds/{refundId}/cancelapproval'), + $this->getClientMetaInfo(), + null, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Riskassessments/RiskassessmentsClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Riskassessments/RiskassessmentsClient.php new file mode 100644 index 0000000..0650d85 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Riskassessments/RiskassessmentsClient.php @@ -0,0 +1,118 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RiskAssessmentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/riskassessments/bankaccounts'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/riskassessments/cards - Risk-assess card + * + * @param RiskAssessmentCard $body + * @param CallContext $callContext + * @return RiskAssessmentResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/riskassessments/cards.html Risk-assess card + */ + public function cards(RiskAssessmentCard $body, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RiskAssessmentResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/riskassessments/cards'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Services/ConvertAmountParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Services/ConvertAmountParams.php new file mode 100644 index 0000000..12b4fcb --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Services/ConvertAmountParams.php @@ -0,0 +1,32 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ConvertAmount'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/services/convert/amount'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/services/convert/bankaccount - Convert bankaccount + * + * @param BankDetailsRequest $body + * @param CallContext $callContext + * @return BankDetailsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/bankaccount.html Convert bankaccount + */ + public function bankaccount(BankDetailsRequest $body, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\BankDetailsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/services/convert/bankaccount'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/services/getIINdetails - Get IIN details + * + * @param GetIINDetailsRequest $body + * @param CallContext $callContext + * @return GetIINDetailsResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/getIINdetails.html Get IIN details + */ + public function getIINdetails(GetIINDetailsRequest $body, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetIINDetailsResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/services/getIINdetails'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/services/privacypolicy - Get privacy policy + * + * @param PrivacypolicyParams $query + * @param CallContext $callContext + * @return GetPrivacyPolicyResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/privacypolicy.html Get privacy policy + */ + public function privacypolicy(PrivacypolicyParams $query, CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\GetPrivacyPolicyResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/services/privacypolicy'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/services/testconnection - Test connection + * + * @param CallContext $callContext + * @return TestConnection + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/services/testconnection.html Test connection + */ + public function testconnection(CallContext $callContext = null) + { + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\TestConnection'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/services/testconnection'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Sessions/SessionsClient.php b/src/Worldline/Connect/Sdk/V1/Merchant/Sessions/SessionsClient.php new file mode 100644 index 0000000..ca1f521 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Sessions/SessionsClient.php @@ -0,0 +1,78 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\SessionResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/sessions'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/Merchant/Tokens/DeleteTokenParams.php b/src/Worldline/Connect/Sdk/V1/Merchant/Tokens/DeleteTokenParams.php new file mode 100644 index 0000000..154d062 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/Merchant/Tokens/DeleteTokenParams.php @@ -0,0 +1,22 @@ +defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/tokens'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/tokens/{tokenId} - Get token + * + * @param string $tokenId + * @param CallContext $callContext + * @return TokenResponse + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/tokens/get.html Get token + */ + public function get($tokenId, CallContext $callContext = null) + { + $this->context['tokenId'] = $tokenId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\TokenResponse'; + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->get( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/tokens/{tokenId}'), + $this->getClientMetaInfo(), + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/tokens/{tokenId} - Update token + * + * @param string $tokenId + * @param UpdateTokenRequest $body + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/tokens/update.html Update token + */ + public function update($tokenId, UpdateTokenRequest $body, CallContext $callContext = null) + { + $this->context['tokenId'] = $tokenId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->put( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/tokens/{tokenId}'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/tokens/{tokenId} - Delete token + * + * @param string $tokenId + * @param DeleteTokenParams $query + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/tokens/delete.html Delete token + */ + public function delete($tokenId, DeleteTokenParams $query, CallContext $callContext = null) + { + $this->context['tokenId'] = $tokenId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->delete( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/tokens/{tokenId}'), + $this->getClientMetaInfo(), + $query, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** + * Resource /{merchantId}/tokens/{tokenId}/approvesepadirectdebit - Approve SEPA DD mandate + * + * @param string $tokenId + * @param ApproveTokenRequest $body + * @param CallContext $callContext + * @return null + * + * @throws ValidationException + * @throws AuthorizationException + * @throws IdempotenceException + * @throws ReferenceException + * @throws PlatformException + * @throws ApiException + * @throws InvalidResponseException + * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/tokens/approvesepadirectdebit.html Approve SEPA DD mandate + */ + public function approvesepadirectdebit($tokenId, ApproveTokenRequest $body, CallContext $callContext = null) + { + $this->context['tokenId'] = $tokenId; + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/tokens/{tokenId}/approvesepadirectdebit'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } catch (ErrorResponseException $e) { + throw $this->getResponseExceptionFactory()->createException( + $e->getHttpStatusCode(), + $e->getErrorResponse(), + $callContext + ); + } + } + + /** @return ExceptionFactory */ + private function getResponseExceptionFactory() + { + if (is_null($this->responseExceptionFactory)) { + $this->responseExceptionFactory = new ExceptionFactory(); + } + return $this->responseExceptionFactory; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/PlatformException.php b/src/Worldline/Connect/Sdk/V1/PlatformException.php new file mode 100644 index 0000000..38e9b1c --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/PlatformException.php @@ -0,0 +1,15 @@ +httpStatusCode = $httpStatusCode; + $this->response = $response; + } + + public function __toString() + { + return sprintf( + "exception '%s' with message '%s'. in %s:%d\nHTTP status code: %s\nResponse:\n%s\nStack trace:\n%s", + __CLASS__, + $this->getMessage(), + $this->getFile(), + $this->getLine(), + $this->getHttpStatusCode(), + json_encode($this->getResponse(), JSON_PRETTY_PRINT), + $this->getTraceAsString() + ); + } + + /** + * @return int + */ + public function getHttpStatusCode() + { + return $this->httpStatusCode; + } + + /** + * @return DataObject + */ + public function getResponse() + { + return $this->response; + } + + /** + * @return string + */ + public function getErrorId() + { + $responseVariables = get_object_vars($this->getResponse()); + if (!array_key_exists('errorId', $responseVariables)) { + return ''; + } + return $responseVariables['errorId']; + } + + /** + * @return APIError[] + */ + public function getErrors() + { + $responseVariables = get_object_vars($this->getResponse()); + if (!array_key_exists('errors', $responseVariables)) { + return array(); + } + $errors = $responseVariables['errors']; + if (!is_array($errors)) { + return array(); + } + foreach ($errors as $error) { + if (!($error instanceof APIError)) { + return array(); + } + } + return $errors; + } +} diff --git a/src/Worldline/Connect/Sdk/V1/V1Client.php b/src/Worldline/Connect/Sdk/V1/V1Client.php new file mode 100644 index 0000000..ee13659 --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/V1Client.php @@ -0,0 +1,28 @@ +context; + $newContext['merchantId'] = $merchantId; + return new MerchantClient($this, $newContext); + } +} diff --git a/src/Worldline/Connect/Sdk/V1/ValidationException.php b/src/Worldline/Connect/Sdk/V1/ValidationException.php new file mode 100644 index 0000000..4215eee --- /dev/null +++ b/src/Worldline/Connect/Sdk/V1/ValidationException.php @@ -0,0 +1,15 @@ +signatureValidator = new SignatureValidator($secretKeyStore); + } + + /** @return ResponseFactory */ + protected function getResponseFactory() + { + if (is_null($this->responseFactory)) { + $this->responseFactory = new ResponseFactory(); + } + return $this->responseFactory; + } + + /** + * Unmarshals the given input stream that contains the body, + * while also validating its contents using the given request headers. + * @param string $body + * @param array $requestHeaders + * @return WebhooksEvent + * @throws SignatureValidationException + * @throws ApiVersionMismatchException + */ + public function unmarshal($body, $requestHeaders) + { + $this->signatureValidator->validate($body, $requestHeaders); + + $response = new ConnectionResponse(200, array('Content-Type' => 'application/json'), $body); + $responseClassMap = new ResponseClassMap(); + $responseClassMap->addResponseClassName(200, '\Worldline\Connect\Sdk\V1\Domain\WebhooksEvent'); + + $event = $this->getResponseFactory()->createResponse($response, $responseClassMap); + $this->validateApiVersion($event); + return $event; + } + + private function validateApiVersion($event) + { + if ('v1' !== $event->apiVersion) { + throw new ApiVersionMismatchException($event->apiVersion, 'v1'); + } + } +} diff --git a/src/Worldline/Connect/Sdk/Webhooks/Webhooks.php b/src/Worldline/Connect/Sdk/Webhooks/Webhooks.php new file mode 100644 index 0000000..ba8a62e --- /dev/null +++ b/src/Worldline/Connect/Sdk/Webhooks/Webhooks.php @@ -0,0 +1,27 @@ +getCommunicatorConfiguration(); + $configuration->setApiKeyId('apiKeyId'); + $configuration->setApiSecret('secretApiKey'); + + $authenticator = new V1HMACAuthenticator($configuration); + + $httpMethod = 'DELETE'; + $uriPath = '/v1/9991/tokens/123456789'; + $requestHeaders = array( + 'Content-Type' => 'application/json', + 'Date' => 'Fri, 06 Jun 2014 13:39:43 GMT', + 'X-GCS-ServerMetainfo' => 'processed header value', + 'X-GCS-ClientMetainfo' => 'processed header value', + 'X-GCS-CustomerHeader' => 'processed header value' + ); + + $authorization = $authenticator->getAuthorization($httpMethod, $uriPath, $requestHeaders); + + $this->assertEquals('GCS v1HMAC:apiKeyId:VfnXpPBQQoHZivTcAg0JvOWkhnzlPnaCPKpTQn/uMJM=', $authorization); + } + + public function testGetAuthorizationMinimal() + { + $configuration = $this->getCommunicatorConfiguration(); + $configuration->setApiKeyId('EC36A74A98D21'); + $configuration->setApiSecret('6Kj5HT0MQKC6D8eb7W3lTg71kVKVDSt1'); + + $authenticator = new V1HMACAuthenticator($configuration); + + $httpMethod = 'GET'; + $uriPath = '/v1/9991/tokens/123456789'; + $requestHeaders = array('Date' => 'Fri, 06 Jun 2014 13:39:43 GMT'); + + $authorization = $authenticator->getAuthorization($httpMethod, $uriPath, $requestHeaders); + + $this->assertEquals('GCS v1HMAC:EC36A74A98D21:9ond5EIN05dBXJGCLRK5om9pxHsyrh/12pZJ7bvmwNM=', $authorization); + } +} diff --git a/tests/Worldline/Connect/Sdk/ClientLoggingTest.php b/tests/Worldline/Connect/Sdk/ClientLoggingTest.php new file mode 100644 index 0000000..85c5804 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/ClientLoggingTest.php @@ -0,0 +1,41 @@ +getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $communicator = $this->getMockBuilder('\Worldline\Connect\Sdk\Communicator')->disableOriginalConstructor()->getMock(); + $communicator->expects($this->once())->method('enableLogging')->with($this->equalTo($logger)); + $communicator->expects($this->never())->method('disableLogging'); + $client = new Client($communicator); + $client->enableLogging($logger); + } + + public function testDisableLoggingCascade() + { + $communicator = $this->getMockBuilder('\Worldline\Connect\Sdk\Communicator')->disableOriginalConstructor()->getMock(); + $communicator->expects($this->once())->method('disableLogging'); + $communicator->expects($this->never())->method('enableLogging'); + $client = new Client($communicator); + $client->disableLogging(); + } + + public function testMultipleEnableAndDisableLoggingCascades() + { + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $communicator = $this->getMockBuilder('\Worldline\Connect\Sdk\Communicator')->disableOriginalConstructor()->getMock(); + $communicator->expects($this->exactly(3))->method('enableLogging')->with($this->equalTo($logger)); + $communicator->expects($this->exactly(2))->method('disableLogging'); + $client = new Client($communicator); + $client->enableLogging($logger); + $client->enableLogging($logger); + $client->disableLogging(); + $client->disableLogging(); + $client->enableLogging($logger); + } +} diff --git a/tests/Worldline/Connect/Sdk/ClientTestCase.php b/tests/Worldline/Connect/Sdk/ClientTestCase.php new file mode 100644 index 0000000..189be54 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/ClientTestCase.php @@ -0,0 +1,47 @@ +client)) { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicator = new Communicator($communicatorConfiguration); + $this->client = new Client($communicator); + } + return $this->client; + } + + /** + * @return Client + */ + protected function getProxyClient() + { + if (is_null($this->proxyClient)) { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setProxyConfiguration(new ProxyConfiguration( + $this->getProxyHost(), + $this->getProxyPort(), + $this->getProxyUsername(), + $this->getProxyPassword() + )); + $communicator = new Communicator($communicatorConfiguration); + $this->proxyClient = new Client($communicator); + } + return $this->proxyClient; + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelperTest.php b/tests/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelperTest.php new file mode 100644 index 0000000..43e7042 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/CommunicatorLoggerHelperTest.php @@ -0,0 +1,56 @@ +assertEquals($endpoint, $communicatorLoggingHelper->getEndpoint($requestUri)); + $this->assertEquals( + $relativeUriPathWithRequestParameters, + $communicatorLoggingHelper->getRelativeUriPathWithRequestParameters($requestUri) + ); + $this->assertEquals($requestUri, $endpoint . $relativeUriPathWithRequestParameters); + } + + /** + * @return array + */ + public function uriProvider() + { + return array( + array( + 'https://api.preprod.connect.worldline-solutions.com/v1/20000/services/testconnection', + 'https://api.preprod.connect.worldline-solutions.com', + '/v1/20000/services/testconnection', + ), + array( + 'https://api.preprod.connect.worldline-solutions.com/v1/20000/services/convert/amount?source=EUR&target=USD&amount=1000', + 'https://api.preprod.connect.worldline-solutions.com', + '/v1/20000/services/convert/amount?source=EUR&target=USD&amount=1000', + ), + array( + 'https://api.preprod.connect.worldline-solutions.com', + 'https://api.preprod.connect.worldline-solutions.com', + '' + ), + array( + '/v1/20000/services/testconnection', + '', + '/v1/20000/services/testconnection' + ), + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/ConnectionResponseGetDispositionFilenameTest.php b/tests/Worldline/Connect/Sdk/Communication/ConnectionResponseGetDispositionFilenameTest.php new file mode 100644 index 0000000..1991f8a --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/ConnectionResponseGetDispositionFilenameTest.php @@ -0,0 +1,52 @@ + $headerValue); + $this->assertEquals($expected, ConnectionResponse::getDispositionFilename($headers)); + } + + public function dispositionFilenameProvider() + { + return array( + array('attachment; filename=testfile', 'testfile'), + array('attachment; filename="testfile"', 'testfile'), + array('attachment; filename="testfile', '"testfile'), + array('attachment; filename=testfile"', 'testfile"'), + array("attachment; filename='testfile'", 'testfile'), + array("attachment; filename='testfile", "'testfile"), + array("attachment; filename=testfile'", "testfile'"), + + array('filename=testfile', 'testfile'), + array('filename="testfile"', 'testfile'), + array('filename="testfile', '"testfile'), + array('filename=testfile"', 'testfile"'), + array("filename='testfile'", 'testfile'), + array("filename='testfile", "'testfile"), + array("filename=testfile'", "testfile'"), + array('attachment; filename=testfile; x=y', 'testfile'), + array('attachment; filename="testfile"; x=y', 'testfile'), + array('attachment; filename="testfile; x=y', '"testfile'), + array('attachment; filename=testfile"; x=y', 'testfile"'), + array("attachment; filename='testfile'; x=y", 'testfile'), + array("attachment; filename='testfile; x=y", "'testfile"), + array("attachment; filename=testfile'; x=y", "testfile'"), + + array('', null), + array('filename="', '"'), + array("filename='", "'") + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionResponseTest.php b/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionResponseTest.php new file mode 100644 index 0000000..0392528 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionResponseTest.php @@ -0,0 +1,27 @@ + 'Foo', 'Bar' => 'Baz'); + $body = "Foo Bar\nBáz"; + $connectionReponse = new ConnectionResponse($httpStatusCode, $headers, $body); + $this->assertEquals($httpStatusCode, $connectionReponse->getHttpStatusCode()); + $this->assertEquals($headers, $connectionReponse->getHeaders()); + $this->assertEquals($body, $connectionReponse->getBody()); + $this->assertEquals('Foo', $connectionReponse->getHeaderValue(0)); + $this->assertEquals('Baz', $connectionReponse->getHeaderValue('Bar')); + $this->assertEquals('Baz', $connectionReponse->getHeaderValue('bar')); + $this->assertEquals('', $connectionReponse->getHeaderValue(1)); + $this->assertEquals('', $connectionReponse->getHeaderValue('baz')); + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionTest.php b/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionTest.php new file mode 100644 index 0000000..2dd79da --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/DefaultConnectionTest.php @@ -0,0 +1,169 @@ +connection = new DefaultConnection(); + $this->connection->setBodyObfuscator(new BodyObfuscator()); + $this->connection->setHeaderObfuscator(new HeaderObfuscator()); + } + + public function test404WithBareApiEndpoint() + { + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $this->connection->get($this->getApiEndpoint(), [], $responseHandler); + $this->assertEquals(404, $responseBuilder->getResponse()->getHttpStatusCode()); + } + + public function testTestConnection() + { + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $merchantId = '20000'; + $relativeUriPath = '/v1/' . $merchantId . '/services/testconnection'; + $requestHeaders = $this->getRequestHeaders('GET', $relativeUriPath); + $this->connection->get($this->getApiEndpoint() . $relativeUriPath, $requestHeaders, $responseHandler); + $response = $responseBuilder->getResponse(); + $this->assertEquals(200, $response->getHttpStatusCode()); + $this->assertStringStartsWith('application/json', $response->getHeaderValue('Content-Type')); + $this->assertEquals(array('result' => 'OK'), json_decode($response->getBody(), true)); + } + + public function testCurlErrors() + { + $expectedErrorCodeByDomain = array( + '' => CURLE_URL_MALFORMAT, + 'foo://bar' => CURLE_UNSUPPORTED_PROTOCOL, + 'http://non-existing-domain' => CURLE_COULDNT_RESOLVE_HOST, + 'https://expired.badssl.com' => CURLE_SSL_CACERT + ); + foreach ($expectedErrorCodeByDomain as $domain => $expectedErrorCode) { + try { + $responseHandler = function ($httpStatusCode, $data, $headers) { + }; + + $this->connection->get($domain, [], $responseHandler); + } catch (ErrorException $e) { + $expectedErrorMessage = 'cURL error ' . $expectedErrorCode; + if (function_exists('curl_strerror')) { + $expectedErrorMessage .= ' (' . curl_strerror($expectedErrorCode) . ')'; + } + $this->assertEquals($expectedErrorMessage, $e->getMessage()); + continue; + } + $this->fail('An expected exception has not been raised'); + } + } + + public function testConnectTimeoutExceeded() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + // Without this connect timeout, a cURL error 7 (Couldn't connect to server) is thrown instead + $communicatorConfiguration->setConnectTimeout(1); + $communicatorConfiguration->setReadTimeout(-1); + $this->connection = new DefaultConnection($communicatorConfiguration); + try { + $responseHandler = function ($httpStatusCode, $data, $headers) { + }; + $startTime = time(); + $this->connection->get('https://www.example.org:12345', [], $responseHandler); + $this->fail('Expected connect timeout error'); + } catch (ErrorException $e) { + $endTime = time(); + $expectedErrorMessage1 = 'cURL error ' . CURLE_OPERATION_TIMEOUTED; + $expectedErrorMessage2 = 'cURL error ' . CURLE_COULDNT_CONNECT; + if (function_exists('curl_strerror')) { + $expectedErrorMessage1 .= ' (' . curl_strerror(CURLE_OPERATION_TIMEOUTED) . ')'; + $expectedErrorMessage2 .= ' (' . curl_strerror(CURLE_COULDNT_CONNECT) . ')'; + } + $expectedErrorMessagePattern = '/' . preg_quote($expectedErrorMessage1) . '|' . preg_quote($expectedErrorMessage2) . '/'; + $this->assertRegExp($expectedErrorMessagePattern, $e->getMessage()); + $this->assertTrue($endTime - $startTime <= 2, 'Connect timeout should occur within 2 seconds'); + } + } + + public function testReadTimeoutExceeded() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setConnectTimeout(-1); + $communicatorConfiguration->setReadTimeout(1); + $this->connection = new DefaultConnection($communicatorConfiguration); + try { + $responseHandler = function ($httpStatusCode, $data, $headers) { + }; + $this->connection->get($this->getHttpBinUrl() . '/delay/2', [], $responseHandler); + $this->fail('Expected read timeout error'); + } catch (ErrorException $e) { + $expectedErrorMessage = 'cURL error ' . CURLE_OPERATION_TIMEOUTED; + if (function_exists('curl_strerror')) { + $expectedErrorMessage .= ' (' . curl_strerror(CURLE_OPERATION_TIMEOUTED) . ')'; + } + $this->assertEquals($expectedErrorMessage, $e->getMessage()); + } + } + + /** + * @dataProvider timeoutAndDelayProvider + * @param int $timeout + * @param int $delay + */ + public function testReadTimeoutNotExceeded($timeout, $delay) + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setConnectTimeout(-1); + $communicatorConfiguration->setReadTimeout($timeout); + $this->connection = new DefaultConnection($communicatorConfiguration); + $responseBuilder = new ResponseBuilder(); + $responseHandler = function ($httpStatusCode, $data, $headers) use ($responseBuilder) { + $responseBuilder->setHttpStatusCode($httpStatusCode); + $responseBuilder->setHeaders($headers); + }; + $this->connection->get($this->getHttpBinUrl() . '/delay/' . $delay, [], $responseHandler); + $this->assertEquals(200, $responseBuilder->getResponse()->getHttpStatusCode()); + } + + public function timeoutAndDelayProvider() { + print "Returning timeouts and delays"; + return array( + array(-1, 1), // no timeout + array(0, 1), // no timeout + array(2, 1) // delay < timeout + ); + } + + private function getRequestHeaders($httpMethod, $relativeUri, $contentType = '') { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicator = new Communicator($communicatorConfiguration); + $method = new ReflectionMethod($communicator, 'getRequestHeaders'); + $method->setAccessible(true); + return $method->invoke($communicator, $httpMethod, $relativeUri, $contentType); + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/HttpHeaderHelperTest.php b/tests/Worldline/Connect/Sdk/Communication/HttpHeaderHelperTest.php new file mode 100644 index 0000000..5de72fa --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/HttpHeaderHelperTest.php @@ -0,0 +1,106 @@ +assertEquals($rawHeaders, HttpHeaderHelper::generateRawHeaders($headers)); + } + + public function testParseStatusLine() + { + $rawHeaders = array('HTTP/1.0 200 OK'); + $headers = array('HTTP/1.0 200 OK'); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeaders)); + } + + public function testGenerateContentTypeHeader() + { + $rawHeaders = array('Content-Type: text/html'); + $headers = array('Content-Type' => 'text/html'); + $this->assertEquals($rawHeaders, HttpHeaderHelper::generateRawHeaders($headers)); + } + + public function testParseContentTypeHeader() + { + $rawHeaders = array('Content-Type: text/html'); + $headers = array('Content-Type' => 'text/html'); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeaders)); + } + + public function testGenerateDuplicateHeader() + { + $rawHeaders = array('Cache-Control: no-cache', 'Cache-Control: no-store'); + $headers = array('Cache-Control' => array('no-cache', 'no-store')); + $this->assertEquals($rawHeaders, HttpHeaderHelper::generateRawHeaders($headers)); + } + + public function testParseDuplicateHeader() + { + $rawHeaders = array('Cache-Control: no-cache', 'Cache-Control: no-store'); + $headers = array('Cache-Control' => array('no-cache', 'no-store')); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeaders)); + } + + public function testGenerateMultiLineHeader() + { + $rawHeaders = array('Powered-By: Acme', "\tInc."); + $headers = array('Powered-By' => "Acme\r\n\tInc."); + $this->assertEquals($rawHeaders, HttpHeaderHelper::generateRawHeaders($headers)); + } + + public function testParseMultiLineHeader() + { + $rawHeaders = array('Powered-By: Acme', "\tInc."); + $headers = array('Powered-By' => "Acme\r\n\tInc."); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeaders)); + } + + public function testGenerateStatusLineAndContentTypeHeader() + { + $rawHeaders = array('HTTP/1.0 200 OK', 'Content-Type: text/html'); + $headers = array('HTTP/1.0 200 OK', 'Content-Type' => 'text/html'); + $this->assertEquals($rawHeaders, HttpHeaderHelper::generateRawHeaders($headers)); + } + + public function testParseStatusLineAndContentTypeHeader() + { + $rawHeaders = array('HTTP/1.0 200 OK', 'Content-Type: text/html'); + $headers = array('HTTP/1.0 200 OK', 'Content-Type' => 'text/html'); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeaders)); + } + + public function testGenerateParseStatusLineAndSimpleHeaders() + { + $headers = array( + 0 => 'HTTP/1.1 200 OK', + 'Date' => 'Wed, 23 Mar 2016 20:43:06 GMT', + 'Content-Type' => 'application/json', + 'X-Powered-By' => 'Servlet/3.0 JSP/2.2' + ); + $rawHeader = HttpHeaderHelper::generateRawHeaders($headers); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeader)); + } + + public function testGenerateParseStatusLineAndDuplicateHeaders() + { + $headers = array( + 0 => 'HTTP/1.1 200 OK', + 'Date' => 'Wed, 23 Mar 2016 20:43:06 GMT', + 'Content-Type' => 'application/json', + 'Cache-Control' => array('no-cache', 'no-store') + ); + $rawHeader = HttpHeaderHelper::generateRawHeaders($headers); + $this->assertEquals($headers, HttpHeaderHelper::parseRawHeaders($rawHeader)); + } +} \ No newline at end of file diff --git a/tests/Worldline/Connect/Sdk/Communication/HttpObfuscatorTest.php b/tests/Worldline/Connect/Sdk/Communication/HttpObfuscatorTest.php new file mode 100644 index 0000000..ea41b32 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/HttpObfuscatorTest.php @@ -0,0 +1,132 @@ +assertEquals( + $expectedRawObfuscatedRequest, + $httpObfuscator->getRawObfuscatedRequest($requestMethod, $relativeRequestUri, $requestHeaders, $requestBody) + ); + } + + /** + * @return array + */ + public function rawObfuscatedRequestProvider() + { + return array( + array( + 'GET', + '/foo', + array(), + '', + "GET /foo HTTP/1.1" + ), + array( + 'DELETE', + '/foo', + array('Content-Type' => 'application/json', 'Authorization' => '123'), + '', + "DELETE /foo HTTP/1.1" . PHP_EOL . "Content-Type: application/json" . PHP_EOL . "Authorization: ********" + ), + array( + 'POST', + '/foo', + array('Content-Type' => 'application/json'), + json_encode(array('name' => 'bar', 'value' => 'bar'), JSON_PRETTY_PRINT), + "POST /foo HTTP/1.1" . PHP_EOL . "Content-Type: application/json" . PHP_EOL . PHP_EOL . + json_encode(array('name' => 'bar', 'value' => '***'), JSON_PRETTY_PRINT) + ), + array( + 'PUT', + '/foo', + array('Content-Type' => 'application/json', 'Authorization' => '123'), + json_encode(array('value' => 'baz'), JSON_PRETTY_PRINT), + "PUT /foo HTTP/1.1" . PHP_EOL . "Content-Type: application/json" . PHP_EOL . "Authorization: ********" . PHP_EOL . PHP_EOL . + json_encode(array('value' => '***'), JSON_PRETTY_PRINT) + ), + array( + 'PUT', + '/foo', + array('Content-Type' => 'text/html', 'Authorization' => '123'), + json_encode(array('value' => 'baz'), JSON_PRETTY_PRINT), + "PUT /foo HTTP/1.1" . PHP_EOL . "Content-Type: text/html" . PHP_EOL . "Authorization: ********" . PHP_EOL . PHP_EOL . + json_encode(array('value' => 'baz'), JSON_PRETTY_PRINT) + ), + ); + } + + /** + * @dataProvider rawObfuscatedResponseProvider + * @param ConnectionResponse $response + * @param string $expectedRawObfuscatedResponse + */ + public function testRawObfuscatedResponse(ConnectionResponse $response, $expectedRawObfuscatedResponse) + { + $httpObfuscator = new HttpObfuscator(); + $this->assertEquals( + $expectedRawObfuscatedResponse, + $httpObfuscator->getRawObfuscatedResponse($response) + ); + } + + /** + * @return array + */ + public function rawObfuscatedResponseProvider() + { + return array( + array( + new ConnectionResponse(0, array(), ''), + "" + ), + array( + new ConnectionResponse( + 200, + array(0 => 'HTTP/1.1 200 OK', 'Content-Type' => 'application/json', 'Authorization' => '123'), + '' + ), + "HTTP/1.1 200 OK" . PHP_EOL . "Content-Type: application/json" . PHP_EOL . "Authorization: ********" + ), + array( + new ConnectionResponse( + 404, + array(0 => 'HTTP/1.1 404 Not Found', 'Content-Type' => 'text/html'), + json_encode(array('value' => 'foo'), JSON_PRETTY_PRINT) + ), + "HTTP/1.1 404 Not Found" . PHP_EOL . "Content-Type: text/html" . PHP_EOL . PHP_EOL . + json_encode(array('value' => 'foo'), JSON_PRETTY_PRINT) + ), + array( + new ConnectionResponse( + 201, + array(0 => 'HTTP/1.1 201 Created', 'Content-Type' => 'application/json'), + json_encode(array('name' => 'foo', 'value' => 'baz'), JSON_PRETTY_PRINT) + ), + "HTTP/1.1 201 Created" . PHP_EOL . "Content-Type: application/json" . PHP_EOL . PHP_EOL . + json_encode(array('name' => 'foo', 'value' => '***'), JSON_PRETTY_PRINT) + ), + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/Communication/UuidGeneratorTest.php b/tests/Worldline/Connect/Sdk/Communication/UuidGeneratorTest.php new file mode 100644 index 0000000..24806b1 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Communication/UuidGeneratorTest.php @@ -0,0 +1,18 @@ +assertRegExp($uuidV4ValidationRegex, UuidGenerator::generatedUuid()); + } + + public function testRelativeUniqueness() + { + $this->assertNotEquals(UuidGenerator::generatedUuid(), UuidGenerator::generatedUuid()); + } +} diff --git a/tests/Worldline/Connect/Sdk/CommunicatorLoggingTest.php b/tests/Worldline/Connect/Sdk/CommunicatorLoggingTest.php new file mode 100644 index 0000000..0e871b9 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/CommunicatorLoggingTest.php @@ -0,0 +1,302 @@ + 'application/json'), '{}') + ); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->exactly(2))->method('log')->will( + $this->returnCallback(function ($message) { + $messageParts = explode("\n", $message); + $this->assertGreaterThanOrEqual(2, count($messageParts)); + if (strpos($messageParts[0], 'Outgoing request') === 0) { + $this->assertContains('/bar', $messageParts[1]); + } + }) + ); + $logger->expects($this->never())->method('logException'); + $responseClassMap = new ResponseClassMap(); + $communicator->get($responseClassMap, '/foo'); + $communicator->enableLogging($logger); + $communicator->get($responseClassMap, '/bar'); + $communicator->disableLogging(); + $communicator->get($responseClassMap, '/baz'); + } + + public function testLoggingForSuccessResponse() + { + $relativeRequestUri = '/foo/bar'; + $connection = new TestingConnection( + new ConnectionResponse(200, array('Content-Type' => 'application/json'), '{}') + ); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $relativeRequestUriWithRequestParameters = $relativeRequestUri; + $requestHeaders = + $this->getCommunicatorRequestHeaders($communicator, 'POST', $relativeRequestUriWithRequestParameters); + $requestBody = $this->getMockRequestDataObject(); + $httpObfuscator = new HttpObfuscator(); + $rawObfuscatedRequest = $httpObfuscator->getRawObfuscatedRequest( + 'POST', + $relativeRequestUriWithRequestParameters, + $requestHeaders, + $requestBody->toJson() + ); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->exactly(2))->method('log')->will( + $this->returnCallback(function ($message) use ($rawObfuscatedRequest) { + $messageHeader = strstr($message, "\n", true); + if (strpos($messageHeader, 'Outgoing request') === 0) { + $this->assertEquals(trim(strstr($message, "\n")), $rawObfuscatedRequest); + } + }) + ); + $logger->expects($this->never())->method('logException'); + $communicator->enableLogging($logger); + $responseClassMap = new ResponseClassMap(); + $communicator->post($responseClassMap, $relativeRequestUri, '', $requestBody); + } + + public function testLoggingForSuccessUTF8Response() + { + $relativeRequestUri = '/foo/bar'; + $connection = new TestingConnection( + new ConnectionResponse(200, array('Content-Type' => 'application/json;charset=UTF-8'), '{}') + ); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $relativeRequestUriWithRequestParameters = $relativeRequestUri; + $requestHeaders = + $this->getCommunicatorRequestHeaders($communicator, 'POST', $relativeRequestUriWithRequestParameters); + $requestBody = $this->getMockRequestDataObject(); + $httpObfuscator = new HttpObfuscator(); + $rawObfuscatedRequest = $httpObfuscator->getRawObfuscatedRequest( + 'POST', + $relativeRequestUriWithRequestParameters, + $requestHeaders, + $requestBody->toJson() + ); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->exactly(2))->method('log')->will( + $this->returnCallback(function ($message) use ($rawObfuscatedRequest) { + $messageHeader = strstr($message, "\n", true); + if (strpos($messageHeader, 'Outgoing request') === 0) { + $this->assertEquals(trim(strstr($message, "\n")), $rawObfuscatedRequest); + } + }) + ); + $logger->expects($this->never())->method('logException'); + $communicator->enableLogging($logger); + $responseClassMap = new ResponseClassMap(); + $communicator->post($responseClassMap, $relativeRequestUri, '', $requestBody); + } + + public function testLoggingForClientErrorResponse() + { + $relativeRequestUri = '/foo/bar'; + $responseHeaders = array('Content-Type' => 'application/json'); + $errorResponse = $this->getErrorResponseDataObject(); + $connectionResponse = new ConnectionResponse(400, $responseHeaders, $errorResponse->toJson()); + $connection = new TestingConnection($connectionResponse); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $httpObfuscator = new HttpObfuscator(); + $rawObfuscatedResponse = $httpObfuscator->getRawObfuscatedResponse($connectionResponse); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->exactly(2))->method('log')->will( + $this->returnCallback(function ($message) use ($rawObfuscatedResponse) { + $messageHeader = strstr($message, "\n", true); + if (strpos($messageHeader, 'Incoming response') === 0) { + $this->assertEquals(trim(strstr($message, "\n")), $rawObfuscatedResponse); + } + }) + ); + $logger->expects($this->never())->method('logException'); + $communicator->enableLogging($logger); + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + try { + $communicator->put($responseClassMap, $relativeRequestUri); + } catch (ErrorResponseException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + public function testLoggingForInvalidResponse() + { + $relativeRequestUri = '/foo/bar'; + $responseHeaders = array('Content-Type' => 'text/html'); + $responseBody = 'an error occurred'; + $connectionResponse = new ConnectionResponse(400, $responseHeaders, $responseBody); + $connection = new TestingConnection($connectionResponse); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $httpObfuscator = new HttpObfuscator(); + $rawObfuscatedResponse = $httpObfuscator->getRawObfuscatedResponse($connectionResponse); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->exactly(2))->method('log')->will( + $this->returnCallback(function ($message) use ($rawObfuscatedResponse) { + $messageHeader = strstr($message, "\n", true); + if (strpos($messageHeader, 'Incoming response') === 0) { + $this->assertEquals(trim(strstr($message, "\n")), $rawObfuscatedResponse); + } + }) + ); + $logger->expects($this->never())->method('logException'); + $communicator->enableLogging($logger); + $responseClassMap = new ResponseClassMap(); + try { + $communicator->get($responseClassMap, $relativeRequestUri); + } catch (InvalidResponseException $e) { + $this->assertEquals($connectionResponse->getHttpStatusCode(), $e->getResponse()->getHttpStatusCode()); + $this->assertEquals($connectionResponse->getHeaders(), $e->getResponse()->getHeaders()); + $this->assertEquals($connectionResponse->getBody(), $e->getResponse()->getBody()); + return; + } + $this->fail('an expected exception has not been raised'); + } + + public function testLoggingForCommunicationException() + { + $relativeRequestUri = '/foo/bar'; + $errorException = new ErrorException('Test error exception'); + $connection = new TestingConnection(null, $errorException); + $communicator = new Communicator( + $this->getCommunicatorConfiguration(), + null, + $connection + ); + $logger = $this->getMock('\Worldline\Connect\Sdk\Logging\CommunicatorLogger'); + $logger->expects($this->once())->method('log')->will( + $this->returnCallback(function ($message) { + $messageHeader = strstr($message, "\n", true); + $this->assertContains('Outgoing request', $messageHeader); + }) + ); + $logger->expects($this->once())->method('logException')->will( + $this->returnCallback(function ($message, $exception) use ($errorException) { + $this->assertNotContains("\n", $message); + $this->assertEquals($errorException, $exception); + }) + ); + $communicator->enableLogging($logger); + $responseClassMap = new ResponseClassMap(); + try { + $communicator->delete($responseClassMap, $relativeRequestUri); + } catch (ErrorException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + /** + * @return DataObject + */ + protected function getMockRequestDataObject() + { + $requestDataObject = $this->getMock('\Worldline\Connect\Sdk\Domain\DataObject'); + $convertedDataObject = new stdClass(); + $convertedDataObject->customer = new stdClass(); + $convertedDataObject->customer->firstName = 'John'; + $convertedDataObject->customer->lastname = 'Doe'; + $convertedDataObject->accountNumber = '1234567890'; + $requestDataObject->method('toObject')->willReturn($convertedDataObject); + $requestDataObject->method('toJson')->willReturn(json_encode($convertedDataObject)); + return $requestDataObject; + } + + /** + * @return DataObject + */ + protected function getErrorResponseDataObject() + { + $errorResponse = new ErrorResponse(); + $errorResponse->errorId = '123;'; + $apiError = new APIError(); + $apiError->code = 'code'; + $apiError->httpStatusCode = 400; + $apiError->message = 'Test'; + $apiError->propertyName = 'foo'; + $apiError->requestId = '456'; + $errorResponse->errors = array($apiError); + return $errorResponse; + } + + /** + * @param Connection $connection + * @return CommunicatorLoggerHelper + */ + protected function getCommunicatorLoggerHelper(Connection $connection) + { + $method = new ReflectionMethod($connection, 'getCommunicatorLoggerHelper'); + $method->setAccessible(true); + return $method->invoke($connection); + } + + /** + * @param Communicator $communicator + * @param $httpMethod + * @param $relativeUriPathWithRequestParameters + * @param string $clientMetaInfo + * @param CallContext|null $callContext + * @return string[] + */ + protected function getCommunicatorRequestHeaders( + Communicator $communicator, + $httpMethod, + $relativeUriPathWithRequestParameters, + $clientMetaInfo = '', + CallContext $callContext = null + ) { + $method = new ReflectionMethod($communicator, 'getRequestHeaders'); + $method->setAccessible(true); + return $method->invoke( + $communicator, + $httpMethod, + $relativeUriPathWithRequestParameters, + Communicator::MIME_APPLICATION_JSON, + $clientMetaInfo, + $callContext + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/CommunicatorRequestHeaderTest.php b/tests/Worldline/Connect/Sdk/CommunicatorRequestHeaderTest.php new file mode 100644 index 0000000..91d7718 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/CommunicatorRequestHeaderTest.php @@ -0,0 +1,206 @@ +getRequestHeaders( + $this->getCommunicatorConfiguration(), + $httpMethod, + '/v1/consumer/ANDR%C3%89E/?q=na%20me' + ); + $curlHeaders = HttpHeaderHelper::generateRawHeaders($requestHeaders); + + $this->assertCount(4, $curlHeaders); + + $result = false; + foreach ($curlHeaders as $curlHeader) { + $result |= preg_match( + '/^Authorization: GCS v1HMAC:' . $this->getApiKey() . ':[a-zA-Z0-9+\/]+={0,2}/', + $curlHeader + ); + } + $this->assertEquals(true, $result); + } + } + + public function testAddHeaderV1HMACAddHeaders() + { + foreach (array('GET','POST','PUT','DELETE') as $httpMethod) { + $clientMetaInfo = base64_encode('{ "test": "test" }'); + $requestHeaders = $this->getRequestHeaders( + $this->getCommunicatorConfiguration(), + $httpMethod, + '/v1/consumer/ANDR%C3%89E/?q=na%20me', + '', + $clientMetaInfo + ); + + $this->assertCount(5, $requestHeaders); + $result = false; + foreach ($requestHeaders as $curlHeader) { + $splitHeader = explode(':', $curlHeader); + $result |= base64_encode(base64_decode(end($splitHeader))) == end($splitHeader); + } + if (!$result) { + print_r($requestHeaders); + } + $this->assertEquals(true, $result); + + $xGcsHeaders = array_slice($requestHeaders, 1, 3, true); + $xGcsHeadersSorted = $xGcsHeaders; + ksort($xGcsHeadersSorted); + $this->assertEquals($xGcsHeadersSorted, $xGcsHeaders); + } + } + + public function testMultiLineHeader() + { + $gcsHeaderValue = " some value \r\n \n with some \r\n \t spaces "; + $gcsEncodedHeaderValue = trim(preg_replace('/\r?\n[\h]*/', ' ', $gcsHeaderValue)); + $this->assertEquals('some value with some spaces', $gcsEncodedHeaderValue); + } + + public function testServerMetaInfoHeaderSimple() + { + $requestHeaders = $this->getRequestHeaders( + $this->getCommunicatorConfiguration(), + 'GET', + '/v1/consumer/ANDR%C3%89E/?q=na%20me' + ); + $serverMetaInfoJson = $requestHeaders['X-GCS-ServerMetaInfo']; + $serverMetaInfo = json_decode(base64_decode($serverMetaInfoJson)); + $this->assertInstanceOf('\stdClass', $serverMetaInfo); + + $this->assertObjectHasAttribute('platformIdentifier', $serverMetaInfo); + $this->assertContains(php_uname(), $serverMetaInfo->platformIdentifier); + $this->assertContains(phpversion(), $serverMetaInfo->platformIdentifier); + + $this->assertObjectHasAttribute('sdkIdentifier', $serverMetaInfo); + $this->assertEquals('PHPServerSDK/v' . MetadataProvider::SDK_VERSION, $serverMetaInfo->sdkIdentifier); + + $this->assertObjectHasAttribute('sdkCreator', $serverMetaInfo); + $this->assertEquals('Worldline', $serverMetaInfo->sdkCreator); + + $this->assertObjectHasAttribute('integrator', $serverMetaInfo); + $this->assertEquals('Worldline', $serverMetaInfo->integrator); + + $this->assertObjectNotHasAttribute('shoppingCartExtension', $serverMetaInfo); + } + + public function testServerMetaInfoHeaderFull() + { + // create a new CommunicatorConfiguration to not modify the field + $communicatorConfiguration = new CommunicatorConfiguration( + $this->getApiKey(), + $this->getApiSecret(), + $this->getApiEndpoint(), + 'Worldline.Integrator' + ); + $communicatorConfiguration->setShoppingCartExtension(new ShoppingCartExtension('Worldline.Creator', 'Extension', '1.0', 'ExtensionId')); + + $requestHeaders = $this->getRequestHeaders( + $communicatorConfiguration, + 'GET', + '/v1/consumer/ANDR%C3%89E/?q=na%20me' + ); + $serverMetaInfoJson = $requestHeaders['X-GCS-ServerMetaInfo']; + $serverMetaInfo = json_decode(base64_decode($serverMetaInfoJson)); + $this->assertInstanceOf('\stdClass', $serverMetaInfo); + + $this->assertObjectHasAttribute('platformIdentifier', $serverMetaInfo); + $this->assertContains(php_uname(), $serverMetaInfo->platformIdentifier); + $this->assertContains(phpversion(), $serverMetaInfo->platformIdentifier); + + $this->assertObjectHasAttribute('sdkIdentifier', $serverMetaInfo); + $this->assertEquals('PHPServerSDK/v' . MetadataProvider::SDK_VERSION, $serverMetaInfo->sdkIdentifier); + + $this->assertObjectHasAttribute('sdkCreator', $serverMetaInfo); + $this->assertEquals('Worldline', $serverMetaInfo->sdkCreator); + + $this->assertObjectHasAttribute('integrator', $serverMetaInfo); + $this->assertEquals('Worldline.Integrator', $serverMetaInfo->integrator); + + $this->assertObjectHasAttribute('shoppingCartExtension', $serverMetaInfo); + $this->assertInstanceOf('\stdClass', $serverMetaInfo->shoppingCartExtension); + + $this->assertObjectHasAttribute('extensionId', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('ExtensionId', $serverMetaInfo->shoppingCartExtension->extensionId); + $this->assertObjectHasAttribute('creator', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('Worldline.Creator', $serverMetaInfo->shoppingCartExtension->creator); + $this->assertObjectHasAttribute('name', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('Extension', $serverMetaInfo->shoppingCartExtension->name); + $this->assertObjectHasAttribute('version', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('1.0', $serverMetaInfo->shoppingCartExtension->version); + } + + public function testServerMetaInfoHeaderFullNoShoppingCartExtensionId() + { + // create a new CommunicatorConfiguration to not modify the field + $communicatorConfiguration = new CommunicatorConfiguration( + $this->getApiKey(), + $this->getApiSecret(), + $this->getApiEndpoint(), + 'Worldline.Integrator' + ); + $communicatorConfiguration->setShoppingCartExtension(new ShoppingCartExtension('Worldline.Creator', 'Extension', '1.0')); + + $requestHeaders = $this->getRequestHeaders( + $communicatorConfiguration, + 'GET', + '/v1/consumer/ANDR%C3%89E/?q=na%20me', + '' + ); + $serverMetaInfoJson = $requestHeaders['X-GCS-ServerMetaInfo']; + $serverMetaInfo = json_decode(base64_decode($serverMetaInfoJson)); + $this->assertInstanceOf('\stdClass', $serverMetaInfo); + + $this->assertObjectHasAttribute('platformIdentifier', $serverMetaInfo); + $this->assertContains(php_uname(), $serverMetaInfo->platformIdentifier); + $this->assertContains(phpversion(), $serverMetaInfo->platformIdentifier); + + $this->assertObjectHasAttribute('sdkIdentifier', $serverMetaInfo); + $this->assertEquals('PHPServerSDK/v' . MetadataProvider::SDK_VERSION, $serverMetaInfo->sdkIdentifier); + + $this->assertObjectHasAttribute('sdkCreator', $serverMetaInfo); + $this->assertEquals('Worldline', $serverMetaInfo->sdkCreator); + + $this->assertObjectHasAttribute('integrator', $serverMetaInfo); + $this->assertEquals('Worldline.Integrator', $serverMetaInfo->integrator); + + $this->assertObjectHasAttribute('shoppingCartExtension', $serverMetaInfo); + $this->assertInstanceOf('\stdClass', $serverMetaInfo->shoppingCartExtension); + + $this->assertObjectNotHasAttribute('extensionId', $serverMetaInfo->shoppingCartExtension); + $this->assertObjectHasAttribute('creator', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('Worldline.Creator', $serverMetaInfo->shoppingCartExtension->creator); + $this->assertObjectHasAttribute('name', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('Extension', $serverMetaInfo->shoppingCartExtension->name); + $this->assertObjectHasAttribute('version', $serverMetaInfo->shoppingCartExtension); + $this->assertEquals('1.0', $serverMetaInfo->shoppingCartExtension->version); + } + + private function getRequestHeaders( + CommunicatorConfiguration $communicatorConfiguration, + $httpMethod, + $relativeUri, + $contentType = '', + $clientMetaInfo = '' + ) { + $communicator = new Communicator($communicatorConfiguration); + $method = new ReflectionMethod($communicator, 'getRequestHeaders'); + $method->setAccessible(true); + return $method->invoke($communicator, $httpMethod, $relativeUri, $contentType, $clientMetaInfo); + } +} diff --git a/tests/Worldline/Connect/Sdk/CommunicatorTest.php b/tests/Worldline/Connect/Sdk/CommunicatorTest.php new file mode 100644 index 0000000..8a5f89f --- /dev/null +++ b/tests/Worldline/Connect/Sdk/CommunicatorTest.php @@ -0,0 +1,145 @@ +getCommunicatorConfiguration(); + $this->defaultCommunicator = new Communicator($communicatorConfiguration); + $this->defaultResponseClassMap = new ResponseClassMap(); + $this->defaultResponseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + } + + public function tearDown() + { + } + + public function testApiRequestGet() + { + $relativeUri = sprintf('/v1/%s/products', $this->getMerchantId()); + $findParams = new FindProductsParams(); + $findParams->countryCode = 'NL'; + $findParams->currencyCode = 'EUR'; + $clientHeaders = []; + $this->defaultCommunicator->get($this->defaultResponseClassMap, $relativeUri, $clientHeaders, $findParams); + } + + public function testExceptionInvalidUrl() + { + try { + $relativeUri = sprintf('/v1/%s/foo', $this->getMerchantId()); + $this->defaultCommunicator->get($this->defaultResponseClassMap, $relativeUri); + } catch (InvalidResponseException $e) { + $this->assertEquals(404, $e->getResponse()->getHttpStatusCode()); + return; + } + $this->fail('an expected exception has not been raised'); + } + + public function testApiRequestPost() + { + try { + $relativeUri = sprintf('/v1/%s/payments/1/tokenize', $this->getMerchantId()); + $this->defaultCommunicator->post($this->defaultResponseClassMap, $relativeUri); + } catch (ErrorResponseException $e) { + return; + } + $this->fail(); + } + + public function testApiRequestPut() + { + try { + $relativeUri = sprintf('/v1/%s/tokens/1', $this->getMerchantId()); + $this->defaultCommunicator->put($this->defaultResponseClassMap, $relativeUri); + } catch (InvalidResponseException $e) { + return; + } + $this->fail(); + } + + public function testApiRequestDelete() + { + try { + $relativeUri = sprintf('/v1/%s/tokens/1', $this->getMerchantId()); + $this->defaultCommunicator->delete($this->defaultResponseClassMap, $relativeUri); + } catch (ErrorResponseException $e) { + return; + } + $this->fail(); + } + + public function testApiRequestGetWithBinaryResponse() + { + $bodyHandler = new AppendingBodyHandler(); + $relativeUri = sprintf('/v1/%s/products', $this->getMerchantId()); + $findParams = new FindProductsParams(); + $findParams->countryCode = 'NL'; + $findParams->currencyCode = 'EUR'; + $clientHeaders = []; + $this->defaultCommunicator->getWithBinaryResponse(array($bodyHandler, 'handleBodyPart'), $this->defaultResponseClassMap, $relativeUri, $clientHeaders, $findParams); + $this->assertNotEquals('', $bodyHandler->getBody()); + $this->assertStringStartsWith('{', $bodyHandler->getBody()); + $this->assertStringEndsWith('}', $bodyHandler->getBody()); + } + + public function testApiRequestPostWithBinaryResponse() + { + $bodyHandler = new AppendingBodyHandler(); + try { + $relativeUri = sprintf('/v1/%s/payments/1/tokenize', $this->getMerchantId()); + $this->defaultCommunicator->postWithBinaryResponse(array($bodyHandler, 'handleBodyPart'), $this->defaultResponseClassMap, $relativeUri); + } catch (ErrorResponseException $e) { + // the body handler is not called + $this->assertEquals('', $bodyHandler->getBody()); + return; + } + $this->fail(); + } + + public function testApiRequestPutWithBinaryResponse() + { + $bodyHandler = new AppendingBodyHandler(); + try { + $relativeUri = sprintf('/v1/%s/tokens/1', $this->getMerchantId()); + $this->defaultCommunicator->putWithBinaryResponse(array($bodyHandler, 'handleBodyPart'), $this->defaultResponseClassMap, $relativeUri); + } catch (InvalidResponseException $e) { + // the body handler is not called + $this->assertEquals('', $bodyHandler->getBody()); + return; + } + $this->fail(); + } + + public function testApiRequestDeleteWithBinaryResponse() + { + $bodyHandler = new AppendingBodyHandler(); + try { + $relativeUri = sprintf('/v1/%s/tokens/1', $this->getMerchantId()); + $this->defaultCommunicator->deleteWithBinaryResponse(array($bodyHandler, 'handleBodyPart'), $this->defaultResponseClassMap, $relativeUri); + } catch (ErrorResponseException $e) { + // the body handler is not called + $this->assertEquals('', $bodyHandler->getBody()); + return; + } + $this->fail(); + } +} diff --git a/tests/Worldline/Connect/Sdk/GeneratedCodeTest.php b/tests/Worldline/Connect/Sdk/GeneratedCodeTest.php new file mode 100644 index 0000000..e2384d3 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/GeneratedCodeTest.php @@ -0,0 +1,28 @@ +errorId = '123'; + $apiError = new APIError(); + $apiError->code = '1'; + $apiError->message = 'Test message'; + $apiError->propertyName = 'test'; + $errorResponse->errors = array($apiError); + $jsonErrorResponse = $errorResponse->toJson(); + $this->assertEquals('{"errorId":"123","errors":[{"code":"1","message":"Test message","propertyName":"test"}]}', $jsonErrorResponse); + $actualErrorResponse = new ErrorResponse(); + $actualErrorResponse->fromJson($jsonErrorResponse); + $this->assertEquals($errorResponse, $actualErrorResponse); + } +} diff --git a/tests/Worldline/Connect/Sdk/It/ConvertAmountTest.php b/tests/Worldline/Connect/Sdk/It/ConvertAmountTest.php new file mode 100644 index 0000000..06c1407 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/ConvertAmountTest.php @@ -0,0 +1,34 @@ +getClient(); + $merchantId = $this->getMerchantId(); + $convertAmountParams = new ConvertAmountParams(); + + $convertAmountParams->amount = 1000; + $convertAmountParams->source = "USD"; + $convertAmountParams->target = "EUR"; + + $response = $client->v1()->merchant($merchantId)->services()->convertAmount($convertAmountParams); + $this->assertNotNull($response->convertedAmount); + + return $response; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/MultipartFormDataTest.php b/tests/Worldline/Connect/Sdk/It/MultipartFormDataTest.php new file mode 100644 index 0000000..ad77a7e --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/MultipartFormDataTest.php @@ -0,0 +1,251 @@ +getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\It\HttpBinResponse'; + + /** @var HttpBinResponse $response */ + $response = $communicator->post($responseClassMap, '/post', '', $multipart); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPostWithMultipartDataObjectWithResponse() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\It\HttpBinResponse'; + + /** @var HttpBinResponse $response */ + $response = $communicator->post($responseClassMap, '/post', '', new MultipartFormDataWrapper($multipart)); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPostWithMultipartFormDataObjectWithCallable() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + + $responseBuilder = new ResponseBuilder(); + $bodyHandler = function ($data, $headers) use ($responseBuilder) { + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $communicator->postWithBinaryResponse($bodyHandler, $responseClassMap, '/post', '', $multipart); + + $response = new HttpBinResponse(); + $response->fromJson($responseBuilder->getResponse()->getBody()); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPostWithMultipartDataObjectWithCallable() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + + $responseBuilder = new ResponseBuilder(); + $bodyHandler = function ($data, $headers) use ($responseBuilder) { + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $communicator->postWithBinaryResponse($bodyHandler, $responseClassMap, '/post', '', new MultipartFormDataWrapper($multipart)); + + $response = new HttpBinResponse(); + $response->fromJson($responseBuilder->getResponse()->getBody()); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPutWithMultipartFormDataObjectWithResponse() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\It\HttpBinResponse'; + + /** @var HttpBinResponse $response */ + $response = $communicator->put($responseClassMap, '/put', '', $multipart); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPutWithMultipartDataObjectWithResponse() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\It\HttpBinResponse'; + + /** @var HttpBinResponse $response */ + $response = $communicator->put($responseClassMap, '/put', '', new MultipartFormDataWrapper($multipart)); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPutWithMultipartFormDataObjectWithCallable() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + + $responseBuilder = new ResponseBuilder(); + $bodyHandler = function ($data, $headers) use ($responseBuilder) { + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $communicator->putWithBinaryResponse($bodyHandler, $responseClassMap, '/put', '', $multipart); + + $response = new HttpBinResponse(); + $response->fromJson($responseBuilder->getResponse()->getBody()); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } + + public function testMultipartFormDataUploadPutWithMultipartDataObjectWithCallable() + { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicatorConfiguration->setApiEndpoint($this->getHttpBinUrl()); + $communicator = new Communicator($communicatorConfiguration); + + $multipart = new MultipartFormDataObject(); + $multipart->addFile('file', new UploadableFile('file.txt', 'file-content', 'text/plain')); + $multipart->addValue('value', 'Hello World'); + + $responseClassMap = new ResponseClassMap(); + + $responseBuilder = new ResponseBuilder(); + $bodyHandler = function ($data, $headers) use ($responseBuilder) { + $responseBuilder->setHeaders($headers); + $responseBuilder->appendBody($data); + }; + + $communicator->putWithBinaryResponse($bodyHandler, $responseClassMap, '/put', '', new MultipartFormDataWrapper($multipart)); + + $response = new HttpBinResponse(); + $response->fromJson($responseBuilder->getResponse()->getBody()); + + $this->assertEquals('Hello World', $response->form->value); + $this->assertEquals('file-content', $response->files->file); + } +} + +class HttpBinResponse extends DataObject +{ + public $form; + public $files; + + public function toObject() + { + $object = parent::toObject(); + if (!is_null($this->form)) { + $object->form = $this->form; + } + if (!is_null($this->files)) { + $object->files = $this->files; + } + return $object; + } + + public function fromObject($object) + { + parent::fromObject($object); + if (property_exists($object, 'form')) { + $this->form = $object->form; + } + if (property_exists($object, 'files')) { + $this->files = $object->files; + } + return $this; + } +} + +class MultipartFormDataWrapper extends MultipartDataObject +{ + private $multipart; + + public function __construct($multipart) + { + $this->multipart = $multipart; + } + + public function toMultipartFormDataObject() + { + return $this->multipart; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/ProductGroupTest.php b/tests/Worldline/Connect/Sdk/It/ProductGroupTest.php new file mode 100644 index 0000000..30a0c18 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/ProductGroupTest.php @@ -0,0 +1,36 @@ +getClient(); + $merchantId = $this->getMerchantId(); + + $getParams = new GetProductgroupParams(); + + $getParams->amount = 1000; + $getParams->currencyCode = "USD"; + $getParams->locale = "en_US"; + $getParams->countryCode = "US"; + $getParams->isRecurring = true; + + $paymentProductResponse = $client->v1()->merchant($merchantId)->productgroups()->get("cards", $getParams); + $this->assertEquals("cards", $paymentProductResponse->id); + return $paymentProductResponse; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/ProductTest.php b/tests/Worldline/Connect/Sdk/It/ProductTest.php new file mode 100644 index 0000000..712ae67 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/ProductTest.php @@ -0,0 +1,52 @@ +getClient(); + $merchantId = $this->getMerchantId(); + $findParams = new FindProductsParams(); + + $findParams->currencyCode = "EUR"; + $findParams->countryCode = "NL"; + + $paymentProducts = $client->v1()->merchant($merchantId)->products()->find($findParams); + $this->assertTrue(count($paymentProducts->paymentProducts) > 0); + return $paymentProducts; + } + + /** + * @throws ApiException + * @return Directory + */ + public function testRetrievePaymentProductDirectory() + { + $client = $this->getClient(); + $merchantId = $this->getMerchantId(); + $directoryParams = new DirectoryParams(); + + $directoryParams->currencyCode = "EUR"; + $directoryParams->countryCode = "NL"; + + $productDirectory = $client->v1()->merchant($merchantId)->products()->directory(809, $directoryParams); + $this->assertTrue(count($productDirectory->entries) > 0); + return $productDirectory; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/ProxyTest.php b/tests/Worldline/Connect/Sdk/It/ProxyTest.php new file mode 100644 index 0000000..30688b0 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/ProxyTest.php @@ -0,0 +1,34 @@ +getProxyClient(); + $merchantId = $this->getMerchantId(); + $convertAmountParams = new ConvertAmountParams(); + + $convertAmountParams->amount = 1000; + $convertAmountParams->source = "USD"; + $convertAmountParams->target = "EUR"; + + $response = $client->v1()->merchant($merchantId)->services()->convertAmount($convertAmountParams); + $this->assertNotNull($response->convertedAmount); + + return $response; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/RiskAssessmentTest.php b/tests/Worldline/Connect/Sdk/It/RiskAssessmentTest.php new file mode 100644 index 0000000..9f51b83 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/RiskAssessmentTest.php @@ -0,0 +1,56 @@ +getClient(); + $merchantId = $this->getMerchantId(); + + $riskAssessmentBankAccount = new RiskAssessmentBankAccount(); + + $bankAccountBban = new BankAccountBban(); + $bankAccountBban->countryCode = "DE"; + $bankAccountBban->accountNumber = "0532013000"; + $bankAccountBban->bankCode = "37040044"; + $riskAssessmentBankAccount->bankAccountBban = $bankAccountBban; + + $riskAssessmentOrder = new OrderRiskAssessment(); + + $amountOfMoney = new AmountOfMoney(); + $amountOfMoney->amount = 100; + $amountOfMoney->currencyCode = "EUR"; + $riskAssessmentOrder->amountOfMoney = $amountOfMoney; + + $customer = new CustomerRiskAssessment(); + $customer->locale = "en"; + $customerBillingAddress = new Address(); + $customerBillingAddress->countryCode = 'NL'; + $customer->billingAddress = $customerBillingAddress; + $riskAssessmentOrder->customer = $customer; + + $riskAssessmentBankAccount->order = $riskAssessmentOrder; + + $response = $client->v1()->merchant($merchantId)->riskassessments()->bankaccounts($riskAssessmentBankAccount); + $this->assertTrue(count($response->results) > 0); + + return $response; + } +} diff --git a/tests/Worldline/Connect/Sdk/It/TokenTest.php b/tests/Worldline/Connect/Sdk/It/TokenTest.php new file mode 100644 index 0000000..894f4ec --- /dev/null +++ b/tests/Worldline/Connect/Sdk/It/TokenTest.php @@ -0,0 +1,56 @@ +countryCode = "NL"; + + $customer = new CustomerToken(); + $customer->billingAddress = $billingAddress; + + $cardWithoutCvv = new CardWithoutCvv(); + $cardWithoutCvv->cardholderName = "Jan"; + $cardWithoutCvv->issueNumber = "12"; + $cardWithoutCvv->cardNumber = "4567350000427977"; + $cardWithoutCvv->expiryDate = "1225"; + + $mandate = new TokenCardData(); + $mandate->cardWithoutCvv = $cardWithoutCvv; + + $tokenCard = new TokenCard(); + $tokenCard->customer = $customer; + $tokenCard->data = $mandate; + + $createTokenRequest = new CreateTokenRequest(); + $createTokenRequest->paymentProductId = 1; + $createTokenRequest->card = $tokenCard; + + $client = $this->getClient(); + $merchantId = $this->getMerchantId(); + $createTokenResponse = $client->v1()->merchant($merchantId)->tokens()->create($createTokenRequest); + + $this->assertNotNull($createTokenResponse->token); + + $deleteTokenRequest = new DeleteTokenParams(); + $client->v1()->merchant($merchantId)->tokens()->delete($createTokenResponse->token, $deleteTokenRequest); + } +} diff --git a/tests/Worldline/Connect/Sdk/JsonValuesStore.php b/tests/Worldline/Connect/Sdk/JsonValuesStore.php new file mode 100644 index 0000000..b77c8c5 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/JsonValuesStore.php @@ -0,0 +1,73 @@ +valuesFilePath = $valuesFilePath; + } + + /** + * @param string $key + * @param bool $isRequired + * @return mixed + * @throws Exception + */ + public function getValue($key, $isRequired = true) + { + $valuesObject = $this->getValuesObject(); + $value = null; + if (!property_exists($valuesObject, $key) && $isRequired) { + throw new Exception('could not find property "' . $key . '"" in file "' . $this->valuesFilePath . '"'); + } + if (property_exists($valuesObject, $key)) { + $value = $valuesObject->{$key}; + } + return $value; + } + + /** + * @return StdClass + * @throws Exception + */ + protected function getValuesObject() + { + if (is_null($this->valuesObject)) { + if (!file_exists($this->valuesFilePath)) { + throw new Exception('could not open file ' . $this->valuesFilePath . ' (file does not exist)'); + } + if (!is_readable($this->valuesFilePath)) { + throw new Exception('could not open file ' . $this->valuesFilePath . ' (file is not readable)'); + } + $valuesObject = json_decode(file_get_contents($this->valuesFilePath)); + if (!$valuesObject) { + throw new Exception( + 'could not read JSON values file ' . $this->valuesFilePath . ' (file does not contain valid json)' + ); + } + $this->valuesObject = $valuesObject; + } + + return $this->valuesObject; + } +} diff --git a/tests/Worldline/Connect/Sdk/Logging/BodyObfuscatorTest.php b/tests/Worldline/Connect/Sdk/Logging/BodyObfuscatorTest.php new file mode 100644 index 0000000..ddd4333 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Logging/BodyObfuscatorTest.php @@ -0,0 +1,257 @@ +assertEquals( + $obfuscatedJsonBody, + $bodyObfuscator->obfuscateBody(BodyObfuscator::MIME_APPLICATION_JSON, $jsonBody) + ); + } + + /** + * @dataProvider jsonObfuscationProvider + * @param string $jsonBody + * @param string $obfuscatedJsonBody + */ + public function testJsonObfuscationUTF8($jsonBody, $obfuscatedJsonBody) + { + $bodyObfuscator = new BodyObfuscator(); + $this->assertEquals( + $obfuscatedJsonBody, + $bodyObfuscator->obfuscateBody(BodyObfuscator::MIME_APPLICATION_JSON . ';charset=UTF-8', $jsonBody) + ); + } + + /** + * @return array + */ + public function jsonObfuscationProvider() + { + $testObjects = array( + array( + null, + null + ), + array( + true, + true + ), + array( + false, + false + ), + array( + 123.45, + 123.45 + ), + array( + 'foo', + 'foo' + ), + array( + 'secretkey', + 'secretkey' + ), + array( + array(), + array() + ), + array( + array('foo'), + array('foo') + ), + array( + (object) array(), + (object) array() + ), + array( + (object) array('foo'), + (object) array('foo') + ), + array( + array('name' => 'foo'), + array('name' => 'foo') + ), + array( + array('secretKey' => 'foo'), + array('secretKey' => '********') + ), + array( + array('value' => 'foo'), + array('value' => '***') + ), + array( + array('bin' => '1234567890'), + array('bin' => '123456****') + ), + array( + array('iban' => 'NL12ABCD1234567890'), + array('iban' => '**************7890') + ), + array( + array('cardNumber' => '1234567890123456'), + array('cardNumber' => '************3456') + ), + array( + array('expiryDate' => '1234'), + array('expiryDate' => '**34') + ), + array( + array('fields' => array(array('name' => 'foo'), array('value' => 'foo'))), + array('fields' => array(array('name' => 'foo'), array('value' => '***'))) + ) + ); + return array_map(function (array $testObjectValues) { + return array_map(function ($testObjectValue) { + return json_encode($testObjectValue, JSON_PRETTY_PRINT); + }, $testObjectValues); + }, $testObjects); + } + + /** + * @dataProvider skipObfuscationProvider + * @param string $contentType + * @param string $value + */ + public function testSkipObfuscation($contentType, $value) + { + $bodyObfuscator = new BodyObfuscator(); + $this->assertEquals($value, $bodyObfuscator->obfuscateBody($contentType, $value)); + } + + /** + * @return array + */ + public function skipObfuscationProvider() + { + return array( + array(BodyObfuscator::MIME_APPLICATION_JSON, 'foo'), + array(BodyObfuscator::MIME_APPLICATION_JSON, '{'), + array('text/html', ''), + array('text/html', 'foo'), + array('text/html', '{'), + array('text/html', '{"foo": "bar"'), + array('', '') + ); + } + /** + * @dataProvider jsonCustomObfuscationProvider + * @param string $jsonBody + * @param string $obfuscatedJsonBody + */ + public function testJsonCustomObfuscation($jsonBody, $obfuscatedJsonBody) + { + $bodyObfuscator = new BodyObfuscator(); + $bodyObfuscator->setCustomRule('cardnumber', function ($value) { + return mb_substr($value, 0, 6) . str_repeat('*', 6) . + mb_substr($value, mb_strlen($value, 'UTF-8') - 4); + }); + $bodyObfuscator->setCustomRule('iban', function ($value, $valueObfuscator) { + return $valueObfuscator->obfuscateAll($value); + }); + $this->assertEquals( + $obfuscatedJsonBody, + $bodyObfuscator->obfuscateBody(BodyObfuscator::MIME_APPLICATION_JSON, $jsonBody) + ); + } + + /** + * @return array + */ + public function jsonCustomObfuscationProvider() + { + $testObjects = array( + array( + null, + null + ), + array( + true, + true + ), + array( + false, + false + ), + array( + 123.45, + 123.45 + ), + array( + 'foo', + 'foo' + ), + array( + 'secretkey', + 'secretkey' + ), + array( + array(), + array() + ), + array( + array('foo'), + array('foo') + ), + array( + (object) array(), + (object) array() + ), + array( + (object) array('foo'), + (object) array('foo') + ), + array( + array('name' => 'foo'), + array('name' => 'foo') + ), + array( + array('secretKey' => 'foo'), + array('secretKey' => '********') + ), + array( + array('value' => 'foo'), + array('value' => '***') + ), + array( + array('bin' => '1234567890'), + array('bin' => '123456****') + ), + array( + array('iban' => 'NL12ABCD1234567890'), + array('iban' => '******************') + ), + array( + array('cardNumber' => '1234567890123456'), + array('cardNumber' => '123456******3456') + ), + array( + array('expiryDate' => '1234'), + array('expiryDate' => '**34') + ), + array( + array('fields' => array(array('name' => 'foo'), array('value' => 'foo'))), + array('fields' => array(array('name' => 'foo'), array('value' => '***'))) + ) + ); + return array_map(function (array $testObjectValues) { + return array_map(function ($testObjectValue) { + return json_encode($testObjectValue, JSON_PRETTY_PRINT); + }, $testObjectValues); + }, $testObjects); + } +} diff --git a/tests/Worldline/Connect/Sdk/Logging/HeaderObfuscatorTest.php b/tests/Worldline/Connect/Sdk/Logging/HeaderObfuscatorTest.php new file mode 100644 index 0000000..20b9f94 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Logging/HeaderObfuscatorTest.php @@ -0,0 +1,113 @@ +assertEquals($obfuscatedHeaders, $headerObfuscator->obfuscateHeaders($headers)); + } + + /** + * @return array + */ + public function headerObfuscatorProvider() + { + return array( + array( + array(),array() + ), + array( + array('Authorization' => 'foo'), + array('Authorization' => '********') + ), + array( + array('authorization' => 'foo'), + array('authorization' => '********') + ), + array( + array('Authorisation' => 'foo'), + array('Authorisation' => 'foo') + ), + array( + array('Authorization' => 'foo', 'Content-Type' => 'application/json'), + array('Authorization' => '********', 'Content-Type' => 'application/json') + ), + array( + array(0 => 'HTTP/1.1 200 OK'), + array(0 => 'HTTP/1.1 200 OK') + ), + array( + array('Authorization' => array('foo', 'bar')), + array('Authorization' => array('********', '********')) + ) + ); + } + /** + * @dataProvider customHeaderObfuscatorProvider + * @param string[] $headers + * @param string[] $obfuscatedHeaders + */ + public function testCustomHeaderObfuscator( + $headers, + $obfuscatedHeaders + ) { + $headerObfuscator = new HeaderObfuscator(); + $headerObfuscator->setCustomRule('content-type', function ($value, $valueObfuscator) { + return $valueObfuscator->obfuscateAll($value); + }); + $headerObfuscator->setCustomRule('authorization', function ($value) { + return '*****'; + }); + $this->assertEquals($obfuscatedHeaders, $headerObfuscator->obfuscateHeaders($headers)); + } + + /** + * @return array + */ + public function customHeaderObfuscatorProvider() + { + return array( + array( + array(),array() + ), + array( + array('Authorization' => 'foo'), + array('Authorization' => '*****') + ), + array( + array('authorization' => 'foo'), + array('authorization' => '*****') + ), + array( + array('Authorisation' => 'foo'), + array('Authorisation' => 'foo') + ), + array( + array('Authorization' => 'foo', 'Content-Type' => 'application/json'), + array('Authorization' => '*****', 'Content-Type' => '****************') + ), + array( + array(0 => 'HTTP/1.1 200 OK'), + array(0 => 'HTTP/1.1 200 OK') + ), + array( + array('Authorization' => array('foo', 'bar')), + array('Authorization' => array('*****', '*****')) + ) + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/Logging/ResourceLoggerTest.php b/tests/Worldline/Connect/Sdk/Logging/ResourceLoggerTest.php new file mode 100644 index 0000000..9513660 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Logging/ResourceLoggerTest.php @@ -0,0 +1,37 @@ +log($message); + // 25 is length of DATE_ATOM + fseek($temp, 26); + $content = fread($temp, 4096); + $this->assertEquals($message . PHP_EOL, $content); + } + + public function testLogException() + { + $temp = tmpfile(); + $logger = new ResourceLogger($temp); + $message = "test log"; + $exception = new ResponseException(500, new ErrorResponse()); + $logger->logException($message, $exception); + // 25 is length of DATE_ATOM + fseek($temp, 26); + $content = fread($temp, 4096); + $this->assertEquals($message . PHP_EOL . $exception . PHP_EOL, $content); + } +} diff --git a/tests/Worldline/Connect/Sdk/Logging/SplFileObjectLoggerTest.php b/tests/Worldline/Connect/Sdk/Logging/SplFileObjectLoggerTest.php new file mode 100644 index 0000000..21a6db1 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Logging/SplFileObjectLoggerTest.php @@ -0,0 +1,44 @@ +log($message); + // 25 is length of DATE_ATOM + $temp->fseek(26); + $content = ""; + while (!$temp->eof()) { + $content .= $temp->fgets(); + } + $this->assertEquals($message . PHP_EOL, $content); + } + + public function testLogException() + { + $temp = new SplTempFileObject(); + $logger = new SplFileObjectLogger($temp); + $message = "test log"; + $exception = new ResponseException(500, new ErrorResponse()); + $logger->logException($message, $exception); + // 25 is length of DATE_ATOM + $temp->fseek(26); + $content = ""; + while (!$temp->eof()) { + $content .= $temp->fgets(); + } + $this->assertEquals($message . PHP_EOL . $exception . PHP_EOL, $content); + } +} diff --git a/tests/Worldline/Connect/Sdk/Logging/ValueObfuscatorTest.php b/tests/Worldline/Connect/Sdk/Logging/ValueObfuscatorTest.php new file mode 100644 index 0000000..41d65da --- /dev/null +++ b/tests/Worldline/Connect/Sdk/Logging/ValueObfuscatorTest.php @@ -0,0 +1,51 @@ +assertEquals($valueStartObfuscated, $valueObfuscator->obfuscateAllKeepEnd($value, $obfuscationLength)); + $this->assertEquals($valueEndObfuscated, $valueObfuscator->obfuscateAllKeepStart($value, $obfuscationLength)); + $this->assertEquals($valueAllObfuscated, $valueObfuscator->obfuscateAll($value)); + $this->assertEquals($obfuscatedFixedLength, $valueObfuscator->obfuscateFixedLength($obfuscationLength)); + } + + public function valueObfuscatorProvider() + { + return array( + array('', 0, '', '', '', ''), + array('', 3, '', '', '', '***'), + array('foo', -1, '***', '***', '***', ''), + array('foo', 0, '***', '***', '***', ''), + array('foo', 1, '**o', 'f**', '***', '*'), + array('foo', 2, '*oo', 'fo*', '***', '**'), + array('foo', 3, 'foo', 'foo', '***', '***'), + array('foo', 4, 'foo', 'foo', '***', '****'), + array('fóo', 1, '**o', 'f**', '***', '*'), + array('fóo', 2, '*óo', 'fó*', '***', '**'), + array('fóo', 3, 'fóo', 'fóo', '***', '***') + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/TestCase.php b/tests/Worldline/Connect/Sdk/TestCase.php new file mode 100644 index 0000000..33d3f62 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/TestCase.php @@ -0,0 +1,138 @@ +configFilePath = dirname(__FILE__) . '/../../../config.json'; + } + + /** + * @return string + * @throws Exception + */ + protected function getMerchantId() + { + return $this->getJsonValuesStore()->getValue('merchant_id'); + } + + /** + * @return string + * @throws Exception + */ + protected function getApiKey() + { + return $this->getJsonValuesStore()->getValue('api_key'); + } + + /** + * @return string + * @throws Exception + */ + protected function getApiSecret() + { + return $this->getJsonValuesStore()->getValue('api_secret'); + } + + /** + * @return string + * @throws Exception + */ + protected function getApiEndpoint() + { + return $this->getJsonValuesStore()->getValue('api_endpoint'); + } + + /** + * @return string + * @throws Exception + */ + protected function getProxyHost() + { + return $this->getJsonValuesStore()->getValue('proxy_host', false); + } + + /** + * @return string + * @throws Exception + */ + protected function getProxyPort() + { + return $this->getJsonValuesStore()->getValue('proxy_port', false); + } + + /** + * @return string + * @throws Exception + */ + protected function getProxyUsername() + { + return $this->getJsonValuesStore()->getValue('proxy_username', false); + } + + /** + * @return string + * @throws Exception + */ + protected function getProxyPassword() + { + return $this->getJsonValuesStore()->getValue('proxy_password', false); + } + + /** + * @return string + * @throws Exception + */ + protected function getHttpBinUrl() + { + $httpBinUrl = $this->getJsonValuesStore()->getValue('httpbin_url', false); + if (!$httpBinUrl) { + $httpBinUrl = 'http://httpbin.org'; + } + return $httpBinUrl; + } + + /** + * @return JsonValuesStore + */ + protected function getJsonValuesStore() + { + if (is_null($this->jsonValuesStore)) { + $this->jsonValuesStore = new JsonValuesStore($this->configFilePath); + } + return $this->jsonValuesStore; + } + + /** + * @return CommunicatorConfiguration + */ + protected function getCommunicatorConfiguration() + { + return new CommunicatorConfiguration( + $this->getApiKey(), + $this->getApiSecret(), + $this->getApiEndpoint(), + 'Worldline' + ); + } +} diff --git a/tests/Worldline/Connect/Sdk/TestUtil/AppendingBodyHandler.php b/tests/Worldline/Connect/Sdk/TestUtil/AppendingBodyHandler.php new file mode 100644 index 0000000..2befee2 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/TestUtil/AppendingBodyHandler.php @@ -0,0 +1,25 @@ +body = ''; + } + + protected function doHandleBodyPart($bodyPart) + { + $this->body .= $bodyPart; + } + + public function getBody() + { + return $this->body; + } +} diff --git a/tests/Worldline/Connect/Sdk/TestUtil/TestingConnection.php b/tests/Worldline/Connect/Sdk/TestUtil/TestingConnection.php new file mode 100644 index 0000000..0050550 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/TestUtil/TestingConnection.php @@ -0,0 +1,39 @@ +response = $response; + $this->exception = $exception; + } + + protected function executeRequest( + $httpMethod, + $requestUri, + $requestHeaders, + $body, + callable $responseHandler, + ProxyConfiguration $proxyConfiguration = null + ) { + if (!is_null($this->exception)) { + throw $this->exception; + } else { + $statusCode = $this->response->getHttpStatusCode(); + $body = $this->response->getBody(); + $headers = $this->response->getHeaders(); + call_user_func($responseHandler, $statusCode, $body, $headers); + return $this->response; + } + } +} diff --git a/tests/Worldline/Connect/Sdk/V1/ExceptionTest.php b/tests/Worldline/Connect/Sdk/V1/ExceptionTest.php new file mode 100644 index 0000000..fdd5d24 --- /dev/null +++ b/tests/Worldline/Connect/Sdk/V1/ExceptionTest.php @@ -0,0 +1,99 @@ +assertEmpty($responseException->getErrorId()); + $this->assertCount(0, $responseException->getErrors()); + } + + public function testExceptionStringRepresentation() + { + $httpStatusCode = 400; + $errorResponseJsonString = <<<'EOD' +{ + "errorId": "8a41a5dd-7366-4026-a41b-e98c56808edd", + "errors": [ + { + "category": "CONNECT_PLATFORM_ERROR", + "code": "20000000", + "httpStatusCode": 400, + "id": "PARAMETER_NOT_FOUND_IN_REQUEST", + "message": "The parameter shown above was not found in the request received by connect.", + "propertyName": "bin", + "requestId": "" + } + ] +} +EOD; + $errorResponse = new ErrorResponse(); + $errorResponse->fromJson($errorResponseJsonString); + $responseException = new ResponseException($httpStatusCode, $errorResponse); + $expectedResponseExceptionString = sprintf( + "exception '%s' with message '%s'. in %s:%d\nHTTP status code: %s\nResponse:\n%s\nStack trace:\n%s", + 'Worldline\Connect\Sdk\V1\ResponseException', + $responseException->getMessage(), + $responseException->getFile(), + $responseException->getLine(), + $httpStatusCode, + $errorResponseJsonString, + $responseException->getTraceAsString() + ); + // replace Windows \r\n with Unix \n before comparing + $this->assertEquals(str_replace("\r\n", "\n", $expectedResponseExceptionString), str_replace("\r\n", "\n", (string) $responseException)); + } + + public function testValidationException() + { + try { + $emptyBody = new GetIINDetailsRequest(); + $this->getClient()->v1()->merchant($this->getMerchantId())->services()->getIINdetails($emptyBody); + } catch (ValidationException $e) { + return; + } + $this->fail('An expected exception has not been raised.'); + } + + public function testDeclinedPaymentException() + { + $paymentErrorResponse = new PaymentErrorResponse(); + $declinedPaymentException = new DeclinedPaymentException(0, $paymentErrorResponse); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\CreatePaymentResult', $declinedPaymentException->getCreatePaymentResult()); + $paymentErrorResponse->paymentResult = new CreatePaymentResult(); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\CreatePaymentResult', $declinedPaymentException->getCreatePaymentResult()); + } + + public function testDeclinedPayoutException() + { + $payoutErrorResponse = new PayoutErrorResponse(); + $declinedPayoutException = new DeclinedPayoutException(0, $payoutErrorResponse); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\PayoutResult', $declinedPayoutException->getPayoutResult()); + $payoutErrorResponse->payoutResult = new PayoutResult(); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\PayoutResult', $declinedPayoutException->getPayoutResult()); + } + + public function testDeclinedRefundException() + { + $refundErrorResponse = new RefundErrorResponse(); + $declinedRefundException = new DeclinedRefundException(0, $refundErrorResponse); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\RefundResult', $declinedRefundException->getRefundResult()); + $refundErrorResponse->refundResult = new RefundResult(); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\Domain\RefundResult', $declinedRefundException->getRefundResult()); + } +} diff --git a/tests/Worldline/Connect/Sdk/V1/IdempotenceTest.php b/tests/Worldline/Connect/Sdk/V1/IdempotenceTest.php new file mode 100644 index 0000000..f5502ea --- /dev/null +++ b/tests/Worldline/Connect/Sdk/V1/IdempotenceTest.php @@ -0,0 +1,169 @@ +getRequestHeaders($callContext); + $this->assertArrayNotHasKey($idempotenceKeyHeaderName, $requestHeaders); + $this->assertArrayHasKey($authorizationHeaderName, $requestHeaders); + $authorizationValueWithoutIdempotence = $requestHeaders[$authorizationHeaderName]; + $callContext->setIdempotenceKey('test'); + $requestHeaders = $this->getRequestHeaders($callContext); + $this->assertArrayHasKey($idempotenceKeyHeaderName, $requestHeaders); + $this->assertEquals($idempotenceKey, $requestHeaders[$idempotenceKeyHeaderName]); + $this->assertArrayHasKey($authorizationHeaderName, $requestHeaders); + $authorizationValueWithIdempotence = $requestHeaders[$authorizationHeaderName]; + $this->assertNotEquals($authorizationValueWithoutIdempotence, $authorizationValueWithIdempotence); + } + + public function testGetWithCallContext() + { + $callContext = new CallContext(); + $idempotenceKey = 'test'; + $idempotenceRequestTimestamp = '12345'; + $callContext->setIdempotenceKey($idempotenceKey); + $responseHeaders = array( + 'Content-Type' => 'application/json', + 'X-GCS-Idempotence-Request-Timestamp' => $idempotenceRequestTimestamp + ); + $responseBody = <<getCommunicatorConfiguration(); + $communicator = new Communicator($communicatorConfiguration, null, new TestingConnection($response)); + $communicator->get(new ResponseClassMap(), '/', '', null, $callContext); + $this->assertEquals($idempotenceKey, $callContext->getIdempotenceKey()); + $this->assertEquals($idempotenceRequestTimestamp, $callContext->getIdempotenceRequestTimestamp()); + } + + + public function testIdempotenceException() + { + $callContext = new CallContext(); + $callContext->setIdempotenceKey('test'); + $responseHeaders = array( + 'Content-Type' => 'application/json', + 'X-GCS-Idempotence-Request-Timestamp' => '12345' + ); + $responseBody = <<getCommunicatorConfiguration(); + $communicator = new Communicator($communicatorConfiguration, null, new TestingConnection($connectionResponse)); + $client = new Client($communicator); + try { + $client->v1()->merchant($this->getMerchantId())->payments()->create(new CreatePaymentRequest(), $callContext); + $this->fail('expected IdempotenceException'); + } catch (IdempotenceException $exception) { + $this->assertEquals($callContext->getIdempotenceKey(), $exception->getIdempotenceKey()); + $this->assertNotEmpty($exception->getIdempotenceRequestTimestamp()); + $this->assertEquals( + $callContext->getIdempotenceRequestTimestamp(), + $exception->getIdempotenceRequestTimestamp() + ); + } + } + + public function testReferenceException() + { + $callContext = new CallContext(); + $callContext->setIdempotenceKey('test'); + $responseHeaders = array( + 'Content-Type' => 'application/json', + 'X-GCS-Idempotence-Request-Timestamp' => '12345' + ); + $responseBody = <<defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; + $exception = $responseExceptionFactory->createException( + $connectionResponse->getHttpStatusCode(), + $responseFactory->createResponse($connectionResponse, $responseClassMap), + $callContext + ); + $this->assertInstanceOf('\Worldline\Connect\Sdk\V1\ReferenceException', $exception); + } + + private function getRequestHeaders(CallContext $context) { + $communicatorConfiguration = $this->getCommunicatorConfiguration(); + $communicator = new Communicator($communicatorConfiguration); + $method = new ReflectionMethod($communicator, 'getRequestHeaders'); + $method->setAccessible(true); + return $method->invoke($communicator, 'GET', 'https://example.com', '', '', $context); + } +} diff --git a/tests/Worldline/Connect/Sdk/V1/Webhooks/WebhooksHelperTest.php b/tests/Worldline/Connect/Sdk/V1/Webhooks/WebhooksHelperTest.php new file mode 100644 index 0000000..082f15d --- /dev/null +++ b/tests/Worldline/Connect/Sdk/V1/Webhooks/WebhooksHelperTest.php @@ -0,0 +1,272 @@ +validBody = preg_replace("/\r\n/", "\n", self::VALID_BODY_WITHOUT_LINEBREAK_FIX); + $this->invalidBody = preg_replace("/\r\n/", "\n", self::INVALID_BODY_WITHOUT_LINEBREAK_FIX); + } + + function testUnmarshalApiVersionMismatch() + { + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => self::SECRET_KEY)); + $helper = new ApiVersionMismatchTestingWebhooksHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + try { + $helper->unmarshal($this->validBody, $requestHeaders); + } catch (ApiVersionMismatchException $e) { + $this->assertEquals('v0', $e->getEventApiVersion()); + $this->assertEquals('v1', $e->getSdkApiVersion()); + return; + } + $this->fail('an expected exception has not been raised'); + } + + function testUnmarshalNoSecretKeyAvailable() + { + $secretKeyStore = new InMemorySecretKeyStore(); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + + try { + $helper->unmarshal($this->validBody, $requestHeaders); + } catch (SecretKeyNotAvailableException $e) { + $this->assertEquals(self::KEY_ID, $e->getKeyId()); + return; + } + $this->fail('an expected exception has not been raised'); + } + + function testUnmarshalMissingHeaders() + { + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => self::SECRET_KEY)); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(); + try { + $helper->unmarshal($this->validBody, $requestHeaders); + } catch (SignatureValidationException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + function testUnmarshalBytesSuccess() + { + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => self::SECRET_KEY)); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + + $event = $helper->unmarshal($this->validBody, $requestHeaders); + + $this->assertEquals('v1', $event->apiVersion); + $this->assertEquals('8ee793f6-4553-4749-85dc-f2ef095c5ab0', $event->id); + $this->assertEquals('2017-02-02T11:24:14.040+0100', $event->created); + $this->assertEquals('20000', $event->merchantId); + $this->assertEquals('payment.paid', $event->type); + + $this->assertNull($event->refund); + $this->assertNull($event->payout); + $this->assertNull($event->token); + + $this->assertNotNull($event->payment); + $this->assertEquals('00000200000143570012', $event->payment->id); + $this->assertNotNull($event->payment->paymentOutput); + $this->assertNotNull($event->payment->paymentOutput->amountOfMoney); + $this->assertEquals(1000, $event->payment->paymentOutput->amountOfMoney->amount); + $this->assertEquals('EUR', $event->payment->paymentOutput->amountOfMoney->currencyCode); + $this->assertNotNull($event->payment->paymentOutput->references); + $this->assertEquals('200001681810', $event->payment->paymentOutput->references->paymentReference); + $this->assertEquals('bankTransfer', $event->payment->paymentOutput->paymentMethod); + + $this->assertNull($event->payment->paymentOutput->cardPaymentMethodSpecificOutput); + $this->assertNull($event->payment->paymentOutput->cashPaymentMethodSpecificOutput); + $this->assertNull($event->payment->paymentOutput->directDebitPaymentMethodSpecificOutput); + $this->assertNull($event->payment->paymentOutput->invoicePaymentMethodSpecificOutput); + $this->assertNull($event->payment->paymentOutput->redirectPaymentMethodSpecificOutput); + $this->assertNull($event->payment->paymentOutput->sepaDirectDebitPaymentMethodSpecificOutput); + $this->assertNotNull($event->payment->paymentOutput->bankTransferPaymentMethodSpecificOutput); + $this->assertEquals(11, $event->payment->paymentOutput->bankTransferPaymentMethodSpecificOutput->paymentProductId); + + $this->assertEquals('PAID', $event->payment->status); + $this->assertNotNull($event->payment->statusOutput); + $this->assertEquals(false, $event->payment->statusOutput->isCancellable); + $this->assertEquals('COMPLETED', $event->payment->statusOutput->statusCategory); + $this->assertEquals(1000, $event->payment->statusOutput->statusCode); + $this->assertEquals('20170202112414', $event->payment->statusOutput->statusCodeChangeDateTime); + $this->assertEquals(true, $event->payment->statusOutput->isAuthorized); + } + + function testUnmarshalBytesInvalidBody() + { + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => self::SECRET_KEY)); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + try { + $helper->unmarshal($this->invalidBody, $requestHeaders); + } catch (SignatureValidationException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + function testUnmarshalBytesInvalidSecretKey() + { + $invalidSecretKey = '1' . self::SECRET_KEY; + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => $invalidSecretKey)); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + try { + $helper->unmarshal($this->validBody, $requestHeaders); + } catch (SignatureValidationException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + function testUnmarshalBytesInvalidSignature() + { + $secretKeyStore = new InMemorySecretKeyStore(array(self::KEY_ID => self::SECRET_KEY)); + $helper = $this->createHelper($secretKeyStore); + + $requestHeaders = array(self::SIGNATURE_HEADER => '1' . self::SIGNATURE, self::KEY_ID_HEADER => self::KEY_ID); + try { + $helper->unmarshal($this->validBody, $requestHeaders); + } catch (SignatureValidationException $e) { + return; + } + $this->fail('an expected exception has not been raised'); + } + + /** + * @param SecretKeyStore $secretKeyStore + * @return WebhooksHelper + */ + protected function createHelper($secretKeyStore) + { + return new WebhooksHelper($secretKeyStore); + } +} + +class ApiVersionMismatchTestingWebhooksHelper extends WebhooksHelper +{ + protected function getResponseFactory() + { + return new ApiVersionMismatchTestingResponseFactory(); + } +} + +class ApiVersionMismatchTestingResponseFactory extends ResponseFactory +{ + public function createResponse( + ConnectionResponse $response, + ResponseClassMap $responseClassMap + ) { + /** @var WebhooksEvent $event */ + $event = parent::createResponse($response, $responseClassMap); + $event->apiVersion = 'v0'; + return $event; + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..a9a95fb --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,3 @@ +