Skip to content

Commit 2462860

Browse files
feat: Add create/update card request fields; SFTPSettings (#16)
Co-authored-by: ProcessOut Fountain <internal@processout.com>
1 parent 013f43e commit 2462860

File tree

6 files changed

+137
-8
lines changed

6 files changed

+137
-8
lines changed

processout/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from processout.product import Product
4242
from processout.project import Project
4343
from processout.projectsftpsettings import ProjectSFTPSettings
44+
from processout.projectsftpsettingspublic import ProjectSFTPSettingsPublic
4445
from processout.refund import Refund
4546
from processout.subscription import Subscription
4647
from processout.transaction import Transaction

processout/cardcreaterequest.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,23 @@ def create(self, options={}):
356356
request = Request(self._client)
357357
path = "/cards"
358358
data = {
359-
359+
'device': self.device,
360+
'name': self.name,
361+
'number': self.number,
362+
'exp_day': self.exp_day,
363+
'exp_month': self.exp_month,
364+
'exp_year': self.exp_year,
365+
'cvc2': self.cvc2,
366+
'preferred_scheme': self.preferred_scheme,
367+
'metadata': self.metadata,
368+
'token_type': self.token_type,
369+
'eci': self.eci,
370+
'cryptogram': self.cryptogram,
371+
'applepay_response': self.applepay_response,
372+
'applepay_mid': self.applepay_mid,
373+
'payment_token': self.payment_token,
374+
'contact': self.contact,
375+
'shipping': self.shipping
360376
}
361377

362378
response = Response(request.post(path, data, options))
@@ -365,7 +381,6 @@ def create(self, options={}):
365381
body = response.body
366382
body = body["card"]
367383

368-
obj = processout.CardCreateRequest(self._client)
369-
return_values.append(obj.fill_with_data(body))
384+
return_values.append(self.fill_with_data(body))
370385

371386
return return_values[0]

processout/cardupdaterequest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def update(self, card_id, options={}):
9191
request = Request(self._client)
9292
path = "/cards/" + quote_plus(card_id) + ""
9393
data = {
94-
94+
'update_type': self.update_type,
95+
'update_reason': self.update_reason,
96+
'preferred_scheme': self.preferred_scheme
9597
}
9698

9799
response = Response(request.put(path, data, options))
@@ -100,7 +102,6 @@ def update(self, card_id, options={}):
100102
body = response.body
101103
body = body["card"]
102104

103-
obj = processout.CardUpdateRequest(self._client)
104-
return_values.append(obj.fill_with_data(body))
105+
return_values.append(self.fill_with_data(body))
105106

106107
return return_values[0]

processout/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ def new_project_sftp_settings(self, prefill=None):
267267
prefill -- Data used to prefill the object (optional)"""
268268
return processout.ProjectSFTPSettings(self, prefill)
269269

270+
def new_project_sftp_settings_public(self, prefill=None):
271+
"""Create a new ProjectSFTPSettingsPublic instance
272+
Keyword argument:
273+
prefill -- Data used to prefill the object (optional)"""
274+
return processout.ProjectSFTPSettingsPublic(self, prefill)
275+
270276
def new_refund(self, prefill=None):
271277
"""Create a new Refund instance
272278
Keyword argument:
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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 ProjectSFTPSettingsPublic(object):
16+
def __init__(self, client, prefill=None):
17+
self._client = client
18+
19+
self._enabled = None
20+
self._endpoint = None
21+
self._username = None
22+
if prefill is not None:
23+
self.fill_with_data(prefill)
24+
25+
@property
26+
def enabled(self):
27+
"""Get enabled"""
28+
return self._enabled
29+
30+
@enabled.setter
31+
def enabled(self, val):
32+
"""Set enabled
33+
Keyword argument:
34+
val -- New enabled value"""
35+
self._enabled = val
36+
return self
37+
38+
@property
39+
def endpoint(self):
40+
"""Get endpoint"""
41+
return self._endpoint
42+
43+
@endpoint.setter
44+
def endpoint(self, val):
45+
"""Set endpoint
46+
Keyword argument:
47+
val -- New endpoint value"""
48+
self._endpoint = val
49+
return self
50+
51+
@property
52+
def username(self):
53+
"""Get username"""
54+
return self._username
55+
56+
@username.setter
57+
def username(self, val):
58+
"""Set username
59+
Keyword argument:
60+
val -- New username value"""
61+
self._username = val
62+
return self
63+
64+
def fill_with_data(self, data):
65+
"""Fill the current object with the new values pulled from data
66+
Keyword argument:
67+
data -- The data from which to pull the new values"""
68+
if "enabled" in data.keys():
69+
self.enabled = data["enabled"]
70+
if "endpoint" in data.keys():
71+
self.endpoint = data["endpoint"]
72+
if "username" in data.keys():
73+
self.username = data["username"]
74+
75+
return self
76+
77+
def to_json(self):
78+
return {
79+
"enabled": self.enabled,
80+
"endpoint": self.endpoint,
81+
"username": self.username,
82+
}
83+
84+
def fetch_sftp_settings(self, id, options={}):
85+
"""Fetch the SFTP settings for the project.
86+
Keyword argument:
87+
id -- ID of the project
88+
options -- Options for the request"""
89+
self.fill_with_data(options)
90+
91+
request = Request(self._client)
92+
path = "/projects/" + quote_plus(id) + "/sftp-settings"
93+
data = {
94+
95+
}
96+
97+
response = Response(request.get(path, data, options))
98+
return_values = []
99+
100+
body = response.body
101+
body = body["sftp_settings"]
102+
103+
obj = processout.ProjectSFTPSettingsPublic(self._client)
104+
return_values.append(obj.fill_with_data(body))
105+
106+
return return_values[0]

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.33.0',
6+
version = '6.34.0',
77
description = 'ProcessOut API bindings.',
88
author = 'ProcessOut',
99
author_email = 'hi@processout.com',
1010
url = 'https://github.com/processout/processout-python',
11-
download_url = 'https://github.com/processout/processout-python/tarball/6.33.0',
11+
download_url = 'https://github.com/processout/processout-python/tarball/6.34.0',
1212
keywords = ['ProcessOut', 'api', 'bindings'],
1313
classifiers = [],
1414
)

0 commit comments

Comments
 (0)