summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2016-06-24 12:19:41 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2016-06-24 12:19:41 (GMT)
commit9ee9fe567c3cbbff414d90ed72d8e2ec3823bdd0 (patch)
tree2cd4089aa6ab478da97c74278d7b00f40f244c81
parentd0c523ff12f6c1cbc8057174e5117848adc04276 (diff)
downloadeopayment-9ee9fe567c3cbbff414d90ed72d8e2ec3823bdd0.zip
eopayment-9ee9fe567c3cbbff414d90ed72d8e2ec3823bdd0.tar.gz
eopayment-9ee9fe567c3cbbff414d90ed72d8e2ec3823bdd0.tar.bz2
sips2: add capture_day parameter (#11579)v1.12
-rw-r--r--eopayment/sips2.py9
-rw-r--r--tests/test_sips2.py6
2 files changed, 15 insertions, 0 deletions
diff --git a/eopayment/sips2.py b/eopayment/sips2.py
index 79d5c85..018dc87 100644
--- a/eopayment/sips2.py
+++ b/eopayment/sips2.py
@@ -117,6 +117,11 @@ class Payment(PaymentCommon):
'choices': ['AUTHOR_CAPTURE', 'IMMEDIATE', 'VALIDATION'],
'required': True,
},
+ {
+ 'name': 'capture_day',
+ 'caption': _('Capture Day'),
+ 'required': False,
+ },
],
}
@@ -140,6 +145,8 @@ class Payment(PaymentCommon):
data['automaticResponseUrl'] = self.automatic_return_url
data['currencyCode'] = self.currency_code
data['captureMode'] = self.capture_mode
+ if self.capture_day:
+ data['captureDay'] = self.capture_day
return data
def get_url(self):
@@ -154,6 +161,8 @@ class Payment(PaymentCommon):
data['amount'] = unicode(int(Decimal(amount) * 100))
if email:
data['billingContact.email'] = email
+ if 'captureDay' in kwargs:
+ data['captureDay'] == kwargs.get('captureDay')
normal_return_url = self.normal_return_url
if next_url and not normal_return_url:
warnings.warn("passing next_url to request() is deprecated, "
diff --git a/tests/test_sips2.py b/tests/test_sips2.py
index 0ae1704..53ec055 100644
--- a/tests/test_sips2.py
+++ b/tests/test_sips2.py
@@ -11,6 +11,12 @@ def test_options():
payment = eopayment.Payment('sips2', {'capture_mode': 'VALIDATION'})
assert payment.backend.get_data()['captureMode'] == 'VALIDATION'
+ payment = eopayment.Payment('sips2', {})
+ assert not 'captureDay' in payment.backend.get_data()
+
+ payment = eopayment.Payment('sips2', {'capture_day': '10'})
+ assert 'captureDay' in payment.backend.get_data()
+
def test_parse_response():
qs = '''Data=captureDay%3D0%7CcaptureMode%3DAUTHOR_CAPTURE%7CcurrencyCode%3D978%7CmerchantId%3D002001000000001%7CorderChannel%3DINTERNET%7CresponseCode%3D00%7CtransactionDateTime%3D2016-02-01T17%3A44%3A20%2B01%3A00%7CtransactionReference%3D668930%7CkeyVersion%3D1%7CacquirerResponseCode%3D00%7Camount%3D1200%7CauthorisationId%3D12345%7CcardCSCResultCode%3D4E%7CpanExpiryDate%3D201605%7CpaymentMeanBrand%3DMASTERCARD%7CpaymentMeanType%3DCARD%7CcustomerIpAddress%3D82.244.203.243%7CmaskedPan%3D5100%23%23%23%23%23%23%23%23%23%23%23%2300%7CorderId%3Dd4903de7027f4d56ac01634fd7ab9526%7CholderAuthentRelegation%3DN%7CholderAuthentStatus%3D3D_ERROR%7CtransactionOrigin%3DINTERNET%7CpaymentPattern%3DONE_SHOT&Seal=6ca3247765a19b45d25ad54ef4076483e7d55583166bd5ac9c64357aac097602&InterfaceVersion=HP_2.0&Encode='''
backend = eopayment.Payment('sips2', {})