Skip to content

Commit 30b2990

Browse files
Manuel HuezManuel Huez
authored andcommitted
Add RetryDropLiabilityShift option on authorize/capture
1 parent e21b653 commit 30b2990

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

processout/invoice.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def authorize(self, source, options = {}):
510510
path = "/invoices/" + quote_plus(self.id) + "/authorize"
511511
data = {
512512
'synchronous': options.get("synchronous"),
513-
'prioritized_gateway_configuration_id': options.get("prioritized_gateway_configuration_id"),
513+
'retry_drop_liability_shift': options.get("retry_drop_liability_shift"),
514514
'source': source
515515
}
516516

@@ -537,6 +537,7 @@ def capture(self, source, options = {}):
537537
data = {
538538
'authorize_only': options.get("authorize_only"),
539539
'synchronous': options.get("synchronous"),
540+
'retry_drop_liability_shift': options.get("retry_drop_liability_shift"),
540541
'source': source
541542
}
542543

processout/networking/request.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def _get_headers(self, options):
2525
"""Return the headers sent with the request"""
2626
headers = {}
2727
headers["API-Version"] = "1.4.0.0"
28+
headers["User-Agent"] = "ProcessOut Python-Bindings/6.9.0"
2829

2930
if options is None:
3031
return headers

processout/project.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -232,34 +232,35 @@ def fill_with_data(self, data):
232232

233233
return self
234234

235-
def fetch(self, options = {}):
236-
"""Fetch the current project information.
235+
def regenerate_private_key(self, options = {}):
236+
"""Regenerate the project private key. Make sure to store the new private key and use it in any future request.
237237
Keyword argument:
238238
239239
options -- Options for the request"""
240240
self.fill_with_data(options)
241241

242242
request = Request(self._client)
243-
path = "/projects/" + quote_plus(self.id) + ""
243+
path = "/private-keys"
244244
data = {
245245

246246
}
247247

248-
response = Response(request.get(path, data, options))
248+
response = Response(request.post(path, data, options))
249249
return_values = []
250250

251251
body = response.body
252252
body = body["project"]
253253

254254

255-
return_values.append(self.fill_with_data(body))
255+
obj = processout.Project(self._client)
256+
return_values.append(obj.fill_with_data(body))
256257

257258

258259

259260
return return_values[0]
260261

261-
def save(self, options = {}):
262-
"""Save the updated project's attributes.
262+
def fetch(self, options = {}):
263+
"""Fetch the current project information.
263264
Keyword argument:
264265
265266
options -- Options for the request"""
@@ -271,7 +272,7 @@ def save(self, options = {}):
271272

272273
}
273274

274-
response = Response(request.put(path, data, options))
275+
response = Response(request.get(path, data, options))
275276
return_values = []
276277

277278
body = response.body
@@ -284,50 +285,49 @@ def save(self, options = {}):
284285

285286
return return_values[0]
286287

287-
def delete(self, options = {}):
288-
"""Delete the project. Be careful! Executing this request will prevent any further interaction with the API that uses this project.
288+
def save(self, options = {}):
289+
"""Save the updated project's attributes.
289290
Keyword argument:
290291
291292
options -- Options for the request"""
292293
self.fill_with_data(options)
293294

294295
request = Request(self._client)
295-
path = "/projects/{project_id}"
296+
path = "/projects/" + quote_plus(self.id) + ""
296297
data = {
297298

298299
}
299300

300-
response = Response(request.delete(path, data, options))
301+
response = Response(request.put(path, data, options))
301302
return_values = []
302303

303-
return_values.append(response.success)
304+
body = response.body
305+
body = body["project"]
306+
307+
308+
return_values.append(self.fill_with_data(body))
309+
304310

305311

306312
return return_values[0]
307313

308-
def regenerate_private_key(self, options = {}):
309-
"""Regenerate the project private key. Make sure to store the new private key and use it in any future request.
314+
def delete(self, options = {}):
315+
"""Delete the project. Be careful! Executing this request will prevent any further interaction with the API that uses this project.
310316
Keyword argument:
311317
312318
options -- Options for the request"""
313319
self.fill_with_data(options)
314320

315321
request = Request(self._client)
316-
path = "/projects/{project_id}/private-key"
322+
path = "/projects/{project_id}"
317323
data = {
318324

319325
}
320326

321-
response = Response(request.post(path, data, options))
327+
response = Response(request.delete(path, data, options))
322328
return_values = []
323329

324-
body = response.body
325-
body = body["project"]
326-
327-
328-
obj = processout.Project(self._client)
329-
return_values.append(obj.fill_with_data(body))
330-
330+
return_values.append(response.success)
331331

332332

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

spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def main():
1919
assert invoice.id == fetched.id, "The invoices ID should be equal"
2020

2121
# Capture an invoice
22-
gr = GatewayRequest("sandbox", "POST", "https://processout.com", {
22+
gr = GatewayRequest("sandbox", "POST", "https://processout.com?token=test-valid", {
2323
"Content-Type": "application/json"
24-
}, "{\"token\": \"test-valid\"}")
24+
}, "")
2525
transaction = invoice.capture(gr.to_string())
2626
assert transaction.status == "completed", "The transaction status was not completed"
2727

0 commit comments

Comments
 (0)