From ac073527abb1897561a354c00c57928a05a38a0c Mon Sep 17 00:00:00 2001 From: ProcessOut Fountain Date: Fri, 16 Feb 2024 11:53:54 +0000 Subject: [PATCH] feat/add-new-transaction-and-invoice-fields --- processout/__init__.py | 1 - processout/apirequest.py | 338 -------------------------------------- processout/client.py | 6 - processout/invoice.py | 38 ++++- processout/payout.py | 20 +++ processout/transaction.py | 51 ++++++ setup.py | 4 +- 7 files changed, 110 insertions(+), 348 deletions(-) delete mode 100755 processout/apirequest.py diff --git a/processout/__init__.py b/processout/__init__.py index 5311750..b5661b8 100644 --- a/processout/__init__.py +++ b/processout/__init__.py @@ -4,7 +4,6 @@ # Import resources from processout.activity import Activity from processout.addon import Addon -from processout.apirequest import APIRequest from processout.apiversion import APIVersion from processout.applepayalternativemerchantcertificates import ApplePayAlternativeMerchantCertificates from processout.alternativemerchantcertificate import AlternativeMerchantCertificate diff --git a/processout/apirequest.py b/processout/apirequest.py deleted file mode 100755 index c15e78c..0000000 --- a/processout/apirequest.py +++ /dev/null @@ -1,338 +0,0 @@ -try: - from urllib.parse import quote_plus -except ImportError: - from urllib import quote_plus - -import processout -import json - -from processout.networking.request import Request -from processout.networking.response import Response - -# The content of this file was automatically generated - - -class APIRequest(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._api_version = None - self._idempotency_key = None - self._url = None - self._method = None - self._headers = None - self._body = None - self._response_code = None - self._response_headers = None - self._response_body = None - self._response_ms = None - self._sandbox = None - self._created_at = None - if prefill is not None: - self.fill_with_data(prefill) - - @property - def id(self): - """Get id""" - return self._id - - @id.setter - def id(self, val): - """Set id - Keyword argument: - val -- New id value""" - self._id = val - return self - - @property - def project(self): - """Get project""" - return self._project - - @project.setter - def project(self, val): - """Set project - Keyword argument: - val -- New project value""" - if val is None: - self._project = val - return self - - if isinstance(val, dict): - obj = processout.Project(self._client) - obj.fill_with_data(val) - self._project = obj - else: - self._project = val - return self - - @property - def api_version(self): - """Get api_version""" - return self._api_version - - @api_version.setter - def api_version(self, val): - """Set api_version - Keyword argument: - val -- New api_version value""" - if val is None: - self._api_version = val - return self - - if isinstance(val, dict): - obj = processout.APIVersion(self._client) - obj.fill_with_data(val) - self._api_version = obj - else: - self._api_version = val - return self - - @property - def idempotency_key(self): - """Get idempotency_key""" - return self._idempotency_key - - @idempotency_key.setter - def idempotency_key(self, val): - """Set idempotency_key - Keyword argument: - val -- New idempotency_key value""" - self._idempotency_key = val - return self - - @property - def url(self): - """Get url""" - return self._url - - @url.setter - def url(self, val): - """Set url - Keyword argument: - val -- New url value""" - self._url = val - return self - - @property - def method(self): - """Get method""" - return self._method - - @method.setter - def method(self, val): - """Set method - Keyword argument: - val -- New method value""" - self._method = val - return self - - @property - def headers(self): - """Get headers""" - return self._headers - - @headers.setter - def headers(self, val): - """Set headers - Keyword argument: - val -- New headers value""" - self._headers = val - return self - - @property - def body(self): - """Get body""" - return self._body - - @body.setter - def body(self, val): - """Set body - Keyword argument: - val -- New body value""" - self._body = val - return self - - @property - def response_code(self): - """Get response_code""" - return self._response_code - - @response_code.setter - def response_code(self, val): - """Set response_code - Keyword argument: - val -- New response_code value""" - self._response_code = val - return self - - @property - def response_headers(self): - """Get response_headers""" - return self._response_headers - - @response_headers.setter - def response_headers(self, val): - """Set response_headers - Keyword argument: - val -- New response_headers value""" - self._response_headers = val - return self - - @property - def response_body(self): - """Get response_body""" - return self._response_body - - @response_body.setter - def response_body(self, val): - """Set response_body - Keyword argument: - val -- New response_body value""" - self._response_body = val - return self - - @property - def response_ms(self): - """Get response_ms""" - return self._response_ms - - @response_ms.setter - def response_ms(self, val): - """Set response_ms - Keyword argument: - val -- New response_ms value""" - self._response_ms = val - return self - - @property - def sandbox(self): - """Get sandbox""" - return self._sandbox - - @sandbox.setter - def sandbox(self, val): - """Set sandbox - Keyword argument: - val -- New sandbox value""" - self._sandbox = val - return self - - @property - def created_at(self): - """Get created_at""" - return self._created_at - - @created_at.setter - def created_at(self, val): - """Set created_at - Keyword argument: - val -- New created_at value""" - self._created_at = val - return self - - def fill_with_data(self, data): - """Fill the current object with the new values pulled from data - Keyword argument: - data -- The data from which to pull the new values""" - if "id" in data.keys(): - self.id = data["id"] - if "project" in data.keys(): - self.project = data["project"] - if "api_version" in data.keys(): - self.api_version = data["api_version"] - if "idempotency_key" in data.keys(): - self.idempotency_key = data["idempotency_key"] - if "url" in data.keys(): - self.url = data["url"] - if "method" in data.keys(): - self.method = data["method"] - if "headers" in data.keys(): - self.headers = data["headers"] - if "body" in data.keys(): - self.body = data["body"] - if "response_code" in data.keys(): - self.response_code = data["response_code"] - if "response_headers" in data.keys(): - self.response_headers = data["response_headers"] - if "response_body" in data.keys(): - self.response_body = data["response_body"] - if "response_ms" in data.keys(): - self.response_ms = data["response_ms"] - if "sandbox" in data.keys(): - self.sandbox = data["sandbox"] - if "created_at" in data.keys(): - self.created_at = data["created_at"] - - return self - - def to_json(self): - return { - "id": self.id, - "project": self.project, - "api_version": self.api_version, - "idempotency_key": self.idempotency_key, - "url": self.url, - "method": self.method, - "headers": self.headers, - "body": self.body, - "response_code": self.response_code, - "response_headers": self.response_headers, - "response_body": self.response_body, - "response_ms": self.response_ms, - "sandbox": self.sandbox, - "created_at": self.created_at, - } - - def all(self, options={}): - """Get all the API requests. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/api-requests" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['api_requests']: - tmp = processout.APIRequest(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def find(self, api_request_id, options={}): - """Find an API request by its ID. - Keyword argument: - api_request_id -- ID of the API request - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/api-requests/{request_id}" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body["api_request"] - - obj = processout.APIRequest(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] diff --git a/processout/client.py b/processout/client.py index 8b1dcfa..6202376 100644 --- a/processout/client.py +++ b/processout/client.py @@ -44,12 +44,6 @@ def new_addon(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.Addon(self, prefill) - def new_api_request(self, prefill=None): - """Create a new APIRequest instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.APIRequest(self, prefill) - def new_api_version(self, prefill=None): """Create a new APIVersion instance Keyword argument: diff --git a/processout/invoice.py b/processout/invoice.py index dfe0e9b..a1015d0 100755 --- a/processout/invoice.py +++ b/processout/invoice.py @@ -30,6 +30,7 @@ def __init__(self, client, prefill=None): self._details = None self._url = None self._name = None + self._order_id = None self._amount = None self._currency = None self._merchant_initiator_type = None @@ -61,6 +62,7 @@ def __init__(self, client, prefill=None): self._payment_intent = None self._billing = None self._unsupported_feature_bypass = None + self._verification = None if prefill is not None: self.fill_with_data(prefill) @@ -303,6 +305,19 @@ def name(self, val): self._name = val return self + @property + def order_id(self): + """Get order_id""" + return self._order_id + + @order_id.setter + def order_id(self, val): + """Set order_id + Keyword argument: + val -- New order_id value""" + self._order_id = val + return self + @property def amount(self): """Get amount""" @@ -778,6 +793,19 @@ def unsupported_feature_bypass(self, val): self._unsupported_feature_bypass = val return self + @property + def verification(self): + """Get verification""" + return self._verification + + @verification.setter + def verification(self, val): + """Set verification + Keyword argument: + val -- New verification value""" + self._verification = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -810,6 +838,8 @@ def fill_with_data(self, data): self.url = data["url"] if "name" in data.keys(): self.name = data["name"] + if "order_id" in data.keys(): + self.order_id = data["order_id"] if "amount" in data.keys(): self.amount = data["amount"] if "currency" in data.keys(): @@ -872,6 +902,8 @@ def fill_with_data(self, data): self.billing = data["billing"] if "unsupported_feature_bypass" in data.keys(): self.unsupported_feature_bypass = data["unsupported_feature_bypass"] + if "verification" in data.keys(): + self.verification = data["verification"] return self @@ -891,6 +923,7 @@ def to_json(self): "details": self.details, "url": self.url, "name": self.name, + "order_id": self.order_id, "amount": self.amount, "currency": self.currency, "merchant_initiator_type": self.merchant_initiator_type, @@ -922,6 +955,7 @@ def to_json(self): "payment_intent": self.payment_intent, "billing": self.billing, "unsupported_feature_bypass": self.unsupported_feature_bypass, + "verification": self.verification, } def increment_authorization(self, amount, options={}): @@ -1249,6 +1283,7 @@ def create(self, options={}): data = { 'customer_id': self.customer_id, 'name': self.name, + 'order_id': self.order_id, 'amount': self.amount, 'currency': self.currency, 'metadata': self.metadata, @@ -1276,7 +1311,8 @@ def create(self, options={}): 'tax': self.tax, 'payment_type': self.payment_type, 'billing': self.billing, - 'unsupported_feature_bypass': self.unsupported_feature_bypass + 'unsupported_feature_bypass': self.unsupported_feature_bypass, + 'verification': self.verification } response = Response(request.post(path, data, options)) diff --git a/processout/payout.py b/processout/payout.py index bde7278..f01a615 100755 --- a/processout/payout.py +++ b/processout/payout.py @@ -456,3 +456,23 @@ def find(self, payout_id, options={}): return_values.append(obj.fill_with_data(body)) return return_values[0] + + def delete(self, payout_id, options={}): + """Delete the payout along with its payout items + Keyword argument: + payout_id -- ID of the payout + options -- Options for the request""" + self.fill_with_data(options) + + request = Request(self._client) + path = "/payouts/" + quote_plus(payout_id) + "" + data = { + + } + + response = Response(request.delete(path, data, options)) + return_values = [] + + return_values.append(response.success) + + return return_values[0] diff --git a/processout/transaction.py b/processout/transaction.py index b187001..b01414a 100755 --- a/processout/transaction.py +++ b/processout/transaction.py @@ -71,6 +71,9 @@ def __init__(self, client, prefill=None): self._created_at = None self._chargedback_at = None self._refunded_at = None + self._authorized_at = None + self._captured_at = None + self._voided_at = None self._three_d_s = None self._cvc_check = None self._avs_check = None @@ -895,6 +898,45 @@ def refunded_at(self, val): self._refunded_at = val return self + @property + def authorized_at(self): + """Get authorized_at""" + return self._authorized_at + + @authorized_at.setter + def authorized_at(self, val): + """Set authorized_at + Keyword argument: + val -- New authorized_at value""" + self._authorized_at = val + return self + + @property + def captured_at(self): + """Get captured_at""" + return self._captured_at + + @captured_at.setter + def captured_at(self, val): + """Set captured_at + Keyword argument: + val -- New captured_at value""" + self._captured_at = val + return self + + @property + def voided_at(self): + """Get voided_at""" + return self._voided_at + + @voided_at.setter + def voided_at(self, val): + """Set voided_at + Keyword argument: + val -- New voided_at value""" + self._voided_at = val + return self + @property def three_d_s(self): """Get three_d_s""" @@ -1145,6 +1187,12 @@ def fill_with_data(self, data): self.chargedback_at = data["chargedback_at"] if "refunded_at" in data.keys(): self.refunded_at = data["refunded_at"] + if "authorized_at" in data.keys(): + self.authorized_at = data["authorized_at"] + if "captured_at" in data.keys(): + self.captured_at = data["captured_at"] + if "voided_at" in data.keys(): + self.voided_at = data["voided_at"] if "three_d_s" in data.keys(): self.three_d_s = data["three_d_s"] if "cvc_check" in data.keys(): @@ -1223,6 +1271,9 @@ def to_json(self): "created_at": self.created_at, "chargedback_at": self.chargedback_at, "refunded_at": self.refunded_at, + "authorized_at": self.authorized_at, + "captured_at": self.captured_at, + "voided_at": self.voided_at, "three_d_s": self.three_d_s, "cvc_check": self.cvc_check, "avs_check": self.avs_check, diff --git a/setup.py b/setup.py index 6f56146..7f2763f 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name = 'processout', packages = ['processout', 'processout.errors', 'processout.networking'], - version = '6.31.0', + version = '6.32.0', description = 'ProcessOut API bindings.', author = 'ProcessOut', author_email = 'hi@processout.com', url = 'https://github.com/processout/processout-python', - download_url = 'https://github.com/processout/processout-python/tarball/6.31.0', + download_url = 'https://github.com/processout/processout-python/tarball/6.32.0', keywords = ['ProcessOut', 'api', 'bindings'], classifiers = [], )