diff --git a/Monei/model/payment_next_action.py b/Monei/model/payment_next_action.py index 4a46696..eab0c46 100644 --- a/Monei/model/payment_next_action.py +++ b/Monei/model/payment_next_action.py @@ -58,6 +58,7 @@ class PaymentNextAction(ModelNormal): "CHALLENGE": "CHALLENGE", "FRICTIONLESS_CHALLENGE": "FRICTIONLESS_CHALLENGE", "BIZUM_CHALLENGE": "BIZUM_CHALLENGE", + "INSTALLMENT_SELECT": "INSTALLMENT_SELECT", "COMPLETE": "COMPLETE", }, } @@ -150,7 +151,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - type (str): - `CONFIRM` - Your customer needs to be redirected to a [hosted payment page](https://docs.monei.com/integrations/use-prebuilt-payment-page/) or confirm payment using [payment token](https://docs.monei.com/integrations/build-custom-checkout/#3-confirm-the-payment-client-side). The **redirectUrl** will point to the hosted payment page. - `FRICTIONLESS_CHALLENGE` - Your customer needs to be redirected to the frictionless 3d secure challenge page provided by the bank. The **redirectUrl** will point to the frictionless 3d secure challenge page provided by the bank. - `CHALLENGE` - Your customer needs to be redirected to the 3d secure challenge page provided by the bank. The **redirectUrl** will point to the 3d secure challenge page provided by the bank. - `COMPLETE` - The payment is completed. The **redirectUrl** will be the **completeUrl** if it was provided when the payment was created. - `BIZUM_CHALLENGE` - Your customer will be redirected to the Bizum hosted payment page. . [optional] # noqa: E501 + type (str): - `CONFIRM` - Your customer needs to be redirected to a [hosted payment page](https://docs.monei.com/integrations/use-prebuilt-payment-page/) or confirm payment using [payment token](https://docs.monei.com/integrations/build-custom-checkout/#3-confirm-the-payment-client-side). The **redirectUrl** will point to the hosted payment page. - `FRICTIONLESS_CHALLENGE` - Your customer needs to be redirected to the frictionless 3d secure challenge page provided by the bank. The **redirectUrl** will point to the frictionless 3d secure challenge page provided by the bank. - `CHALLENGE` - Your customer needs to be redirected to the 3d secure challenge page provided by the bank. The **redirectUrl** will point to the 3d secure challenge page provided by the bank. - `COMPLETE` - The payment is completed. The **redirectUrl** will be the **completeUrl** if it was provided when the payment was created. - `BIZUM_CHALLENGE` - Your customer will be redirected to the Bizum hosted payment page. - `INSTALLMENT_SELECT` - Your customer needs to choose how to pay (in full or in installments with MONEI Flex) on the page at **redirectUrl**. . [optional] # noqa: E501 must_redirect (bool): If `true` you have to redirect your customer to the **redirectUrl** to continue payment process. . [optional] # noqa: E501 redirect_url (str): Redirect your customer to this url to continue payment process. . [optional] # noqa: E501 """ @@ -243,7 +244,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - type (str): - `CONFIRM` - Your customer needs to be redirected to a [hosted payment page](https://docs.monei.com/integrations/use-prebuilt-payment-page/) or confirm payment using [payment token](https://docs.monei.com/integrations/build-custom-checkout/#3-confirm-the-payment-client-side). The **redirectUrl** will point to the hosted payment page. - `FRICTIONLESS_CHALLENGE` - Your customer needs to be redirected to the frictionless 3d secure challenge page provided by the bank. The **redirectUrl** will point to the frictionless 3d secure challenge page provided by the bank. - `CHALLENGE` - Your customer needs to be redirected to the 3d secure challenge page provided by the bank. The **redirectUrl** will point to the 3d secure challenge page provided by the bank. - `COMPLETE` - The payment is completed. The **redirectUrl** will be the **completeUrl** if it was provided when the payment was created. - `BIZUM_CHALLENGE` - Your customer will be redirected to the Bizum hosted payment page. . [optional] # noqa: E501 + type (str): - `CONFIRM` - Your customer needs to be redirected to a [hosted payment page](https://docs.monei.com/integrations/use-prebuilt-payment-page/) or confirm payment using [payment token](https://docs.monei.com/integrations/build-custom-checkout/#3-confirm-the-payment-client-side). The **redirectUrl** will point to the hosted payment page. - `FRICTIONLESS_CHALLENGE` - Your customer needs to be redirected to the frictionless 3d secure challenge page provided by the bank. The **redirectUrl** will point to the frictionless 3d secure challenge page provided by the bank. - `CHALLENGE` - Your customer needs to be redirected to the 3d secure challenge page provided by the bank. The **redirectUrl** will point to the 3d secure challenge page provided by the bank. - `COMPLETE` - The payment is completed. The **redirectUrl** will be the **completeUrl** if it was provided when the payment was created. - `BIZUM_CHALLENGE` - Your customer will be redirected to the Bizum hosted payment page. - `INSTALLMENT_SELECT` - Your customer needs to choose how to pay (in full or in installments with MONEI Flex) on the page at **redirectUrl**. . [optional] # noqa: E501 must_redirect (bool): If `true` you have to redirect your customer to the **redirectUrl** to continue payment process. . [optional] # noqa: E501 redirect_url (str): Redirect your customer to this url to continue payment process. . [optional] # noqa: E501 """ diff --git a/test/test_payment_next_action.py b/test/test_payment_next_action.py index c28f826..351ecb5 100644 --- a/test/test_payment_next_action.py +++ b/test/test_payment_next_action.py @@ -7,10 +7,13 @@ Generated by: https://openapi-generator.tech """ +import json import sys import unittest +from unittest.mock import MagicMock import Monei +from Monei.model.payment import Payment from Monei.model.payment_next_action import PaymentNextAction @@ -29,6 +32,31 @@ def testPaymentNextAction(self): # model = PaymentNextAction() # noqa: E501 pass + def test_deserializes_installment_select_payment(self): + """A payment eligible for MONEI Flex comes back with INSTALLMENT_SELECT. + The enum check raised on it, so such a payment could not be read.""" + response = MagicMock() + response.data = json.dumps( + { + "id": "af6029f80f5fc73a8ad2753eea0b1be0", + "amount": 110, + "currency": "EUR", + "accountId": "aa9333ba-82de-400c-9ae7-087b9f8d2242", + "livemode": False, + "status": "PENDING", + "nextAction": { + "type": "INSTALLMENT_SELECT", + "redirectUrl": "https://secure.monei.com/payments/af6029f80f5fc73a8ad2753eea0b1be0/installments", + }, + } + ) + response.getheader.return_value = "application/json" + + payment = Monei.ApiClient().deserialize(response, (Payment,), True) + + self.assertEqual(payment.next_action.type, "INSTALLMENT_SELECT") + self.assertNotIn("must_redirect", payment.next_action) + if __name__ == "__main__": unittest.main()