From ebab8466fddb5665663b58c188d6ce369d210728 Mon Sep 17 00:00:00 2001 From: Ingenico ePayments Date: Mon, 16 Oct 2023 13:32:03 +0200 Subject: [PATCH] Release 6.43.0. --- .../Connect/Sdk/RequestHeaderGenerator.php | 2 +- .../Hostedcheckout/Definitions/Frequency.php | 57 ++++++++++ .../HostedCheckoutSpecificInput.php | 15 +++ .../Definitions/RecurringPaymentsData.php | 65 +++++++++++ .../Definitions/TrialInformation.php | 103 ++++++++++++++++++ .../Definitions/TrialPeriod.php | 57 ++++++++++ .../Definitions/InstallmentDisplayHints.php | 68 ++++++++++++ .../Definitions/InstallmentOptions.php | 85 +++++++++++++++ .../Installments/GetInstallmentRequest.php | 84 ++++++++++++++ .../InstallmentOptionsResponse.php | 59 ++++++++++ .../Payment/Definitions/Installments.php | 15 +++ src/Ingenico/Connect/Sdk/Merchant.php | 11 ++ .../Connect/Sdk/Merchant/Installments.php | 55 ++++++++++ 13 files changed, 675 insertions(+), 1 deletion(-) create mode 100644 src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/Frequency.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/RecurringPaymentsData.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialInformation.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialPeriod.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentDisplayHints.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentOptions.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Installments/GetInstallmentRequest.php create mode 100644 src/Ingenico/Connect/Sdk/Domain/Installments/InstallmentOptionsResponse.php create mode 100644 src/Ingenico/Connect/Sdk/Merchant/Installments.php diff --git a/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php b/lib/Ingenico/Connect/Sdk/RequestHeaderGenerator.php index c41f2577..569806fc 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.42.0'; + const SDK_VERSION = '6.43.0'; const AUTHORIZATION_ID = 'GCS'; diff --git a/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/Frequency.php b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/Frequency.php new file mode 100644 index 00000000..4567d0ad --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/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/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/HostedCheckoutSpecificInput.php b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/HostedCheckoutSpecificInput.php index 74a168db..41da4a6a 100644 --- a/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/HostedCheckoutSpecificInput.php +++ b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/HostedCheckoutSpecificInput.php @@ -28,6 +28,11 @@ class HostedCheckoutSpecificInput extends DataObject */ public $paymentProductFilters = null; + /** + * @var RecurringPaymentsData + */ + public $recurringPaymentsData = null; + /** * @var bool */ @@ -73,6 +78,9 @@ public function toObject() 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; } @@ -115,6 +123,13 @@ public function fromObject($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; } diff --git a/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/RecurringPaymentsData.php b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/RecurringPaymentsData.php new file mode 100644 index 00000000..32ed7577 --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/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/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialInformation.php b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialInformation.php new file mode 100644 index 00000000..f75003ac --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialInformation.php @@ -0,0 +1,103 @@ +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/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialPeriod.php b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/TrialPeriod.php new file mode 100644 index 00000000..327529e0 --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Hostedcheckout/Definitions/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/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentDisplayHints.php b/src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentDisplayHints.php new file mode 100644 index 00000000..4cc9ab38 --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/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/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentOptions.php b/src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentOptions.php new file mode 100644 index 00000000..4dc69644 --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Installments/Definitions/InstallmentOptions.php @@ -0,0 +1,85 @@ +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/Ingenico/Connect/Sdk/Domain/Installments/GetInstallmentRequest.php b/src/Ingenico/Connect/Sdk/Domain/Installments/GetInstallmentRequest.php new file mode 100644 index 00000000..9d69b0dc --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Installments/GetInstallmentRequest.php @@ -0,0 +1,84 @@ +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/Ingenico/Connect/Sdk/Domain/Installments/InstallmentOptionsResponse.php b/src/Ingenico/Connect/Sdk/Domain/Installments/InstallmentOptionsResponse.php new file mode 100644 index 00000000..9a576ffa --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Domain/Installments/InstallmentOptionsResponse.php @@ -0,0 +1,59 @@ +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/Ingenico/Connect/Sdk/Domain/Payment/Definitions/Installments.php b/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/Installments.php index 5539f6d0..ea62c544 100644 --- a/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/Installments.php +++ b/src/Ingenico/Connect/Sdk/Domain/Payment/Definitions/Installments.php @@ -19,6 +19,11 @@ class Installments extends DataObject */ public $amountOfMoneyPerInstallment = null; + /** + * @var AmountOfMoney + */ + public $amountOfMoneyTotal = null; + /** * @var string */ @@ -48,6 +53,9 @@ public function toObject() if (!is_null($this->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; } @@ -78,6 +86,13 @@ public function fromObject($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; } diff --git a/src/Ingenico/Connect/Sdk/Merchant.php b/src/Ingenico/Connect/Sdk/Merchant.php index f604b6b0..127bde84 100644 --- a/src/Ingenico/Connect/Sdk/Merchant.php +++ b/src/Ingenico/Connect/Sdk/Merchant.php @@ -10,6 +10,7 @@ use Ingenico\Connect\Sdk\Merchant\Files; use Ingenico\Connect\Sdk\Merchant\Hostedcheckouts; use Ingenico\Connect\Sdk\Merchant\Hostedmandatemanagements; +use Ingenico\Connect\Sdk\Merchant\Installments; use Ingenico\Connect\Sdk\Merchant\Mandates; use Ingenico\Connect\Sdk\Merchant\Payments; use Ingenico\Connect\Sdk\Merchant\Payouts; @@ -163,6 +164,16 @@ public function sessions() return new Sessions($this, $this->context); } + /** + * Resource /{merchantId}/installments + * + * @return Installments + */ + public function installments() + { + return new Installments($this, $this->context); + } + /** * Resource /{merchantId}/files * diff --git a/src/Ingenico/Connect/Sdk/Merchant/Installments.php b/src/Ingenico/Connect/Sdk/Merchant/Installments.php new file mode 100644 index 00000000..9adcde89 --- /dev/null +++ b/src/Ingenico/Connect/Sdk/Merchant/Installments.php @@ -0,0 +1,55 @@ +defaultSuccessResponseClassName = '\Ingenico\Connect\Sdk\Domain\Installments\InstallmentOptionsResponse'; + return $this->getCommunicator()->post( + $responseClassMap, + $this->instantiateUri('/v1/{merchantId}/installments/getInstallmentsInfo'), + $this->getClientMetaInfo(), + $body, + null, + $callContext + ); + } +}