From ef1ac4e2f9bec44a91bd1e3c03b35b7f13782b70 Mon Sep 17 00:00:00 2001 From: Ingenico ePayments Date: Tue, 16 Jan 2024 09:50:50 +0100 Subject: [PATCH] Release 6.46.0. --- lib/Ingenico/Connect/Sdk/Communicator.php | 72 ++++++++++++++---- .../Connect/Sdk/RequestHeaderGenerator.php | 2 +- .../Sdk/Webhooks/SignatureValidator.php | 76 +++++++++++++++++++ .../Connect/Sdk/Webhooks/WebhooksHelper.php | 53 +++---------- src/Ingenico/Connect/Sdk/Client.php | 2 +- .../Sdk/Domain/Capture/CaptureResponse.php | 2 +- .../Sdk/Domain/Capture/CapturesResponse.php | 2 +- .../Domain/Capture/Definitions/Capture.php | 2 +- .../Capture/Definitions/CaptureOutput.php | 2 +- .../Definitions/CaptureStatusOutput.php | 2 +- .../Definitions/AbstractOrderStatus.php | 2 +- .../AbstractPaymentMethodSpecificInput.php | 2 +- .../AdditionalOrderInputAirlineData.php | 2 +- .../Sdk/Domain/Definitions/Address.php | 2 +- .../Sdk/Domain/Definitions/AirlineData.php | 2 +- .../Domain/Definitions/AirlineFlightLeg.php | 2 +- .../Domain/Definitions/AirlinePassenger.php | 2 +- .../Sdk/Domain/Definitions/AmountOfMoney.php | 2 +- .../Sdk/Domain/Definitions/BankAccount.php | 2 +- .../Domain/Definitions/BankAccountBban.php | 2 +- .../Domain/Definitions/BankAccountIban.php | 2 +- .../Connect/Sdk/Domain/Definitions/Card.php | 2 +- .../Sdk/Domain/Definitions/CardEssentials.php | 2 +- .../Domain/Definitions/CardFraudResults.php | 2 +- .../Sdk/Domain/Definitions/CardWithoutCvv.php | 2 +- .../Domain/Definitions/CompanyInformation.php | 2 +- .../Domain/Definitions/ContactDetailsBase.php | 2 +- .../Sdk/Domain/Definitions/CustomerBase.php | 2 +- .../Sdk/Domain/Definitions/FraudFields.php | 2 +- .../FraudFieldsShippingDetails.php | 2 +- .../Sdk/Domain/Definitions/FraudResults.php | 2 +- .../FraudResultsRetailDecisions.php | 2 +- .../Domain/Definitions/FraugsterResults.php | 2 +- .../Connect/Sdk/Domain/Definitions/InAuth.php | 2 +- .../Sdk/Domain/Definitions/KeyValuePair.php | 2 +- .../Sdk/Domain/Definitions/LodgingCharge.php | 2 +- .../Sdk/Domain/Definitions/LodgingData.php | 2 +- .../Sdk/Domain/Definitions/LodgingRoom.php | 2 +- .../Definitions/MicrosoftFraudResults.php | 2 +- .../Domain/Definitions/OrderStatusOutput.php | 2 +- .../Definitions/PaymentProductFilter.php | 2 +- .../Domain/Definitions/PersonalNameBase.php | 2 +- .../Domain/Definitions/RedirectDataBase.php | 2 +- .../Definitions/ResultDoRiskAssessment.php | 2 +- .../RetailDecisionsCCFraudCheckOutput.php | 2 +- .../ValidationBankAccountCheck.php | 2 +- .../ValidationBankAccountOutput.php | 2 +- .../Domain/Dispute/CreateDisputeRequest.php | 2 +- .../Domain/Dispute/Definitions/Dispute.php | 2 +- .../Definitions/DisputeCreationDetail.php | 2 +- .../Dispute/Definitions/DisputeOutput.php | 2 +- .../Dispute/Definitions/DisputeReference.php | 2 +- .../Definitions/DisputeStatusOutput.php | 2 +- .../Sdk/Domain/Dispute/DisputeResponse.php | 2 +- .../Sdk/Domain/Dispute/DisputesResponse.php | 2 +- .../Dispute/UploadDisputeFileResponse.php | 2 +- .../Domain/Errors/Definitions/APIError.php | 2 +- .../Sdk/Domain/Errors/ErrorResponse.php | 2 +- .../Domain/File/Definitions/HostedFile.php | 2 +- .../CreateHostedCheckoutRequest.php | 2 +- .../CreateHostedCheckoutResponse.php | 2 +- .../Definitions/CreatedPaymentOutput.php | 2 +- .../Definitions/DisplayedData.php | 2 +- .../Hostedcheckout/Definitions/Frequency.php | 2 +- .../HostedCheckoutSpecificInput.php | 2 +- ...ymentMethodSpecificInputHostedCheckout.php | 2 +- ...tProduct302SpecificInputHostedCheckout.php | 2 +- ...tProduct320SpecificInputHostedCheckout.php | 2 +- .../PaymentProductFiltersHostedCheckout.php | 2 +- .../Definitions/RecurringPaymentsData.php | 2 +- .../Definitions/TrialInformation.php | 2 +- .../Definitions/TrialPeriod.php | 2 +- .../GetHostedCheckoutResponse.php | 2 +- .../CreateHostedMandateManagementRequest.php | 2 +- .../CreateHostedMandateManagementResponse.php | 2 +- .../Definitions/HostedMandateInfo.php | 2 +- .../HostedMandateManagementSpecificInput.php | 2 +- .../GetHostedMandateManagementResponse.php | 2 +- .../Definitions/InstallmentDisplayHints.php | 2 +- .../Definitions/InstallmentOptions.php | 2 +- .../Installments/GetInstallmentRequest.php | 2 +- .../InstallmentOptionsResponse.php | 2 +- .../Domain/Mandates/CreateMandateRequest.php | 2 +- .../Domain/Mandates/CreateMandateResponse.php | 2 +- .../Definitions/CreateMandateBase.php | 2 +- .../CreateMandateWithReturnUrl.php | 2 +- .../Mandates/Definitions/MandateAddress.php | 2 +- .../Definitions/MandateContactDetails.php | 2 +- .../Mandates/Definitions/MandateCustomer.php | 2 +- .../Definitions/MandateMerchantAction.php | 2 +- .../MandatePersonalInformation.php | 2 +- .../Definitions/MandatePersonalName.php | 2 +- .../Definitions/MandateRedirectData.php | 2 +- .../Mandates/Definitions/MandateResponse.php | 2 +- .../Domain/Mandates/GetMandateResponse.php | 2 +- .../Domain/Payment/ApprovePaymentRequest.php | 2 +- .../Payment/CancelApprovalPaymentResponse.php | 2 +- .../Domain/Payment/CancelPaymentResponse.php | 2 +- .../Domain/Payment/CapturePaymentRequest.php | 2 +- .../Domain/Payment/CompletePaymentRequest.php | 2 +- .../Payment/CompletePaymentResponse.php | 2 +- .../Domain/Payment/CreatePaymentRequest.php | 2 +- .../Domain/Payment/CreatePaymentResponse.php | 2 +- ...BankTransferPaymentMethodSpecificInput.php | 2 +- ...AbstractCardPaymentMethodSpecificInput.php | 13 +++- ...AbstractCashPaymentMethodSpecificInput.php | 2 +- ...ractEInvoicePaymentMethodSpecificInput.php | 2 +- .../AbstractPaymentMethodSpecificOutput.php | 2 +- ...ractRedirectPaymentMethodSpecificInput.php | 2 +- ...edirectPaymentProduct4101SpecificInput.php | 2 +- ...RedirectPaymentProduct840SpecificInput.php | 2 +- ...aDirectDebitPaymentMethodSpecificInput.php | 2 +- ...ectDebitPaymentProduct771SpecificInput.php | 2 +- .../Definitions/AbstractThreeDSecure.php | 2 +- .../Definitions/AccountFundingRecipient.php | 2 +- .../Definitions/AdditionalOrderInput.php | 2 +- .../Payment/Definitions/AddressPersonal.php | 2 +- .../Domain/Payment/Definitions/AfrName.php | 2 +- .../Payment/Definitions/AmountBreakdown.php | 2 +- ...PaymentCardPaymentMethodSpecificOutput.php | 2 +- ...tDirectDebitPaymentMethodSpecificInput.php | 2 +- ...ymentMobilePaymentMethodSpecificOutput.php | 2 +- ...aDirectDebitPaymentMethodSpecificInput.php | 2 +- ...provePaymentPaymentMethodSpecificInput.php | 2 +- ...aDirectDebitPaymentMethodSpecificInput.php | 2 +- ...BankTransferPaymentMethodSpecificInput.php | 2 +- ...TransferPaymentMethodSpecificInputBase.php | 2 +- ...ankTransferPaymentMethodSpecificOutput.php | 2 +- .../Payment/Definitions/BrowserData.php | 2 +- ...PaymentCardPaymentMethodSpecificOutput.php | 2 +- ...ymentMobilePaymentMethodSpecificOutput.php | 2 +- .../CardPaymentMethodSpecificInput.php | 2 +- .../CardPaymentMethodSpecificInputBase.php | 2 +- .../CardPaymentMethodSpecificOutput.php | 2 +- .../Definitions/CardRecurrenceDetails.php | 2 +- .../CashPaymentMethodSpecificInput.php | 2 +- .../CashPaymentMethodSpecificInputBase.php | 2 +- .../CashPaymentMethodSpecificOutput.php | 2 +- .../CashPaymentProduct1503SpecificInput.php | 2 +- .../CashPaymentProduct1504SpecificInput.php | 2 +- .../CashPaymentProduct1521SpecificInput.php | 2 +- .../CashPaymentProduct1522SpecificInput.php | 2 +- .../CashPaymentProduct1523SpecificInput.php | 2 +- .../CashPaymentProduct1524SpecificInput.php | 2 +- .../CashPaymentProduct1526SpecificInput.php | 2 +- ...ntProductWithRedirectSpecificInputBase.php | 2 +- ...ePaymentCardPaymentMethodSpecificInput.php | 2 +- .../Payment/Definitions/ContactDetails.php | 2 +- .../Definitions/CreatePaymentResult.php | 2 +- .../Domain/Payment/Definitions/Customer.php | 2 +- .../Payment/Definitions/CustomerAccount.php | 2 +- .../CustomerAccountAuthentication.php | 2 +- .../Definitions/CustomerApprovePayment.php | 2 +- .../Payment/Definitions/CustomerDevice.php | 2 +- .../Definitions/CustomerPaymentActivity.php | 2 +- .../Definitions/DecryptedPaymentData.php | 2 +- .../Definitions/DeviceRenderOptions.php | 2 +- .../EInvoicePaymentMethodSpecificInput.php | 2 +- ...EInvoicePaymentMethodSpecificInputBase.php | 2 +- .../EInvoicePaymentMethodSpecificOutput.php | 2 +- ...InvoicePaymentProduct9000SpecificInput.php | 2 +- ...nvoicePaymentProduct9000SpecificOutput.php | 2 +- .../Payment/Definitions/ExemptionOutput.php | 2 +- .../ExternalCardholderAuthenticationData.php | 2 +- .../Payment/Definitions/GPayThreeDSecure.php | 2 +- .../Payment/Definitions/GiftCardPurchase.php | 2 +- .../HostedCheckoutSpecificOutput.php | 2 +- .../Payment/Definitions/Installments.php | 2 +- .../InvoicePaymentMethodSpecificInput.php | 2 +- .../InvoicePaymentMethodSpecificOutput.php | 2 +- .../Payment/Definitions/Level3SummaryData.php | 2 +- .../Domain/Payment/Definitions/LineItem.php | 2 +- .../Definitions/LineItemInvoiceData.php | 2 +- .../LineItemLevel3InterchangeInformation.php | 2 +- .../Payment/Definitions/LoanRecipient.php | 2 +- .../Domain/Payment/Definitions/Merchant.php | 2 +- .../Payment/Definitions/MerchantAction.php | 2 +- .../Payment/Definitions/MobilePaymentData.php | 2 +- .../MobilePaymentMethodSpecificInput.php | 2 +- .../MobilePaymentMethodSpecificOutput.php | 2 +- .../MobilePaymentProduct320SpecificInput.php | 2 +- .../MobileThreeDSecureChallengeParameters.php | 2 +- ...aDirectDebitPaymentMethodSpecificInput.php | 2 +- ...DirectDebitPaymentMethodSpecificOutput.php | 2 +- ...ectDebitPaymentProduct705SpecificInput.php | 2 +- ...ectDebitPaymentProduct730SpecificInput.php | 2 +- .../Sdk/Domain/Payment/Definitions/Order.php | 2 +- .../Definitions/OrderApprovePayment.php | 2 +- .../Payment/Definitions/OrderInvoiceData.php | 2 +- .../Payment/Definitions/OrderLineDetails.php | 2 +- .../Payment/Definitions/OrderOutput.php | 2 +- .../Payment/Definitions/OrderReferences.php | 2 +- .../OrderReferencesApprovePayment.php | 2 +- .../Definitions/OrderTypeInformation.php | 2 +- .../Domain/Payment/Definitions/Payment.php | 2 +- .../Definitions/PaymentAccountOnFile.php | 2 +- .../Definitions/PaymentCreationOutput.php | 2 +- .../Definitions/PaymentCreationReferences.php | 2 +- .../Payment/Definitions/PaymentOutput.php | 2 +- .../PaymentProduct3201SpecificOutput.php | 2 +- .../PaymentProduct771SpecificOutput.php | 2 +- .../PaymentProduct806SpecificOutput.php | 2 +- .../PaymentProduct836SpecificOutput.php | 2 +- .../PaymentProduct840CustomerAccount.php | 2 +- .../PaymentProduct840SpecificOutput.php | 2 +- .../PaymentProduct863ThirdPartyData.php | 2 +- .../Payment/Definitions/PaymentReferences.php | 2 +- .../Definitions/PaymentStatusOutput.php | 2 +- .../Definitions/PersonalIdentification.php | 2 +- .../Definitions/PersonalInformation.php | 2 +- .../Payment/Definitions/PersonalName.php | 2 +- .../Definitions/ProtectionEligibility.php | 2 +- .../Payment/Definitions/RedirectData.php | 2 +- .../RedirectPaymentMethodSpecificInput.php | 2 +- ...RedirectPaymentMethodSpecificInputBase.php | 2 +- .../RedirectPaymentMethodSpecificOutput.php | 2 +- ...edirectPaymentProduct4101SpecificInput.php | 2 +- ...ectPaymentProduct4101SpecificInputBase.php | 2 +- ...RedirectPaymentProduct809SpecificInput.php | 2 +- ...RedirectPaymentProduct816SpecificInput.php | 2 +- ...RedirectPaymentProduct840SpecificInput.php | 2 +- ...rectPaymentProduct840SpecificInputBase.php | 2 +- ...RedirectPaymentProduct861SpecificInput.php | 2 +- ...RedirectPaymentProduct863SpecificInput.php | 2 +- ...RedirectPaymentProduct869SpecificInput.php | 2 +- ...RedirectPaymentProduct882SpecificInput.php | 2 +- .../Payment/Definitions/RedirectionData.php | 2 +- .../RefundBankMethodSpecificOutput.php | 2 +- .../RefundCardMethodSpecificOutput.php | 2 +- .../RefundCashMethodSpecificOutput.php | 2 +- .../RefundEInvoiceMethodSpecificOutput.php | 2 +- .../RefundEWalletMethodSpecificOutput.php | 2 +- .../RefundMethodSpecificOutput.php | 2 +- .../RefundMobileMethodSpecificOutput.php | 2 +- .../Payment/Definitions/RefundOutput.php | 2 +- ...RefundPaymentProduct840CustomerAccount.php | 2 +- .../RefundPaymentProduct840SpecificOutput.php | 2 +- .../Payment/Definitions/SchemeTokenData.php | 2 +- .../Payment/Definitions/SdkDataInput.php | 2 +- .../Payment/Definitions/SdkDataOutput.php | 2 +- .../Sdk/Domain/Payment/Definitions/Seller.php | 2 +- ...aDirectDebitPaymentMethodSpecificInput.php | 2 +- ...ectDebitPaymentMethodSpecificInputBase.php | 2 +- ...DirectDebitPaymentMethodSpecificOutput.php | 2 +- ...ectDebitPaymentProduct771SpecificInput.php | 2 +- ...ebitPaymentProduct771SpecificInputBase.php | 2 +- .../Domain/Payment/Definitions/Shipping.php | 2 +- .../Payment/Definitions/ShoppingCart.php | 2 +- .../Payment/Definitions/ThirdPartyData.php | 2 +- .../Payment/Definitions/ThreeDSecure.php | 2 +- .../Payment/Definitions/ThreeDSecureBase.php | 2 +- .../Payment/Definitions/ThreeDSecureData.php | 2 +- .../Definitions/ThreeDSecureResults.php | 2 +- .../Definitions/TrustlyBankAccount.php | 2 +- .../Payment/DeviceFingerprintDetails.php | 2 +- .../Domain/Payment/FindPaymentsResponse.php | 2 +- .../Payment/PaymentApprovalResponse.php | 2 +- .../Domain/Payment/PaymentErrorResponse.php | 2 +- .../Sdk/Domain/Payment/PaymentResponse.php | 2 +- .../Payment/ThirdPartyStatusResponse.php | 2 +- .../Domain/Payment/TokenizePaymentRequest.php | 2 +- .../Domain/Payout/ApprovePayoutRequest.php | 2 +- .../Sdk/Domain/Payout/CreatePayoutRequest.php | 2 +- .../AbstractPayoutMethodSpecificInput.php | 2 +- .../BankTransferPayoutMethodSpecificInput.php | 2 +- .../CardPayoutMethodSpecificInput.php | 2 +- .../Payout/Definitions/PayoutCustomer.php | 2 +- .../Payout/Definitions/PayoutDetails.php | 2 +- .../Payout/Definitions/PayoutMerchant.php | 2 +- .../Payout/Definitions/PayoutRecipient.php | 2 +- .../Payout/Definitions/PayoutReferences.php | 2 +- .../Payout/Definitions/PayoutResult.php | 2 +- .../Sdk/Domain/Payout/FindPayoutsResponse.php | 2 +- .../Sdk/Domain/Payout/PayoutErrorResponse.php | 2 +- .../Sdk/Domain/Payout/PayoutResponse.php | 2 +- .../CreatePaymentProductSessionRequest.php | 2 +- .../CreatePaymentProductSessionResponse.php | 2 +- .../Product/Definitions/AbstractIndicator.php | 2 +- .../Product/Definitions/AccountOnFile.php | 2 +- .../Definitions/AccountOnFileAttribute.php | 2 +- .../Definitions/AccountOnFileDisplayHints.php | 2 +- .../Definitions/AuthenticationIndicator.php | 2 +- .../BoletoBancarioRequirednessValidator.php | 2 +- .../Product/Definitions/DirectoryEntry.php | 2 +- .../Product/Definitions/EmptyValidator.php | 2 +- .../Definitions/FixedListValidator.php | 2 +- .../Definitions/LabelTemplateElement.php | 2 +- .../Product/Definitions/LengthValidator.php | 2 +- ...ePaymentProductSession302SpecificInput.php | 2 +- ...PaymentProductSession302SpecificOutput.php | 2 +- .../Product/Definitions/PaymentProduct.php | 2 +- .../PaymentProduct302SpecificData.php | 2 +- .../PaymentProduct320SpecificData.php | 2 +- .../PaymentProduct863SpecificData.php | 2 +- .../PaymentProductDisplayHints.php | 2 +- .../Definitions/PaymentProductField.php | 2 +- .../PaymentProductFieldDataRestrictions.php | 2 +- .../PaymentProductFieldDisplayElement.php | 2 +- .../PaymentProductFieldDisplayHints.php | 2 +- .../PaymentProductFieldFormElement.php | 2 +- .../PaymentProductFieldTooltip.php | 2 +- .../PaymentProductFieldValidators.php | 2 +- .../Definitions/PaymentProductGroup.php | 2 +- .../Product/Definitions/RangeValidator.php | 2 +- .../RegularExpressionValidator.php | 2 +- .../Definitions/ValueMappingElement.php | 2 +- .../Product/DeviceFingerprintRequest.php | 2 +- .../Product/DeviceFingerprintResponse.php | 2 +- .../Connect/Sdk/Domain/Product/Directory.php | 2 +- .../Product/GetCustomerDetailsRequest.php | 2 +- .../Product/GetCustomerDetailsResponse.php | 2 +- .../Product/PaymentProductGroupResponse.php | 2 +- .../Domain/Product/PaymentProductGroups.php | 2 +- .../PaymentProductNetworksResponse.php | 2 +- .../Domain/Product/PaymentProductResponse.php | 2 +- .../Sdk/Domain/Product/PaymentProducts.php | 2 +- .../Domain/Refund/ApproveRefundRequest.php | 2 +- .../Definitions/BankAccountBbanRefund.php | 2 +- .../BankRefundMethodSpecificInput.php | 2 +- .../Refund/Definitions/RefundCustomer.php | 2 +- .../Refund/Definitions/RefundReferences.php | 2 +- .../Refund/Definitions/RefundResult.php | 2 +- .../Sdk/Domain/Refund/FindRefundsResponse.php | 2 +- .../Sdk/Domain/Refund/RefundErrorResponse.php | 2 +- .../Sdk/Domain/Refund/RefundRequest.php | 2 +- .../Sdk/Domain/Refund/RefundResponse.php | 2 +- .../Sdk/Domain/Refund/RefundsResponse.php | 2 +- .../ContactDetailsRiskAssessment.php | 2 +- .../CustomerAccountRiskAssessment.php | 2 +- .../CustomerDeviceRiskAssessment.php | 2 +- .../Definitions/CustomerRiskAssessment.php | 2 +- .../Definitions/MerchantRiskAssessment.php | 2 +- .../Definitions/OrderRiskAssessment.php | 2 +- .../PersonalInformationRiskAssessment.php | 2 +- .../PersonalNameRiskAssessment.php | 2 +- .../Definitions/RiskAssessment.php | 2 +- .../Definitions/ShippingRiskAssessment.php | 2 +- .../RiskAssessmentBankAccount.php | 2 +- .../Riskassessments/RiskAssessmentCard.php | 2 +- .../RiskAssessmentResponse.php | 2 +- .../Domain/Services/BankDetailsRequest.php | 2 +- .../Domain/Services/BankDetailsResponse.php | 2 +- .../Sdk/Domain/Services/ConvertAmount.php | 2 +- .../Domain/Services/Definitions/BankData.php | 2 +- .../Services/Definitions/BankDetails.php | 2 +- .../Domain/Services/Definitions/IINDetail.php | 2 +- .../Services/Definitions/PaymentContext.php | 2 +- .../Sdk/Domain/Services/Definitions/Swift.php | 2 +- .../Domain/Services/GetIINDetailsRequest.php | 2 +- .../Domain/Services/GetIINDetailsResponse.php | 2 +- .../Services/GetPrivacyPolicyResponse.php | 2 +- .../Sdk/Domain/Services/TestConnection.php | 2 +- .../PaymentProductFiltersClientSession.php | 2 +- .../Sdk/Domain/Sessions/SessionRequest.php | 2 +- .../Sdk/Domain/Sessions/SessionResponse.php | 2 +- .../Sdk/Domain/Token/ApproveTokenRequest.php | 2 +- .../Sdk/Domain/Token/CreateTokenRequest.php | 2 +- .../Sdk/Domain/Token/CreateTokenResponse.php | 2 +- .../Token/Definitions/AbstractToken.php | 2 +- .../Token/Definitions/ContactDetailsToken.php | 2 +- .../Sdk/Domain/Token/Definitions/Creditor.php | 2 +- .../Token/Definitions/CustomerToken.php | 2 +- .../CustomerTokenWithContactDetails.php | 2 +- .../Sdk/Domain/Token/Definitions/Debtor.php | 2 +- .../Token/Definitions/MandateApproval.php | 2 +- .../Definitions/MandateNonSepaDirectDebit.php | 2 +- .../Definitions/MandateSepaDirectDebit.php | 2 +- .../MandateSepaDirectDebitWithMandateId.php | 2 +- .../MandateSepaDirectDebitWithoutCreditor.php | 2 +- .../Definitions/PersonalInformationToken.php | 2 +- .../Token/Definitions/PersonalNameToken.php | 2 +- .../Domain/Token/Definitions/TokenCard.php | 2 +- .../Token/Definitions/TokenCardData.php | 2 +- .../Domain/Token/Definitions/TokenEWallet.php | 2 +- .../Token/Definitions/TokenEWalletData.php | 2 +- .../Definitions/TokenNonSepaDirectDebit.php | 2 +- ...rectDebitPaymentProduct705SpecificData.php | 2 +- ...rectDebitPaymentProduct730SpecificData.php | 2 +- .../Definitions/TokenSepaDirectDebit.php | 2 +- .../TokenSepaDirectDebitWithoutCreditor.php | 2 +- .../Sdk/Domain/Token/TokenResponse.php | 2 +- .../Sdk/Domain/Token/UpdateTokenRequest.php | 2 +- src/Ingenico/Connect/Sdk/Merchant.php | 2 +- .../Connect/Sdk/Merchant/Captures.php | 2 +- .../Connect/Sdk/Merchant/Disputes.php | 2 +- .../Merchant/Disputes/UploadFileRequest.php | 2 +- src/Ingenico/Connect/Sdk/Merchant/Files.php | 2 +- .../Connect/Sdk/Merchant/Hostedcheckouts.php | 2 +- .../Sdk/Merchant/Hostedmandatemanagements.php | 2 +- .../Connect/Sdk/Merchant/Installments.php | 6 +- .../Connect/Sdk/Merchant/Mandates.php | 2 +- .../Connect/Sdk/Merchant/Payments.php | 2 +- .../Merchant/Payments/FindPaymentsParams.php | 2 +- src/Ingenico/Connect/Sdk/Merchant/Payouts.php | 2 +- .../Merchant/Payouts/FindPayoutsParams.php | 2 +- .../Connect/Sdk/Merchant/Productgroups.php | 2 +- .../Productgroups/FindProductgroupsParams.php | 2 +- .../Productgroups/GetProductgroupParams.php | 2 +- .../Connect/Sdk/Merchant/Products.php | 2 +- .../Sdk/Merchant/Products/DirectoryParams.php | 2 +- .../Merchant/Products/FindProductsParams.php | 2 +- .../Merchant/Products/GetProductParams.php | 2 +- .../Sdk/Merchant/Products/NetworksParams.php | 2 +- src/Ingenico/Connect/Sdk/Merchant/Refunds.php | 2 +- .../Merchant/Refunds/FindRefundsParams.php | 2 +- .../Connect/Sdk/Merchant/Riskassessments.php | 2 +- .../Connect/Sdk/Merchant/Services.php | 2 +- .../Merchant/Services/ConvertAmountParams.php | 2 +- .../Merchant/Services/PrivacypolicyParams.php | 2 +- .../Connect/Sdk/Merchant/Sessions.php | 2 +- src/Ingenico/Connect/Sdk/Merchant/Tokens.php | 2 +- .../Sdk/Merchant/Tokens/DeleteTokenParams.php | 2 +- 412 files changed, 563 insertions(+), 471 deletions(-) create mode 100644 lib/Ingenico/Connect/Sdk/Webhooks/SignatureValidator.php diff --git a/lib/Ingenico/Connect/Sdk/Communicator.php b/lib/Ingenico/Connect/Sdk/Communicator.php index e6a58c7f..c2ec289e 100644 --- a/lib/Ingenico/Connect/Sdk/Communicator.php +++ b/lib/Ingenico/Connect/Sdk/Communicator.php @@ -59,6 +59,7 @@ public function disableLogging() * @param string $clientMetaInfo * @param RequestObject|null $requestParameters * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @return DataObject * @throws Exception */ @@ -67,7 +68,8 @@ public function get( $relativeUriPath, $clientMetaInfo = '', RequestObject $requestParameters = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -93,7 +95,10 @@ public function get( $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); $httpStatusCode = $connectionResponse->getHttpStatusCode(); if ($httpStatusCode >= 400) { - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } return $response; } @@ -105,6 +110,7 @@ public function get( * @param RequestObject|null $requestParameters * @param callable $bodyHandler Callable accepting a response body chunk and the response headers * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @throws Exception */ public function getWithBinaryResponse( @@ -113,7 +119,8 @@ public function getWithBinaryResponse( $clientMetaInfo = '', RequestObject $requestParameters = null, callable $bodyHandler = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -143,7 +150,10 @@ public function getWithBinaryResponse( if ($httpStatusCode >= 400) { $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } } @@ -153,6 +163,7 @@ public function getWithBinaryResponse( * @param string $clientMetaInfo * @param RequestObject|null $requestParameters * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @return DataObject * @throws Exception */ @@ -161,7 +172,8 @@ public function delete( $relativeUriPath, $clientMetaInfo = '', RequestObject $requestParameters = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -187,7 +199,10 @@ public function delete( $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); $httpStatusCode = $connectionResponse->getHttpStatusCode(); if ($httpStatusCode >= 400) { - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } return $response; } @@ -199,6 +214,7 @@ public function delete( * @param RequestObject|null $requestParameters * @param callable $bodyHandler Callable accepting a response body chunk and the response headers * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @throws Exception */ public function deleteWithBinaryResponse( @@ -207,7 +223,8 @@ public function deleteWithBinaryResponse( $clientMetaInfo = '', RequestObject $requestParameters = null, callable $bodyHandler = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -237,7 +254,10 @@ public function deleteWithBinaryResponse( if ($httpStatusCode >= 400) { $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } } @@ -248,6 +268,7 @@ public function deleteWithBinaryResponse( * @param DataObject|MultipartDataObject|null $requestBodyObject * @param RequestObject|null $requestParameters * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @return DataObject * @throws Exception */ @@ -257,7 +278,8 @@ public function post( $clientMetaInfo = '', $requestBodyObject = null, RequestObject $requestParameters = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -297,7 +319,10 @@ public function post( $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); $httpStatusCode = $connectionResponse->getHttpStatusCode(); if ($httpStatusCode >= 400) { - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } return $response; } @@ -310,6 +335,7 @@ public function post( * @param RequestObject|null $requestParameters * @param callable $bodyHandler Callable accepting a response body chunk and the response headers * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @throws Exception */ public function postWithBinaryResponse( @@ -319,7 +345,8 @@ public function postWithBinaryResponse( $requestBodyObject = null, RequestObject $requestParameters = null, callable $bodyHandler = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -363,7 +390,10 @@ public function postWithBinaryResponse( if ($httpStatusCode >= 400) { $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } } @@ -374,6 +404,7 @@ public function postWithBinaryResponse( * @param DataObject|MultipartDataObject|null $requestBodyObject * @param RequestObject|null $requestParameters * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @return DataObject * @throws Exception */ @@ -383,7 +414,8 @@ public function put( $clientMetaInfo = '', $requestBodyObject = null, RequestObject $requestParameters = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -423,7 +455,10 @@ public function put( $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); $httpStatusCode = $connectionResponse->getHttpStatusCode(); if ($httpStatusCode >= 400) { - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } return $response; } @@ -436,6 +471,7 @@ public function put( * @param RequestObject|null $requestParameters * @param callable $bodyHandler Callable accepting a response body chunk and the response headers * @param CallContext $callContext + * @param ResponseExceptionFactory|null $responseExceptionFactory * @throws Exception */ public function putWithBinaryResponse( @@ -445,7 +481,8 @@ public function putWithBinaryResponse( $requestBodyObject = null, RequestObject $requestParameters = null, callable $bodyHandler = null, - CallContext $callContext = null + CallContext $callContext = null, + ResponseExceptionFactory $responseExceptionFactory = null ) { $relativeUriPathWithRequestParameters = $this->getRelativeUriPathWithRequestParameters($relativeUriPath, $requestParameters); @@ -489,7 +526,10 @@ public function putWithBinaryResponse( if ($httpStatusCode >= 400) { $response = $this->getResponseFactory()->createResponse($connectionResponse, $responseClassMap); - throw $this->getResponseExceptionFactory()->createException($httpStatusCode, $response, $callContext); + if (is_null($responseExceptionFactory)) { + $responseExceptionFactory = $this->getResponseExceptionFactory(); + } + throw $responseExceptionFactory->createException($httpStatusCode, $response, $callContext); } } diff --git a/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php b/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php index 1f60d281..5aa93a6d 100644 --- a/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php +++ b/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php @@ -11,7 +11,7 @@ */ class RequestHeaderGenerator { - const SDK_VERSION = '6.45.0'; + const SDK_VERSION = '6.46.0'; const AUTHORIZATION_ID = 'GCS'; diff --git a/lib/Ingenico/Connect/Sdk/Webhooks/SignatureValidator.php b/lib/Ingenico/Connect/Sdk/Webhooks/SignatureValidator.php new file mode 100644 index 00000000..06ea545e --- /dev/null +++ b/lib/Ingenico/Connect/Sdk/Webhooks/SignatureValidator.php @@ -0,0 +1,76 @@ +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/lib/Ingenico/Connect/Sdk/Webhooks/WebhooksHelper.php b/lib/Ingenico/Connect/Sdk/Webhooks/WebhooksHelper.php index fe612c96..1de7d54a 100644 --- a/lib/Ingenico/Connect/Sdk/Webhooks/WebhooksHelper.php +++ b/lib/Ingenico/Connect/Sdk/Webhooks/WebhooksHelper.php @@ -14,9 +14,15 @@ */ class WebhooksHelper { - /** @var SecretKeyStore */ + /** + * @var SecretKeyStore + * @deprecated Will be removed in a future version + */ protected $secretKeyStore; + /** @var SignatureValidator */ + private $signatureValidator; + /** @var ResponseFactory|null */ private $responseFactory = null; @@ -26,6 +32,7 @@ class WebhooksHelper public function __construct(SecretKeyStore $secretKeyStore) { $this->secretKeyStore = $secretKeyStore; + $this->signatureValidator = new SignatureValidator($secretKeyStore); } /** @return ResponseFactory */ @@ -67,39 +74,7 @@ public function unmarshal($body, $requestHeaders) */ protected function validate($body, $requestHeaders) { - $this->validateBody($body, $requestHeaders); - } - - // validation 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; - } - } + $this->signatureValidator->validate($body, $requestHeaders); } // general utility methods @@ -110,14 +85,4 @@ private function validateApiVersion($event) throw new ApiVersionMismatchException($event->apiVersion, Client::API_VERSION); } } - - 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/src/Ingenico/Connect/Sdk/Client.php b/src/Ingenico/Connect/Sdk/Client.php index ef2364ca..f7f54f71 100644 --- a/src/Ingenico/Connect/Sdk/Client.php +++ b/src/Ingenico/Connect/Sdk/Client.php @@ -1,7 +1,7 @@ acquirerPromotionCode)) { + $object->acquirerPromotionCode = $this->acquirerPromotionCode; + } if (!is_null($this->authorizationMode)) { $object->authorizationMode = $this->authorizationMode; } @@ -145,6 +153,9 @@ public function toObject() 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; } diff --git a/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/AbstractCashPaymentMethodSpecificInput.php b/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/AbstractCashPaymentMethodSpecificInput.php index db776d2b..80fa27b3 100644 --- a/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/AbstractCashPaymentMethodSpecificInput.php +++ b/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/AbstractCashPaymentMethodSpecificInput.php @@ -1,7 +1,7 @@