Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion processout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
51 changes: 51 additions & 0 deletions processout/cardshipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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,
}
36 changes: 0 additions & 36 deletions processout/cardupdaterequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -65,19 +37,13 @@ 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"]

return self

def to_json(self):
return {
"update_type": self.update_type,
"update_reason": self.update_reason,
"preferred_scheme": self.preferred_scheme,
}

Expand All @@ -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
}

Expand Down
6 changes: 0 additions & 6 deletions processout/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
82 changes: 74 additions & 8 deletions processout/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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]
Loading