diff --git a/processout/__init__.py b/processout/__init__.py index c08b9b1..b7a744d 100644 --- a/processout/__init__.py +++ b/processout/__init__.py @@ -65,7 +65,6 @@ from processout.nativeapmtransactiondetailsgateway import NativeAPMTransactionDetailsGateway from processout.nativeapmtransactiondetailsinvoice import NativeAPMTransactionDetailsInvoice from processout.nativeapmtransactiondetails import NativeAPMTransactionDetails -from processout.invoicesprocessnativepaymentresponse import InvoicesProcessNativePaymentResponse from processout.gatewayrequest import GatewayRequest diff --git a/processout/cardshipping.py b/processout/cardshipping.py index ed9dea6..66962bc 100755 --- a/processout/cardshipping.py +++ b/processout/cardshipping.py @@ -23,6 +23,9 @@ def __init__(self, client, prefill=None): self._country_code = None self._zip = None self._phone = None + self._first_name = None + self._last_name = None + self._email = None if prefill is not None: self.fill_with_data(prefill) @@ -126,6 +129,45 @@ def phone(self, val): self._phone = val return self + @property + def first_name(self): + """Get first_name""" + return self._first_name + + @first_name.setter + def first_name(self, val): + """Set first_name + Keyword argument: + val -- New first_name value""" + self._first_name = val + return self + + @property + def last_name(self): + """Get last_name""" + return self._last_name + + @last_name.setter + def last_name(self, val): + """Set last_name + Keyword argument: + val -- New last_name value""" + self._last_name = val + return self + + @property + def email(self): + """Get email""" + return self._email + + @email.setter + def email(self, val): + """Set email + Keyword argument: + val -- New email value""" + self._email = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -144,6 +186,12 @@ def fill_with_data(self, data): self.zip = data["zip"] if "phone" in data.keys(): self.phone = data["phone"] + if "first_name" in data.keys(): + self.first_name = data["first_name"] + if "last_name" in data.keys(): + self.last_name = data["last_name"] + if "email" in data.keys(): + self.email = data["email"] return self @@ -156,4 +204,7 @@ def to_json(self): "country_code": self.country_code, "zip": self.zip, "phone": self.phone, + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, } diff --git a/processout/cardupdaterequest.py b/processout/cardupdaterequest.py index d48fbe9..94f6050 100755 --- a/processout/cardupdaterequest.py +++ b/processout/cardupdaterequest.py @@ -16,38 +16,10 @@ class CardUpdateRequest(object): def __init__(self, client, prefill=None): self._client = client - self._update_type = None - self._update_reason = None self._preferred_scheme = None if prefill is not None: self.fill_with_data(prefill) - @property - def update_type(self): - """Get update_type""" - return self._update_type - - @update_type.setter - def update_type(self, val): - """Set update_type - Keyword argument: - val -- New update_type value""" - self._update_type = val - return self - - @property - def update_reason(self): - """Get update_reason""" - return self._update_reason - - @update_reason.setter - def update_reason(self, val): - """Set update_reason - Keyword argument: - val -- New update_reason value""" - self._update_reason = val - return self - @property def preferred_scheme(self): """Get preferred_scheme""" @@ -65,10 +37,6 @@ 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 "update_type" in data.keys(): - self.update_type = data["update_type"] - if "update_reason" in data.keys(): - self.update_reason = data["update_reason"] if "preferred_scheme" in data.keys(): self.preferred_scheme = data["preferred_scheme"] @@ -76,8 +44,6 @@ def fill_with_data(self, data): def to_json(self): return { - "update_type": self.update_type, - "update_reason": self.update_reason, "preferred_scheme": self.preferred_scheme, } @@ -91,8 +57,6 @@ def update(self, card_id, options={}): request = Request(self._client) path = "/cards/" + quote_plus(card_id) + "" data = { - 'update_type': self.update_type, - 'update_reason': self.update_reason, 'preferred_scheme': self.preferred_scheme } diff --git a/processout/client.py b/processout/client.py index 35cded2..0e2eeb0 100644 --- a/processout/client.py +++ b/processout/client.py @@ -410,9 +410,3 @@ def new_native_apm_transaction_details(self, prefill=None): Keyword argument: prefill -- Data used to prefill the object (optional)""" return processout.NativeAPMTransactionDetails(self, prefill) - - def new_invoices_process_native_payment_response(self, prefill=None): - """Create a new InvoicesProcessNativePaymentResponse instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.InvoicesProcessNativePaymentResponse(self, prefill) diff --git a/processout/invoice.py b/processout/invoice.py index 53d0442..bbf2783 100755 --- a/processout/invoice.py +++ b/processout/invoice.py @@ -29,6 +29,7 @@ def __init__(self, client, prefill=None): self._token_id = None self._details = None self._url = None + self._url_qrcode = None self._name = None self._order_id = None self._amount = None @@ -47,6 +48,7 @@ def __init__(self, client, prefill=None): self._require_backend_capture = None self._sandbox = None self._created_at = None + self._expires_at = None self._risk = None self._shipping = None self._device = None @@ -293,6 +295,19 @@ def url(self, val): self._url = val return self + @property + def url_qrcode(self): + """Get url_qrcode""" + return self._url_qrcode + + @url_qrcode.setter + def url_qrcode(self, val): + """Set url_qrcode + Keyword argument: + val -- New url_qrcode value""" + self._url_qrcode = val + return self + @property def name(self): """Get name""" @@ -527,6 +542,19 @@ def created_at(self, val): self._created_at = val return self + @property + def expires_at(self): + """Get expires_at""" + return self._expires_at + + @expires_at.setter + def expires_at(self, val): + """Set expires_at + Keyword argument: + val -- New expires_at value""" + self._expires_at = val + return self + @property def risk(self): """Get risk""" @@ -850,6 +878,8 @@ def fill_with_data(self, data): self.details = data["details"] if "url" in data.keys(): self.url = data["url"] + if "url_qrcode" in data.keys(): + self.url_qrcode = data["url_qrcode"] if "name" in data.keys(): self.name = data["name"] if "order_id" in data.keys(): @@ -886,6 +916,8 @@ def fill_with_data(self, data): self.sandbox = data["sandbox"] if "created_at" in data.keys(): self.created_at = data["created_at"] + if "expires_at" in data.keys(): + self.expires_at = data["expires_at"] if "risk" in data.keys(): self.risk = data["risk"] if "shipping" in data.keys(): @@ -938,6 +970,7 @@ def to_json(self): "token_id": self.token_id, "details": self.details, "url": self.url, + "url_qrcode": self.url_qrcode, "name": self.name, "order_id": self.order_id, "amount": self.amount, @@ -956,6 +989,7 @@ def to_json(self): "require_backend_capture": self.require_backend_capture, "sandbox": self.sandbox, "created_at": self.created_at, + "expires_at": self.expires_at, "risk": self.risk, "shipping": self.shipping, "device": self.device, @@ -1028,8 +1062,12 @@ def authorize(self, source, options={}): body = body["transaction"] transaction = processout.Transaction(self._client) return_values.append(transaction.fill_with_data(body)) + body = response.body + body = body["customer_action"] + customerAction = processout.CustomerAction(self._client) + return_values.append(customerAction.fill_with_data(body)) - return return_values[0] + return tuple(return_values) def capture(self, source, options={}): """Capture the invoice using the given source (customer or token) @@ -1061,8 +1099,12 @@ def capture(self, source, options={}): body = body["transaction"] transaction = processout.Transaction(self._client) return_values.append(transaction.fill_with_data(body)) + body = response.body + body = body["customer_action"] + customerAction = processout.CustomerAction(self._client) + return_values.append(customerAction.fill_with_data(body)) - return return_values[0] + return tuple(return_values) def fetch_customer(self, options={}): """Get the customer linked to the invoice. @@ -1183,12 +1225,15 @@ def process_native_payment(self, invoice_id, options={}): return_values = [] body = response.body - invoicesProcessNativePaymentResponse = processout.InvoicesProcessNativePaymentResponse( - self._client) - return_values.append( - invoicesProcessNativePaymentResponse.fill_with_data(body)) + body = body["transaction"] + transaction = processout.Transaction(self._client) + return_values.append(transaction.fill_with_data(body)) + body = response.body + body = body["native_apm"] + nativeAPMResponse = processout.NativeAPMResponse(self._client) + return_values.append(nativeAPMResponse.fill_with_data(body)) - return return_values[0] + return tuple(return_values) def initiate_three_d_s(self, source, options={}): """Initiate a 3-D Secure authentication @@ -1330,7 +1375,8 @@ def create(self, options={}): 'billing': self.billing, 'unsupported_feature_bypass': self.unsupported_feature_bypass, 'verification': self.verification, - 'auto_capture_at': self.auto_capture_at + 'auto_capture_at': self.auto_capture_at, + 'expires_at': self.expires_at } response = Response(request.post(path, data, options)) @@ -1366,3 +1412,23 @@ def find(self, invoice_id, options={}): return_values.append(obj.fill_with_data(body)) return return_values[0] + + def delete(self, invoice_id, options={}): + """Delete an invoice by its ID. Only invoices that have not been used yet can be deleted. + Keyword argument: + invoice_id -- ID of the invoice + options -- Options for the request""" + self.fill_with_data(options) + + request = Request(self._client) + path = "/invoices/" + quote_plus(invoice_id) + "" + data = { + + } + + response = Response(request.delete(path, data, options)) + return_values = [] + + return_values.append(response.success) + + return return_values[0] diff --git a/processout/invoiceshipping.py b/processout/invoiceshipping.py index deb0c99..e06f44c 100755 --- a/processout/invoiceshipping.py +++ b/processout/invoiceshipping.py @@ -30,6 +30,9 @@ def __init__(self, client, prefill=None): self._phone = None self._expects_shipping_at = None self._relay_store_name = None + self._first_name = None + self._last_name = None + self._email = None if prefill is not None: self.fill_with_data(prefill) @@ -224,6 +227,45 @@ def relay_store_name(self, val): self._relay_store_name = val return self + @property + def first_name(self): + """Get first_name""" + return self._first_name + + @first_name.setter + def first_name(self, val): + """Set first_name + Keyword argument: + val -- New first_name value""" + self._first_name = val + return self + + @property + def last_name(self): + """Get last_name""" + return self._last_name + + @last_name.setter + def last_name(self, val): + """Set last_name + Keyword argument: + val -- New last_name value""" + self._last_name = val + return self + + @property + def email(self): + """Get email""" + return self._email + + @email.setter + def email(self, val): + """Set email + Keyword argument: + val -- New email value""" + self._email = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -256,6 +298,12 @@ def fill_with_data(self, data): self.expects_shipping_at = data["expects_shipping_at"] if "relay_store_name" in data.keys(): self.relay_store_name = data["relay_store_name"] + if "first_name" in data.keys(): + self.first_name = data["first_name"] + if "last_name" in data.keys(): + self.last_name = data["last_name"] + if "email" in data.keys(): + self.email = data["email"] return self @@ -275,4 +323,7 @@ def to_json(self): "phone": self.phone, "expects_shipping_at": self.expects_shipping_at, "relay_store_name": self.relay_store_name, + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, } diff --git a/processout/invoicesprocessnativepaymentresponse.py b/processout/invoicesprocessnativepaymentresponse.py deleted file mode 100755 index 2f4405e..0000000 --- a/processout/invoicesprocessnativepaymentresponse.py +++ /dev/null @@ -1,83 +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 InvoicesProcessNativePaymentResponse(object): - def __init__(self, client, prefill=None): - self._client = client - - self._transaction = None - self._native_apm = None - if prefill is not None: - self.fill_with_data(prefill) - - @property - def transaction(self): - """Get transaction""" - return self._transaction - - @transaction.setter - def transaction(self, val): - """Set transaction - Keyword argument: - val -- New transaction value""" - if val is None: - self._transaction = val - return self - - if isinstance(val, dict): - obj = processout.Transaction(self._client) - obj.fill_with_data(val) - self._transaction = obj - else: - self._transaction = val - return self - - @property - def native_apm(self): - """Get native_apm""" - return self._native_apm - - @native_apm.setter - def native_apm(self, val): - """Set native_apm - Keyword argument: - val -- New native_apm value""" - if val is None: - self._native_apm = val - return self - - if isinstance(val, dict): - obj = processout.NativeAPMResponse(self._client) - obj.fill_with_data(val) - self._native_apm = obj - else: - self._native_apm = 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 "transaction" in data.keys(): - self.transaction = data["transaction"] - if "native_apm" in data.keys(): - self.native_apm = data["native_apm"] - - return self - - def to_json(self): - return { - "transaction": self.transaction, - "native_apm": self.native_apm, - } diff --git a/processout/project.py b/processout/project.py index 6b66e33..788c597 100755 --- a/processout/project.py +++ b/processout/project.py @@ -354,7 +354,8 @@ def create_supervised(self, options={}): 'name': self.name, 'default_currency': self.default_currency, 'dunning_configuration': self.dunning_configuration, - 'applepay_settings': options.get("applepay_settings") + 'applepay_settings': options.get("applepay_settings"), + 'public_metadata': options.get("public_metadata") } response = Response(request.post(path, data, options)) diff --git a/processout/token.py b/processout/token.py index 6114752..4d3fd46 100755 --- a/processout/token.py +++ b/processout/token.py @@ -516,7 +516,8 @@ def create(self, options={}): 'verify_metadata': options.get("verify_metadata"), 'set_default': options.get("set_default"), 'verify_statement_descriptor': options.get("verify_statement_descriptor"), - 'invoice_return_url': options.get("invoice_return_url")} + 'invoice_return_url': options.get("invoice_return_url"), + 'summary': options.get("summary")} response = Response(request.post(path, data, options)) return_values = [] diff --git a/processout/transaction.py b/processout/transaction.py index b01414a..013e888 100755 --- a/processout/transaction.py +++ b/processout/transaction.py @@ -1363,6 +1363,33 @@ def all(self, options={}): return return_values[0] + def list(self, options={}): + """Get full transactions data for specified list of ids. + Keyword argument: + + options -- Options for the request""" + self.fill_with_data(options) + + request = Request(self._client) + path = "/transactions" + data = { + + } + + response = Response(request.post(path, data, options)) + return_values = [] + + a = [] + body = response.body + for v in body['transactions']: + tmp = processout.Transaction(self._client) + tmp.fill_with_data(v) + a.append(tmp) + + return_values.append(a) + + return return_values[0] + def find(self, transaction_id, options={}): """Find a transaction by its ID. Keyword argument: diff --git a/setup.py b/setup.py index 94fa80a..7ad6f33 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name = 'processout', packages = ['processout', 'processout.errors', 'processout.networking'], - version = '6.35.0', + version = '7.0.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.35.0', + download_url = 'https://github.com/processout/processout-python/tarball/7.0.0', keywords = ['ProcessOut', 'api', 'bindings'], classifiers = [], )