Skip to content

Commit 01774bb

Browse files
feat: add support to metadata on transaction operations
1 parent 0e4d739 commit 01774bb

File tree

7 files changed

+99
-6
lines changed

7 files changed

+99
-6
lines changed

processout/alternativemerchantcertificate.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,24 @@ def save(self, options={}):
7171
alternativeMerchantCertificate.fill_with_data(body))
7272

7373
return return_values[0]
74+
75+
def delete(self, options={}):
76+
"""Delete a given alternative merchant certificate
77+
Keyword argument:
78+
79+
options -- Options for the request"""
80+
self.fill_with_data(options)
81+
82+
request = Request(self._client)
83+
path = "/projects/applepay/alternative-merchant-certificates/" + \
84+
quote_plus(self.id) + ""
85+
data = {
86+
87+
}
88+
89+
response = Response(request.delete(path, data, options))
90+
return_values = []
91+
92+
return_values.append(response.success)
93+
94+
return return_values[0]

processout/applepayalternativemerchantcertificates.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,24 @@ class ApplePayAlternativeMerchantCertificates(object):
1616
def __init__(self, client, prefill=None):
1717
self._client = client
1818

19+
self._count = None
1920
self._alternative_merchant_certificates = None
2021
if prefill is not None:
2122
self.fill_with_data(prefill)
2223

24+
@property
25+
def count(self):
26+
"""Get count"""
27+
return self._count
28+
29+
@count.setter
30+
def count(self, val):
31+
"""Set count
32+
Keyword argument:
33+
val -- New count value"""
34+
self._count = val
35+
return self
36+
2337
@property
2438
def alternative_merchant_certificates(self):
2539
"""Get alternative_merchant_certificates"""
@@ -50,13 +64,16 @@ def fill_with_data(self, data):
5064
"""Fill the current object with the new values pulled from data
5165
Keyword argument:
5266
data -- The data from which to pull the new values"""
67+
if "count" in data.keys():
68+
self.count = data["count"]
5369
if "alternative_merchant_certificates" in data.keys():
5470
self.alternative_merchant_certificates = data["alternative_merchant_certificates"]
5571

5672
return self
5773

5874
def to_json(self):
5975
return {
76+
"count": self.count,
6077
"alternative_merchant_certificates": self.alternative_merchant_certificates,
6178
}
6279

processout/balance.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, client, prefill=None):
1818

1919
self._amount = None
2020
self._currency = None
21+
self._expiry = None
2122
if prefill is not None:
2223
self.fill_with_data(prefill)
2324

@@ -47,6 +48,19 @@ def currency(self, val):
4748
self._currency = val
4849
return self
4950

51+
@property
52+
def expiry(self):
53+
"""Get expiry"""
54+
return self._expiry
55+
56+
@expiry.setter
57+
def expiry(self, val):
58+
"""Set expiry
59+
Keyword argument:
60+
val -- New expiry value"""
61+
self._expiry = val
62+
return self
63+
5064
def fill_with_data(self, data):
5165
"""Fill the current object with the new values pulled from data
5266
Keyword argument:
@@ -55,11 +69,14 @@ def fill_with_data(self, data):
5569
self.amount = data["amount"]
5670
if "currency" in data.keys():
5771
self.currency = data["currency"]
72+
if "expiry" in data.keys():
73+
self.expiry = data["expiry"]
5874

5975
return self
6076

6177
def to_json(self):
6278
return {
6379
"amount": self.amount,
6480
"currency": self.currency,
81+
"expiry": self.expiry,
6582
}

processout/invoice.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(self, client, prefill=None):
5555
self._challenge_indicator = None
5656
self._incremental = None
5757
self._tax = None
58+
self._payment_type = None
5859
if prefill is not None:
5960
self.fill_with_data(prefill)
6061

@@ -667,6 +668,19 @@ def tax(self, val):
667668
self._tax = val
668669
return self
669670

671+
@property
672+
def payment_type(self):
673+
"""Get payment_type"""
674+
return self._payment_type
675+
676+
@payment_type.setter
677+
def payment_type(self, val):
678+
"""Set payment_type
679+
Keyword argument:
680+
val -- New payment_type value"""
681+
self._payment_type = val
682+
return self
683+
670684
def fill_with_data(self, data):
671685
"""Fill the current object with the new values pulled from data
672686
Keyword argument:
@@ -749,6 +763,8 @@ def fill_with_data(self, data):
749763
self.incremental = data["incremental"]
750764
if "tax" in data.keys():
751765
self.tax = data["tax"]
766+
if "payment_type" in data.keys():
767+
self.payment_type = data["payment_type"]
752768

753769
return self
754770

@@ -793,6 +809,7 @@ def to_json(self):
793809
"challenge_indicator": self.challenge_indicator,
794810
"incremental": self.incremental,
795811
"tax": self.tax,
812+
"payment_type": self.payment_type,
796813
}
797814

798815
def increment_authorization(self, amount, options={}):
@@ -805,6 +822,7 @@ def increment_authorization(self, amount, options={}):
805822
request = Request(self._client)
806823
path = "/invoices/" + quote_plus(self.id) + "/increment_authorization"
807824
data = {
825+
'metadata': options.get("metadata"),
808826
'amount': amount
809827
}
810828

@@ -835,6 +853,7 @@ def authorize(self, source, options={}):
835853
'capture_amount': options.get("capture_amount"),
836854
'enable_three_d_s_2': options.get("enable_three_d_s_2"),
837855
'auto_capture_at': options.get("auto_capture_at"),
856+
'metadata': options.get("metadata"),
838857
'source': source}
839858

840859
response = Response(request.post(path, data, options))
@@ -865,6 +884,7 @@ def capture(self, source, options={}):
865884
'capture_amount': options.get("capture_amount"),
866885
'auto_capture_at': options.get("auto_capture_at"),
867886
'enable_three_d_s_2': options.get("enable_three_d_s_2"),
887+
'metadata': options.get("metadata"),
868888
'source': source}
869889

870890
response = Response(request.post(path, data, options))
@@ -980,7 +1000,7 @@ def void(self, options={}):
9801000
request = Request(self._client)
9811001
path = "/invoices/" + quote_plus(self.id) + "/void"
9821002
data = {
983-
1003+
'metadata': options.get("metadata")
9841004
}
9851005

9861006
response = Response(request.post(path, data, options))
@@ -1054,7 +1074,8 @@ def create(self, options={}):
10541074
'device': self.device,
10551075
'require_backend_capture': self.require_backend_capture,
10561076
'external_fraud_tools': self.external_fraud_tools,
1057-
'tax': self.tax
1077+
'tax': self.tax,
1078+
'payment_type': self.payment_type
10581079
}
10591080

10601081
response = Response(request.post(path, data, options))

processout/invoiceshipping.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(self, client, prefill=None):
2828
self._zip = None
2929
self._phone_number = None
3030
self._expects_shipping_at = None
31+
self._relay_store_name = None
3132
if prefill is not None:
3233
self.fill_with_data(prefill)
3334

@@ -187,6 +188,19 @@ def expects_shipping_at(self, val):
187188
self._expects_shipping_at = val
188189
return self
189190

191+
@property
192+
def relay_store_name(self):
193+
"""Get relay_store_name"""
194+
return self._relay_store_name
195+
196+
@relay_store_name.setter
197+
def relay_store_name(self, val):
198+
"""Set relay_store_name
199+
Keyword argument:
200+
val -- New relay_store_name value"""
201+
self._relay_store_name = val
202+
return self
203+
190204
def fill_with_data(self, data):
191205
"""Fill the current object with the new values pulled from data
192206
Keyword argument:
@@ -215,6 +229,8 @@ def fill_with_data(self, data):
215229
self.phone_number = data["phone_number"]
216230
if "expects_shipping_at" in data.keys():
217231
self.expects_shipping_at = data["expects_shipping_at"]
232+
if "relay_store_name" in data.keys():
233+
self.relay_store_name = data["relay_store_name"]
218234

219235
return self
220236

@@ -232,4 +248,5 @@ def to_json(self):
232248
"zip": self.zip,
233249
"phone_number": self.phone_number,
234250
"expects_shipping_at": self.expects_shipping_at,
251+
"relay_store_name": self.relay_store_name,
235252
}

processout/refund.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ def create(self, options={}):
290290
path = "/transactions/" + quote_plus(self.transaction_id) + "/refunds"
291291
data = {
292292
'amount': self.amount,
293-
'metadata': self.metadata,
294293
'reason': self.reason,
295294
'information': self.information,
296-
'invoice_detail_ids': self.invoice_detail_ids
295+
'invoice_detail_ids': self.invoice_detail_ids,
296+
'metadata': options.get("metadata")
297297
}
298298

299299
response = Response(request.post(path, data, options))

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
setup(
44
name = 'processout',
55
packages = ['processout', 'processout.errors', 'processout.networking'],
6-
version = '6.23.0',
6+
version = '6.24.0',
77
description = 'ProcessOut API bindings.',
88
author = 'ProcessOut',
99
author_email = '[email protected]',
1010
url = 'https://github.com/processout/processout-python',
11-
download_url = 'https://github.com/processout/processout-python/tarball/6.23.0',
11+
download_url = 'https://github.com/processout/processout-python/tarball/6.24.0',
1212
keywords = ['ProcessOut', 'api', 'bindings'],
1313
classifiers = [],
1414
)

0 commit comments

Comments
 (0)