Skip to content

Commit bf78df1

Browse files
feat: add customer and invoice reference_id; add balances customer action (#24)
Co-authored-by: ProcessOut Fountain <[email protected]>
1 parent ced6192 commit bf78df1

File tree

8 files changed

+172
-10
lines changed

8 files changed

+172
-10
lines changed

processout/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from processout.alternativemerchantcertificate import AlternativeMerchantCertificate
1010
from processout.balances import Balances
1111
from processout.balance import Balance
12+
from processout.balancescustomeraction import BalancesCustomerAction
1213
from processout.card import Card
1314
from processout.cardinformation import CardInformation
1415
from processout.phone import Phone
@@ -66,11 +67,11 @@
6667
from processout.transactionoperation import TransactionOperation
6768
from processout.webhook import Webhook
6869
from processout.webhookendpoint import WebhookEndpoint
69-
from processout.cardcreaterequest import CardCreateRequest
7070
from processout.device import Device
7171
from processout.cardcontact import CardContact
7272
from processout.cardshipping import CardShipping
7373
from processout.cardupdaterequest import CardUpdateRequest
74+
from processout.cardcreaterequest import CardCreateRequest
7475
from processout.errorcodes import ErrorCodes
7576
from processout.categoryerrorcodes import CategoryErrorCodes
7677
from processout.externalthreeds import ExternalThreeDS

processout/balances.py

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

1919
self._vouchers = None
20+
self._available_balance = None
21+
self._customer_action = None
2022
if prefill is not None:
2123
self.fill_with_data(prefill)
2224

@@ -45,18 +47,68 @@ def vouchers(self, val):
4547
self._vouchers = l
4648
return self
4749

50+
@property
51+
def available_balance(self):
52+
"""Get available_balance"""
53+
return self._available_balance
54+
55+
@available_balance.setter
56+
def available_balance(self, val):
57+
"""Set available_balance
58+
Keyword argument:
59+
val -- New available_balance value"""
60+
if val is None:
61+
self._available_balance = val
62+
return self
63+
64+
if isinstance(val, dict):
65+
obj = processout.Balance(self._client)
66+
obj.fill_with_data(val)
67+
self._available_balance = obj
68+
else:
69+
self._available_balance = val
70+
return self
71+
72+
@property
73+
def customer_action(self):
74+
"""Get customer_action"""
75+
return self._customer_action
76+
77+
@customer_action.setter
78+
def customer_action(self, val):
79+
"""Set customer_action
80+
Keyword argument:
81+
val -- New customer_action value"""
82+
if val is None:
83+
self._customer_action = val
84+
return self
85+
86+
if isinstance(val, dict):
87+
obj = processout.BalancesCustomerAction(self._client)
88+
obj.fill_with_data(val)
89+
self._customer_action = obj
90+
else:
91+
self._customer_action = val
92+
return self
93+
4894
def fill_with_data(self, data):
4995
"""Fill the current object with the new values pulled from data
5096
Keyword argument:
5197
data -- The data from which to pull the new values"""
5298
if "vouchers" in data.keys():
5399
self.vouchers = data["vouchers"]
100+
if "available_balance" in data.keys():
101+
self.available_balance = data["available_balance"]
102+
if "customer_action" in data.keys():
103+
self.customer_action = data["customer_action"]
54104

55105
return self
56106

57107
def to_json(self):
58108
return {
59109
"vouchers": self.vouchers,
110+
"available_balance": self.available_balance,
111+
"customer_action": self.customer_action,
60112
}
61113

62114
def find(self, token_id, options={}):
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
try:
2+
from urllib.parse import quote_plus
3+
except ImportError:
4+
from urllib import quote_plus
5+
6+
import processout
7+
import json
8+
9+
from processout.networking.request import Request
10+
from processout.networking.response import Response
11+
12+
# The content of this file was automatically generated
13+
14+
15+
class BalancesCustomerAction(object):
16+
def __init__(self, client, prefill=None):
17+
self._client = client
18+
19+
self._type = None
20+
self._value = None
21+
if prefill is not None:
22+
self.fill_with_data(prefill)
23+
24+
@property
25+
def type(self):
26+
"""Get type"""
27+
return self._type
28+
29+
@type.setter
30+
def type(self, val):
31+
"""Set type
32+
Keyword argument:
33+
val -- New type value"""
34+
self._type = val
35+
return self
36+
37+
@property
38+
def value(self):
39+
"""Get value"""
40+
return self._value
41+
42+
@value.setter
43+
def value(self, val):
44+
"""Set value
45+
Keyword argument:
46+
val -- New value value"""
47+
self._value = val
48+
return self
49+
50+
def fill_with_data(self, data):
51+
"""Fill the current object with the new values pulled from data
52+
Keyword argument:
53+
data -- The data from which to pull the new values"""
54+
if "type" in data.keys():
55+
self.type = data["type"]
56+
if "value" in data.keys():
57+
self.value = data["value"]
58+
59+
return self
60+
61+
def to_json(self):
62+
return {
63+
"type": self.type,
64+
"value": self.value,
65+
}

processout/client.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def new_balance(self, prefill=None):
7575
prefill -- Data used to prefill the object (optional)"""
7676
return processout.Balance(self, prefill)
7777

78+
def new_balances_customer_action(self, prefill=None):
79+
"""Create a new BalancesCustomerAction instance
80+
Keyword argument:
81+
prefill -- Data used to prefill the object (optional)"""
82+
return processout.BalancesCustomerAction(self, prefill)
83+
7884
def new_card(self, prefill=None):
7985
"""Create a new Card instance
8086
Keyword argument:
@@ -421,12 +427,6 @@ def new_webhook_endpoint(self, prefill=None):
421427
prefill -- Data used to prefill the object (optional)"""
422428
return processout.WebhookEndpoint(self, prefill)
423429

424-
def new_card_create_request(self, prefill=None):
425-
"""Create a new CardCreateRequest instance
426-
Keyword argument:
427-
prefill -- Data used to prefill the object (optional)"""
428-
return processout.CardCreateRequest(self, prefill)
429-
430430
def new_device(self, prefill=None):
431431
"""Create a new Device instance
432432
Keyword argument:
@@ -451,6 +451,12 @@ def new_card_update_request(self, prefill=None):
451451
prefill -- Data used to prefill the object (optional)"""
452452
return processout.CardUpdateRequest(self, prefill)
453453

454+
def new_card_create_request(self, prefill=None):
455+
"""Create a new CardCreateRequest instance
456+
Keyword argument:
457+
prefill -- Data used to prefill the object (optional)"""
458+
return processout.CardCreateRequest(self, prefill)
459+
454460
def new_error_codes(self, prefill=None):
455461
"""Create a new ErrorCodes instance
456462
Keyword argument:

processout/customer.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self, client, prefill=None):
4747
self._created_at = None
4848
self._registered_at = None
4949
self._date_of_birth = None
50+
self._reference_id = None
5051
if prefill is not None:
5152
self.fill_with_data(prefill)
5253

@@ -516,6 +517,19 @@ def date_of_birth(self, val):
516517
self._date_of_birth = val
517518
return self
518519

520+
@property
521+
def reference_id(self):
522+
"""Get reference_id"""
523+
return self._reference_id
524+
525+
@reference_id.setter
526+
def reference_id(self, val):
527+
"""Set reference_id
528+
Keyword argument:
529+
val -- New reference_id value"""
530+
self._reference_id = val
531+
return self
532+
519533
def fill_with_data(self, data):
520534
"""Fill the current object with the new values pulled from data
521535
Keyword argument:
@@ -582,6 +596,8 @@ def fill_with_data(self, data):
582596
self.registered_at = data["registered_at"]
583597
if "date_of_birth" in data.keys():
584598
self.date_of_birth = data["date_of_birth"]
599+
if "reference_id" in data.keys():
600+
self.reference_id = data["reference_id"]
585601

586602
return self
587603

@@ -618,6 +634,7 @@ def to_json(self):
618634
"created_at": self.created_at,
619635
"registered_at": self.registered_at,
620636
"date_of_birth": self.date_of_birth,
637+
"reference_id": self.reference_id,
621638
}
622639

623640
def fetch_subscriptions(self, options={}):
@@ -803,6 +820,7 @@ def create(self, options={}):
803820
'sex': self.sex,
804821
'metadata': self.metadata,
805822
'id': self.id,
823+
'reference_id': self.reference_id,
806824
'registered_at': self.registered_at,
807825
'phone_number': self.phone_number
808826
}

processout/invoice.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(self, client, prefill=None):
6767
self._unsupported_feature_bypass = None
6868
self._verification = None
6969
self._auto_capture_at = None
70+
self._reference_id = None
7071
if prefill is not None:
7172
self.fill_with_data(prefill)
7273

@@ -871,6 +872,19 @@ def auto_capture_at(self, val):
871872
self._auto_capture_at = val
872873
return self
873874

875+
@property
876+
def reference_id(self):
877+
"""Get reference_id"""
878+
return self._reference_id
879+
880+
@reference_id.setter
881+
def reference_id(self, val):
882+
"""Set reference_id
883+
Keyword argument:
884+
val -- New reference_id value"""
885+
self._reference_id = val
886+
return self
887+
874888
def fill_with_data(self, data):
875889
"""Fill the current object with the new values pulled from data
876890
Keyword argument:
@@ -977,6 +991,8 @@ def fill_with_data(self, data):
977991
self.verification = data["verification"]
978992
if "auto_capture_at" in data.keys():
979993
self.auto_capture_at = data["auto_capture_at"]
994+
if "reference_id" in data.keys():
995+
self.reference_id = data["reference_id"]
980996

981997
return self
982998

@@ -1033,6 +1049,7 @@ def to_json(self):
10331049
"unsupported_feature_bypass": self.unsupported_feature_bypass,
10341050
"verification": self.verification,
10351051
"auto_capture_at": self.auto_capture_at,
1052+
"reference_id": self.reference_id,
10361053
}
10371054

10381055
def increment_authorization(self, amount, options={}):
@@ -1381,6 +1398,7 @@ def create(self, options={}):
13811398
'metadata': self.metadata,
13821399
'details': self.details,
13831400
'submerchant': self.submerchant,
1401+
'reference_id': self.reference_id,
13841402
'exemption_reason_3ds2': self.exemption_reason_3ds2,
13851403
'sca_exemption_reason': self.sca_exemption_reason,
13861404
'challenge_indicator': self.challenge_indicator,

processout/token.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def create(self, options={}):
527527
'invoice_id': self.invoice_id,
528528
'manual_invoice_cancellation': self.manual_invoice_cancellation,
529529
'webhook_url': self.webhook_url,
530+
'gateway_configuration_id': self.gateway_configuration_id,
530531
'source': options.get("source"),
531532
'settings': options.get("settings"),
532533
'device': options.get("device"),
@@ -570,7 +571,8 @@ def save(self, options={}):
570571
'verify_metadata': options.get("verify_metadata"),
571572
'set_default': options.get("set_default"),
572573
'verify_statement_descriptor': options.get("verify_statement_descriptor"),
573-
'invoice_return_url': options.get("invoice_return_url")}
574+
'invoice_return_url': options.get("invoice_return_url"),
575+
'gateway_configuration_id': options.get("gateway_configuration_id")}
574576

575577
response = Response(request.put(path, data, options))
576578
return_values = []

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 = '7.3.0',
6+
version = '7.4.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/7.3.0',
11+
download_url = 'https://github.com/processout/processout-python/tarball/7.4.0',
1212
keywords = ['ProcessOut', 'api', 'bindings'],
1313
classifiers = [],
1414
)

0 commit comments

Comments
 (0)