From 63ea01cc24a537983569ed3f2bb4241b3c11a0d1 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Thu, 14 Jan 2021 22:52:45 +0200 Subject: [PATCH 01/16] changed date to datetime and fixed tests --- mangopay/resources.py | 30 +++++++++++++++--------------- tests/test_transactions.py | 25 +++++++++++++------------ tests/test_utils.py | 2 +- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/mangopay/resources.py b/mangopay/resources.py index ab2a623..d9681c2 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -229,7 +229,7 @@ class Wallet(BaseModel): description = CharField(api_name='Description', required=True) currency = CharField(api_name='Currency', required=True) balance = MoneyField(api_name='Balance') - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') class Meta: verbose_name = 'wallet' @@ -272,14 +272,14 @@ class Transfer(BaseModel): fees = MoneyField(api_name='Fees', required=True) debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId') credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True) - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') credited_funds = MoneyField(api_name='CreditedFunds') status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') def get_refunds(self, *args, **kwargs): kwargs['id'] = self.id @@ -298,7 +298,7 @@ def __str__(self): @python_2_unicode_compatible class Card(BaseModel): - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') expiration_date = CharField(api_name='ExpirationDate') alias = CharField(api_name='Alias') card_provider = CharField(api_name='CardProvider') @@ -366,7 +366,7 @@ class CardRegistration(BaseModel): result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') status = CharField(api_name='Status', choices=constants.CARD_STATUS_CHOICES, default=None) - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') class Meta: verbose_name = 'cardregistration' @@ -438,7 +438,7 @@ class PayIn(BaseModel): status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None) nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None) payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None) @@ -484,7 +484,7 @@ class DirectPayIn(PayIn): secure_mode = CharField(api_name='SecureMode', choices=constants.SECURE_MODE_CHOICES, default=constants.SECURE_MODE_CHOICES.default) - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') statement_descriptor = CharField(api_name='StatementDescriptor') debited_funds = MoneyField(api_name='DebitedFunds', required=True) fees = MoneyField(api_name='Fees', required=True) @@ -684,7 +684,7 @@ class PreAuthorization(BaseModel): secure_mode_needed = BooleanField(api_name='SecureModeNeeded') secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL') secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True) - expiration_date = DateField(api_name='ExpirationDate') + expiration_date = DateTimeField(api_name='ExpirationDate') payin = ForeignKeyField(PayIn, api_name='PayInId') billing = BillingField(api_name='Billing') security_info = SecurityInfoField(api_name='SecurityInfo') @@ -739,7 +739,7 @@ class BankAccount(BaseModel): user = ForeignKeyField(User, api_name='UserId', related_name='bankaccounts') owner_name = CharField(api_name='OwnerName', required=True) owner_address = AddressField(api_name='OwnerAddress', required=True) - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') type = CharField(api_name='Type', choices=constants.BANK_ACCOUNT_TYPE_CHOICES, default=None, required=True) iban = CharField(api_name='IBAN') bic = CharField(api_name='BIC') @@ -803,14 +803,14 @@ class BankWirePayOut(BaseModel): status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None) nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None) payment_type = CharField(api_name='PaymentType', choices=constants.PAYOUT_PAYMENT_TYPE, default=None) execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None) bank_wire_ref = CharField(api_name='BankWireRef') credited_user = ForeignKeyField(User, api_name='CreditedUserId') - creation_date = DateField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') def get_refunds(self, *args, **kwargs): kwargs['id'] = self.id @@ -846,7 +846,7 @@ class Refund(BaseModel): status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None) nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None) debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId') @@ -957,7 +957,7 @@ class Transaction(BaseModel): status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None) nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None) credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId') @@ -1232,7 +1232,7 @@ class Repudiation(BaseModel): credited_user = ForeignKeyField(User, api_name='CreditedUserId') nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None) status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None) - execution_date = DateField(api_name='ExecutionDate') + execution_date = DateTimeField(api_name='ExecutionDate') result_code = CharField(api_name='ResultCode') result_message = CharField(api_name='ResultMessage') @@ -1451,7 +1451,7 @@ class Meta: class UboDeclaration(BaseModel): - creation_date = IntegerField(api_name='CreationDate') + creation_date = DateTimeField(api_name='CreationDate') processed_date = IntegerField(api_name='ProcessedDate') reason = CharField(api_name='Reason') message = CharField(api_name='Message') diff --git a/tests/test_transactions.py b/tests/test_transactions.py index 7f64fac..acafbb8 100644 --- a/tests/test_transactions.py +++ b/tests/test_transactions.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- +import time +from datetime import date, datetime + +import responses + +from mangopay.utils import Money, timestamp_from_date from tests import settings from tests.resources import Transfer, Transaction from tests.test_base import BaseTest -from mangopay.utils import Money - -from datetime import date - -import responses -import time - +today = datetime.utcnow().date() +today_timestamp = timestamp_from_date(today) class TransactionsTest(BaseTest): @responses.activate @@ -43,7 +44,7 @@ def test_retrieve_transactions(self): "Status": "SUCCEEDED", "ResultCode": "000000", "ResultMessage": "Success", - "ExecutionDate": int(time.mktime(date.today().timetuple())), + "ExecutionDate": today_timestamp, "Type": "TRANSFER", "Nature": "REGULAR", "DebitedWalletId": "1167496", @@ -74,7 +75,7 @@ def test_retrieve_transactions(self): "Status": "CREATED", "ResultCode": "000000", "ResultMessage": "Success", - "ExecutionDate": "2015-05-15", + "ExecutionDate": today_timestamp, "Type": "TRANSFER", "Nature": "REFUND", "DebitedWalletId": "1174774" @@ -106,7 +107,7 @@ def test_retrieve_transactions(self): "Status": "CREATED", "ResultCode": "000000", "ResultMessage": "Success", - "ExecutionDate": "2015-05-15", + "ExecutionDate": today_timestamp, "Type": "TRANSFER", "Nature": "REFUND", "DebitedWalletId": "1174774" @@ -138,7 +139,7 @@ def test_retrieve_transactions(self): "Status": "FAILED", "ResultCode": "000000", "ResultMessage": "Success", - "ExecutionDate": "2015-05-15", + "ExecutionDate": today_timestamp, "Type": "TRANSFER", "Nature": "REFUND", "DebitedWalletId": "1174774" @@ -172,7 +173,7 @@ def test_retrieve_transactions(self): "Status": "CREATED", "ResultCode": "000000", "ResultMessage": "Success", - "ExecutionDate": 1383156788, + "ExecutionDate": today_timestamp, "Type": "TRANSFER", "Nature": "REGULAR", "CreditedWalletId": "1167504", diff --git a/tests/test_utils.py b/tests/test_utils.py index ed474d7..fce7d4f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -15,7 +15,7 @@ def test_timestamp_from_datetime_timezone_unaware(self): The timestamp should be correctly calculated on a timezone unaware datetime. """ unaware_datetime = datetime(2016, 1, 1, 10, 0, 0, 0) - self.assertEqual(timestamp_from_datetime(unaware_datetime), 1451642400) + self.assertEqual(timestamp_from_datetime(unaware_datetime), 1451635200) def test_timestamp_from_datetime_timezone_aware(self): """ From 0902fbdd426680e01ebeccb85c161525f27bb84a Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Thu, 14 Jan 2021 23:27:37 +0200 Subject: [PATCH 02/16] fixed test --- tests/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index fce7d4f..ed474d7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -15,7 +15,7 @@ def test_timestamp_from_datetime_timezone_unaware(self): The timestamp should be correctly calculated on a timezone unaware datetime. """ unaware_datetime = datetime(2016, 1, 1, 10, 0, 0, 0) - self.assertEqual(timestamp_from_datetime(unaware_datetime), 1451635200) + self.assertEqual(timestamp_from_datetime(unaware_datetime), 1451642400) def test_timestamp_from_datetime_timezone_aware(self): """ From aa5cf1f8741a78c697db5a4794b320997d8f4b47 Mon Sep 17 00:00:00 2001 From: mangomaxoasis <66364935+mangomaxoasis@users.noreply.github.com> Date: Mon, 18 Jan 2021 12:30:22 +0100 Subject: [PATCH 03/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91597e9..6e773a4 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ MangopaySDK is distributed under MIT license, see LICENSE file. Contact ------------------------------------------------- -Report bugs or suggest features using [issue tracker at GitHub](https://github.com/MangoPay/mangopay2-python-sdk-v2). +Report bugs or suggest features using [issue tracker at GitHub](https://github.com/Mangopay/mangopay2-python-sdk/issues). Account creation ------------------------------------------------- -You can get yourself a [free sandbox account](https://www.mangopay.com/signup/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live). +You can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live). Inspiration ----------- From 663a02bb93e777b36c825f93b60eeaebc39d452d Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Fri, 5 Feb 2021 08:31:42 +0200 Subject: [PATCH 04/16] added PayoutModeRequested --- mangopay/resources.py | 1 + tests/test_payouts.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mangopay/resources.py b/mangopay/resources.py index d9681c2..7f351b7 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -809,6 +809,7 @@ class BankWirePayOut(BaseModel): payment_type = CharField(api_name='PaymentType', choices=constants.PAYOUT_PAYMENT_TYPE, default=None) execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None) bank_wire_ref = CharField(api_name='BankWireRef') + payout_mode_requested = CharField(api_name='PayoutModeRequested') credited_user = ForeignKeyField(User, api_name='CreditedUserId') creation_date = DateTimeField(api_name='CreationDate') diff --git a/tests/test_payouts.py b/tests/test_payouts.py index 82615ae..2629ba0 100644 --- a/tests/test_payouts.py +++ b/tests/test_payouts.py @@ -45,6 +45,7 @@ def test_create_bank_wire_payout(self): "Id": 30047, "CreditedFunds": None, "BankWireRef": "John Doe's trousers", + "PayoutModeRequested": "INSTANT_PAYMENT", "DebitedFunds": {"Currency": "EUR", "Amount": 1000}, "BankAccountId": 6784645, "AuthorId": 6784642, @@ -82,7 +83,8 @@ def test_create_bank_wire_payout(self): "Nature": "NORMAL", "DebitedWalletId": "30025", "BankAccountId": "30027", - "BankWireRef": "John Doe's trousers" + "BankWireRef": "John Doe's trousers", + "PayoutModeRequested": "INSTANT_PAYMENT" }, 'status': 200 }]) From e117f499f499384d17490f83bb02738af5cc8b50 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Fri, 5 Feb 2021 08:32:55 +0200 Subject: [PATCH 05/16] Revert "added PayoutModeRequested" This reverts commit 663a02bb93e777b36c825f93b60eeaebc39d452d. --- mangopay/resources.py | 1 - tests/test_payouts.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/mangopay/resources.py b/mangopay/resources.py index 7f351b7..d9681c2 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -809,7 +809,6 @@ class BankWirePayOut(BaseModel): payment_type = CharField(api_name='PaymentType', choices=constants.PAYOUT_PAYMENT_TYPE, default=None) execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None) bank_wire_ref = CharField(api_name='BankWireRef') - payout_mode_requested = CharField(api_name='PayoutModeRequested') credited_user = ForeignKeyField(User, api_name='CreditedUserId') creation_date = DateTimeField(api_name='CreationDate') diff --git a/tests/test_payouts.py b/tests/test_payouts.py index 2629ba0..82615ae 100644 --- a/tests/test_payouts.py +++ b/tests/test_payouts.py @@ -45,7 +45,6 @@ def test_create_bank_wire_payout(self): "Id": 30047, "CreditedFunds": None, "BankWireRef": "John Doe's trousers", - "PayoutModeRequested": "INSTANT_PAYMENT", "DebitedFunds": {"Currency": "EUR", "Amount": 1000}, "BankAccountId": 6784645, "AuthorId": 6784642, @@ -83,8 +82,7 @@ def test_create_bank_wire_payout(self): "Nature": "NORMAL", "DebitedWalletId": "30025", "BankAccountId": "30027", - "BankWireRef": "John Doe's trousers", - "PayoutModeRequested": "INSTANT_PAYMENT" + "BankWireRef": "John Doe's trousers" }, 'status': 200 }]) From 7074f7127ae4c024b9c6d37fb2ebf593cb4c8b7c Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Fri, 5 Feb 2021 08:31:42 +0200 Subject: [PATCH 06/16] added PayoutModeRequested --- mangopay/resources.py | 1 + tests/test_payouts.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mangopay/resources.py b/mangopay/resources.py index ab2a623..3987505 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -809,6 +809,7 @@ class BankWirePayOut(BaseModel): payment_type = CharField(api_name='PaymentType', choices=constants.PAYOUT_PAYMENT_TYPE, default=None) execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None) bank_wire_ref = CharField(api_name='BankWireRef') + payout_mode_requested = CharField(api_name='PayoutModeRequested') credited_user = ForeignKeyField(User, api_name='CreditedUserId') creation_date = DateField(api_name='CreationDate') diff --git a/tests/test_payouts.py b/tests/test_payouts.py index 82615ae..2629ba0 100644 --- a/tests/test_payouts.py +++ b/tests/test_payouts.py @@ -45,6 +45,7 @@ def test_create_bank_wire_payout(self): "Id": 30047, "CreditedFunds": None, "BankWireRef": "John Doe's trousers", + "PayoutModeRequested": "INSTANT_PAYMENT", "DebitedFunds": {"Currency": "EUR", "Amount": 1000}, "BankAccountId": 6784645, "AuthorId": 6784642, @@ -82,7 +83,8 @@ def test_create_bank_wire_payout(self): "Nature": "NORMAL", "DebitedWalletId": "30025", "BankAccountId": "30027", - "BankWireRef": "John Doe's trousers" + "BankWireRef": "John Doe's trousers", + "PayoutModeRequested": "INSTANT_PAYMENT" }, 'status': 200 }]) From c8b7e4e44cba2238aba1a3e11409fbf790136cd7 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 8 Feb 2021 22:15:22 +0200 Subject: [PATCH 07/16] fixed problem --- mangopay/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mangopay/api.py b/mangopay/api.py index 3e55269..6d43723 100644 --- a/mangopay/api.py +++ b/mangopay/api.py @@ -70,7 +70,7 @@ def custom_request(self, method, url, data=None, idempotency_key=None, oauth_req headers = {} if is_mangopay_request: - headers['User-Agent'] = 'MangoPay V2 SDK Python ' + str(mangopay.package_version) + headers['User-Agent'] = 'MangoPay V2 Python/' + str(mangopay.package_version) if oauth_request: headers['Authorization'] = self.auth_manager.basic_token() headers['Content-Type'] = 'application/x-www-form-urlencoded' From 111a9398c75fc64856c81969fb8a875494c982c4 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 15 Feb 2021 10:33:48 +0200 Subject: [PATCH 08/16] added required data --- mangopay/fields.py | 10 +++++++--- mangopay/utils.py | 14 ++++++++++---- tests/test_preauthorizations.py | 4 ++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/mangopay/fields.py b/mangopay/fields.py index 6f72f08..371535c 100644 --- a/mangopay/fields.py +++ b/mangopay/fields.py @@ -232,7 +232,7 @@ def api_value(self, value): class BillingField(Field): def python_value(self, value): if value is not None: - return Billing(address=value['Address']) + return Billing(first_name=value['FistName'], last_name=value['LastName'], address=value['Address']) return value def api_value(self, value): @@ -240,6 +240,8 @@ def api_value(self, value): if isinstance(value, Billing): value = { + 'FistName': value.first_name, + 'LastName': value.last_name, 'Address': value.address } @@ -750,14 +752,16 @@ def api_value(self, value): class ShippingField(Field): def python_value(self, value): if value is not None: - return Shipping(address=value['Address']) + return Shipping(first_name=value['FistName'], last_name=value['LastName'], address=value['Address']) return value def api_value(self, value): value = super(ShippingField, self).api_value(value) - if isinstance(value, Billing): + if isinstance(value, Shipping): value = { + 'FistName': value.first_name, + 'LastName': value.last_name, 'Address': value.address } diff --git a/mangopay/utils.py b/mangopay/utils.py index 30e83cc..70871c4 100644 --- a/mangopay/utils.py +++ b/mangopay/utils.py @@ -235,11 +235,14 @@ def __str__(self): @add_camelcase_aliases class Billing(object): - def __init__(self, address=None): + def __init__(self, first_name=None, last_name=None, address=None): + self.first_name = first_name + self.last_name = last_name self.address = address def __str__(self): - return 'Billing: %s' % self.address + return 'Billing: %s' % \ + (self.first_name, self.last_name, self.address) @add_camelcase_aliases @@ -510,11 +513,14 @@ def to_api_json(self): @add_camelcase_aliases class Shipping(object): - def __init__(self, address=None): + def __init__(self, first_name=None, last_name=None, address=None): + self.first_name = first_name + self.last_name = last_name self.address = address def __str__(self): - return 'Shipping: %s' % self.address + return 'Shipping: %s' % \ + (self.first_name, self.last_name, self.address) @add_camelcase_aliases diff --git a/tests/test_preauthorizations.py b/tests/test_preauthorizations.py index c1a6e05..36dc124 100644 --- a/tests/test_preauthorizations.py +++ b/tests/test_preauthorizations.py @@ -706,6 +706,8 @@ def test_PreAuthorizations_CreateWithAvs(self): billing.address.country = "FR" billing.address.city = "Lyon" billing.address.postal_code = "65400" + billing.last_name = "Doe" + billing.first_name = "John" pre_authorization.billing = billing saved_pre_authorization = pre_authorization.save() @@ -754,6 +756,8 @@ def test_PreAuthorizations_CreateDirect(self): billing.address.country = "FR" billing.address.city = "Lyon" billing.address.postal_code = "65400" + billing.last_name = "Doe" + billing.first_name = "John" pre_authorization.billing = billing saved_pre_authorization = pre_authorization.save() From 26c8816830ef01cc951ad6bcb39781907ffff9a4 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 15 Feb 2021 10:56:43 +0200 Subject: [PATCH 09/16] changed ipaddress --- mangopay/resources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mangopay/resources.py b/mangopay/resources.py index 7f351b7..84b6c70 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -491,7 +491,7 @@ class DirectPayIn(PayIn): billing = BillingField(api_name='Billing') security_info = SecurityInfoField(api_name='SecurityInfo') culture = CharField(api_name='Culture') - ip_address = CharField(api_name='IpAdress') + ip_address = CharField(api_name='IpAddress') browser_info = BrowserInfoField(api_name='BrowserInfo') shipping = ShippingField(api_name='Shipping') @@ -689,7 +689,7 @@ class PreAuthorization(BaseModel): billing = BillingField(api_name='Billing') security_info = SecurityInfoField(api_name='SecurityInfo') multi_capture = BooleanField(api_name='MultiCapture') - ip_address = CharField(api_name='IpAdress') + ip_address = CharField(api_name='IpAddress') browser_info = BrowserInfoField(api_name='BrowserInfo') shipping = ShippingField(api_name='Shipping') From 3101e6b05a68cafb210a3408ec7306c4e563b64d Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 15 Feb 2021 11:17:06 +0200 Subject: [PATCH 10/16] fixed typo --- mangopay/fields.py | 8 ++++---- tests/test_payins.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mangopay/fields.py b/mangopay/fields.py index 371535c..75eccb0 100644 --- a/mangopay/fields.py +++ b/mangopay/fields.py @@ -232,7 +232,7 @@ def api_value(self, value): class BillingField(Field): def python_value(self, value): if value is not None: - return Billing(first_name=value['FistName'], last_name=value['LastName'], address=value['Address']) + return Billing(first_name=value['FirstName'], last_name=value['LastName'], address=value['Address']) return value def api_value(self, value): @@ -240,7 +240,7 @@ def api_value(self, value): if isinstance(value, Billing): value = { - 'FistName': value.first_name, + 'FirstName': value.first_name, 'LastName': value.last_name, 'Address': value.address } @@ -752,7 +752,7 @@ def api_value(self, value): class ShippingField(Field): def python_value(self, value): if value is not None: - return Shipping(first_name=value['FistName'], last_name=value['LastName'], address=value['Address']) + return Shipping(first_name=value['FirstName'], last_name=value['LastName'], address=value['Address']) return value def api_value(self, value): @@ -760,7 +760,7 @@ def api_value(self, value): if isinstance(value, Shipping): value = { - 'FistName': value.first_name, + 'FirstName': value.first_name, 'LastName': value.last_name, 'Address': value.address } diff --git a/tests/test_payins.py b/tests/test_payins.py index de1c230..a8a9354 100644 --- a/tests/test_payins.py +++ b/tests/test_payins.py @@ -712,7 +712,7 @@ def test_PayIns_CardDirect_CreateWithAvs(self): address.country = "FR" address.city = "Lyon" address.postal_code = "68400" - pay_in.billing = Billing(address=address) + pay_in.billing = Billing(first_name="John", last_name="Doe", address=address) result = pay_in.save() From f2d79902219ed9d5c6de9eaae2ba3698698724b6 Mon Sep 17 00:00:00 2001 From: "catalin.craciun" Date: Fri, 19 Feb 2021 19:28:25 +0400 Subject: [PATCH 11/16] Version bump 3.9.0 --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a675431..b36585c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 3.9.0 +- 3DS2 integration with Shipping and Billing objects, including FirstName and LastName fields +The objects Billing and Shipping may be included on all calls to the following endpoints: + - /preauthorizations/card/direct + - /payins/card/direct + - /payins/card/web +- Enable Instant Payment for payouts by adding a new parameter PayoutModeRequested on the following endpoint /payouts/bankwire + - The new parameter PayoutModeRequested can take two differents values : "INSTANT_PAYMENT" or "STANDARD" (STANDARD = the way we procede normaly a payout request) + - This new parameter is not mandatory and if empty or not present, the payout will be "STANDARD" by default + - Instant Payment is in beta all over Europe - SEPA region +- Changed date to dateTime and fixed tests +- Changed User-Agent ## 3.8.4 - Added 'Regulatory' endpoint to allow checks of User Block Status - Added support for Regulatory -> Blocked Status Hooks diff --git a/setup.py b/setup.py index cf1af52..7b99f4c 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name='mangopaysdk', - version='3.8.4', + version='3.9.0', description='A client library written in python to work with mangopay v2 api', long_description='This SDK is a client library for interacting with the Mangopay API.', url='https://github.com/Mangopay/mangopay2-python-sdk', From 6827e87569c509d06308cd25844107edbcf3e290 Mon Sep 17 00:00:00 2001 From: "catalin.craciun" Date: Fri, 19 Feb 2021 19:46:53 +0400 Subject: [PATCH 12/16] Updated changelog for 3.9.0 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b36585c..56aff1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The objects Billing and Shipping may be included on all calls to the following e - Instant Payment is in beta all over Europe - SEPA region - Changed date to dateTime and fixed tests - Changed User-Agent +- Fixed typo on IpAddress, FirstName & LastName ## 3.8.4 - Added 'Regulatory' endpoint to allow checks of User Block Status - Added support for Regulatory -> Blocked Status Hooks From 09291d2d9c75a5af717bec31a7f277ec581c4154 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 22 Feb 2021 09:45:36 +0200 Subject: [PATCH 13/16] Changed build script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dccf2ab..e09a324 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ python: install: - pip install -r requirements/base.txt - pip install -r requirements/development.txt -script: nosetests +script: if [ $TRAVIS_BRANCH != "release" ]; then nosetests; fi sudo: required dist: xenial deploy: From faa01d0c12b45bf8ba5631830bbed9dd4411b2e1 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 22 Feb 2021 09:50:12 +0200 Subject: [PATCH 14/16] changed build travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e09a324..5139992 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ python: install: - pip install -r requirements/base.txt - pip install -r requirements/development.txt -script: if [ $TRAVIS_BRANCH != "release" ]; then nosetests; fi +script: +- if [ $TRAVIS_BRANCH != "release" ]; then nosetests; fi sudo: required dist: xenial deploy: From 74d8b19ff7117d3359119e80bc4db5a27db13a63 Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Mon, 22 Feb 2021 09:58:51 +0200 Subject: [PATCH 15/16] updated to 3.6 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5139992..8b97f74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: #- '2.7' -- '3.5' +- '3.6' install: - pip install -r requirements/base.txt - pip install -r requirements/development.txt @@ -19,7 +19,7 @@ deploy: branch: release tags: false python: 3.5 - condition: $TRAVIS_PYTHON_VERSION = "3.5" + condition: $TRAVIS_PYTHON_VERSION = "3.6" env: global: - secure: eDsZz0hrnLpBmkFvHMeczHHjytOMJpOZMc21nVR/vRLnjZ7eLmXaklvdy3AQ5SJz+l1neVVihHNX6MyBJ0s63UKatLP7catl++yyqPj5/0C7C0a07ZvJHhUzqnEdYLNOMauy7p5rPMldLOiT1dgQlL1f1FG31BHJ5UkAnrhwvdU= From 22ea97fb60fb1de532cc8378379d731ffa9fdffe Mon Sep 17 00:00:00 2001 From: Mircea Solovastru Date: Tue, 23 Feb 2021 10:01:01 +0200 Subject: [PATCH 16/16] fixed build err --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8b97f74..f4e4821 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ deploy: repo: Mangopay/mangopay2-python-sdk branch: release tags: false - python: 3.5 + python: 3.6 condition: $TRAVIS_PYTHON_VERSION = "3.6" env: global: