diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e03ded..e065e1f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: go-semantic-release/action@v1 + - uses: go-semantic-release/action@v1.24.1 id: semrel with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/processout/__init__.py b/processout/__init__.py index 50692f0..cfe2edf 100644 --- a/processout/__init__.py +++ b/processout/__init__.py @@ -2,8 +2,6 @@ from processout.client import ProcessOut # Import resources -from processout.activity import Activity -from processout.addon import Addon from processout.apiversion import APIVersion from processout.applepayalternativemerchantcertificates import ApplePayAlternativeMerchantCertificates from processout.alternativemerchantcertificate import AlternativeMerchantCertificate @@ -13,11 +11,9 @@ from processout.card import Card from processout.cardinformation import CardInformation from processout.phone import Phone -from processout.coupon import Coupon from processout.customer import Customer from processout.customerphone import CustomerPhone from processout.token import Token -from processout.discount import Discount from processout.event import Event from processout.exportlayout import ExportLayout from processout.exportlayoutconfiguration import ExportLayoutConfiguration @@ -49,13 +45,11 @@ from processout.payout import Payout from processout.payoutitem import PayoutItem from processout.payoutitemamountbreakdowns import PayoutItemAmountBreakdowns -from processout.plan import Plan from processout.product import Product from processout.project import Project from processout.projectsftpsettings import ProjectSFTPSettings from processout.projectsftpsettingspublic import ProjectSFTPSettingsPublic from processout.refund import Refund -from processout.subscription import Subscription from processout.transaction import Transaction from processout.nativeapmresponse import NativeAPMResponse from processout.nativeapmparameterdefinition import NativeAPMParameterDefinition @@ -67,11 +61,11 @@ from processout.transactionoperation import TransactionOperation from processout.webhook import Webhook from processout.webhookendpoint import WebhookEndpoint +from processout.cardupdaterequest import CardUpdateRequest +from processout.cardcreaterequest import CardCreateRequest from processout.device import Device from processout.cardcontact import CardContact from processout.cardshipping import CardShipping -from processout.cardupdaterequest import CardUpdateRequest -from processout.cardcreaterequest import CardCreateRequest from processout.errorcodes import ErrorCodes from processout.categoryerrorcodes import CategoryErrorCodes from processout.externalthreeds import ExternalThreeDS diff --git a/processout/activity.py b/processout/activity.py deleted file mode 100755 index 71bb652..0000000 --- a/processout/activity.py +++ /dev/null @@ -1,212 +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 Activity(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._title = None - self._content = None - self._level = 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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = val - return self - - @property - def title(self): - """Get title""" - return self._title - - @title.setter - def title(self, val): - """Set title - Keyword argument: - val -- New title value""" - self._title = val - return self - - @property - def content(self): - """Get content""" - return self._content - - @content.setter - def content(self, val): - """Set content - Keyword argument: - val -- New content value""" - self._content = val - return self - - @property - def level(self): - """Get level""" - return self._level - - @level.setter - def level(self, val): - """Set level - Keyword argument: - val -- New level value""" - self._level = 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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "title" in data.keys(): - self.title = data["title"] - if "content" in data.keys(): - self.content = data["content"] - if "level" in data.keys(): - self.level = data["level"] - 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, - "project_id": self.project_id, - "title": self.title, - "content": self.content, - "level": self.level, - "created_at": self.created_at, - } - - def all(self, options={}): - """Get all the project activities. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/activities" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['activities']: - tmp = processout.Activity(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def find(self, activity_id, options={}): - """Find a specific activity and fetch its data. - Keyword argument: - activity_id -- ID of the activity - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/activities/" + quote_plus(activity_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("activity") - - if body is not None: - - obj = processout.Activity(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] diff --git a/processout/addon.py b/processout/addon.py deleted file mode 100755 index 613b5d4..0000000 --- a/processout/addon.py +++ /dev/null @@ -1,442 +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 Addon(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._subscription = None - self._subscription_id = None - self._plan = None - self._plan_id = None - self._type = None - self._name = None - self._amount = None - self._quantity = None - self._metadata = 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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = val - return self - - @property - def subscription(self): - """Get subscription""" - return self._subscription - - @subscription.setter - def subscription(self, val): - """Set subscription - Keyword argument: - val -- New subscription value""" - if val is None: - self._subscription = val - return self - - if isinstance(val, dict): - obj = processout.Subscription(self._client) - obj.fill_with_data(val) - self._subscription = obj - else: - self._subscription = val - return self - - @property - def subscription_id(self): - """Get subscription_id""" - return self._subscription_id - - @subscription_id.setter - def subscription_id(self, val): - """Set subscription_id - Keyword argument: - val -- New subscription_id value""" - self._subscription_id = val - return self - - @property - def plan(self): - """Get plan""" - return self._plan - - @plan.setter - def plan(self, val): - """Set plan - Keyword argument: - val -- New plan value""" - if val is None: - self._plan = val - return self - - if isinstance(val, dict): - obj = processout.Plan(self._client) - obj.fill_with_data(val) - self._plan = obj - else: - self._plan = val - return self - - @property - def plan_id(self): - """Get plan_id""" - return self._plan_id - - @plan_id.setter - def plan_id(self, val): - """Set plan_id - Keyword argument: - val -- New plan_id value""" - self._plan_id = val - return self - - @property - def type(self): - """Get type""" - return self._type - - @type.setter - def type(self, val): - """Set type - Keyword argument: - val -- New type value""" - self._type = val - return self - - @property - def name(self): - """Get name""" - return self._name - - @name.setter - def name(self, val): - """Set name - Keyword argument: - val -- New name value""" - self._name = val - return self - - @property - def amount(self): - """Get amount""" - return self._amount - - @amount.setter - def amount(self, val): - """Set amount - Keyword argument: - val -- New amount value""" - self._amount = val - return self - - @property - def quantity(self): - """Get quantity""" - return self._quantity - - @quantity.setter - def quantity(self, val): - """Set quantity - Keyword argument: - val -- New quantity value""" - self._quantity = val - return self - - @property - def metadata(self): - """Get metadata""" - return self._metadata - - @metadata.setter - def metadata(self, val): - """Set metadata - Keyword argument: - val -- New metadata value""" - self._metadata = 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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "subscription" in data.keys(): - self.subscription = data["subscription"] - if "subscription_id" in data.keys(): - self.subscription_id = data["subscription_id"] - if "plan" in data.keys(): - self.plan = data["plan"] - if "plan_id" in data.keys(): - self.plan_id = data["plan_id"] - if "type" in data.keys(): - self.type = data["type"] - if "name" in data.keys(): - self.name = data["name"] - if "amount" in data.keys(): - self.amount = data["amount"] - if "quantity" in data.keys(): - self.quantity = data["quantity"] - if "metadata" in data.keys(): - self.metadata = data["metadata"] - 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, - "project_id": self.project_id, - "subscription": self.subscription, - "subscription_id": self.subscription_id, - "plan": self.plan, - "plan_id": self.plan_id, - "type": self.type, - "name": self.name, - "amount": self.amount, - "quantity": self.quantity, - "metadata": self.metadata, - "sandbox": self.sandbox, - "created_at": self.created_at, - } - - def fetch_subscription_addons(self, subscription_id, options={}): - """Get the addons applied to the subscription. - Keyword argument: - subscription_id -- ID of the subscription - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(subscription_id) + "/addons" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['addons']: - tmp = processout.Addon(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create(self, options={}): - """Create a new addon to the given subscription ID. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.subscription_id) + "/addons" - data = { - 'plan_id': self.plan_id, - 'type': self.type, - 'name': self.name, - 'amount': self.amount, - 'quantity': self.quantity, - 'metadata': self.metadata, - 'prorate': options.get("prorate"), - 'proration_date': options.get("proration_date"), - 'preview': options.get("preview") - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("addon") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def find(self, subscription_id, addon_id, options={}): - """Find a subscription's addon by its ID. - Keyword argument: - subscription_id -- ID of the subscription on which the addon was applied - addon_id -- ID of the addon - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(subscription_id) + "/addons/" + quote_plus(addon_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("addon") - - if body is not None: - - obj = processout.Addon(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] - - def save(self, options={}): - """Save the updated addon attributes. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.subscription_id) + "/addons/" + quote_plus(self.id) + "" - data = { - 'plan_id': self.plan_id, - 'type': self.type, - 'name': self.name, - 'amount': self.amount, - 'quantity': self.quantity, - 'metadata': self.metadata, - 'prorate': options.get("prorate"), - 'proration_date': options.get("proration_date"), - 'preview': options.get("preview"), - 'increment_quantity_by': options.get("increment_quantity_by") - } - - response = Response(request.put(path, data, options)) - return_values = [] - - body = response.body - body = body.get("addon") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def delete(self, options={}): - """Delete an addon applied to a subscription. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.subscription_id) + "/addons/" + quote_plus(self.id) + "" - data = { - 'prorate': options.get("prorate"), - 'proration_date': options.get("proration_date"), - 'preview': options.get("preview") - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] diff --git a/processout/card.py b/processout/card.py index a5c465c..0f95723 100755 --- a/processout/card.py +++ b/processout/card.py @@ -49,6 +49,8 @@ def __init__(self, client, prefill=None): self._expires_soon = None self._sandbox = None self._created_at = None + self._preferred_card_type = None + self._vault_id = None if prefill is not None: self.fill_with_data(prefill) @@ -499,6 +501,32 @@ def created_at(self, val): self._created_at = val return self + @property + def preferred_card_type(self): + """Get preferred_card_type""" + return self._preferred_card_type + + @preferred_card_type.setter + def preferred_card_type(self, val): + """Set preferred_card_type + Keyword argument: + val -- New preferred_card_type value""" + self._preferred_card_type = val + return self + + @property + def vault_id(self): + """Get vault_id""" + return self._vault_id + + @vault_id.setter + def vault_id(self, val): + """Set vault_id + Keyword argument: + val -- New vault_id value""" + self._vault_id = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -569,6 +597,10 @@ def fill_with_data(self, data): self.sandbox = data["sandbox"] if "created_at" in data.keys(): self.created_at = data["created_at"] + if "preferred_card_type" in data.keys(): + self.preferred_card_type = data["preferred_card_type"] + if "vault_id" in data.keys(): + self.vault_id = data["vault_id"] return self @@ -607,6 +639,8 @@ def to_json(self): "expires_soon": self.expires_soon, "sandbox": self.sandbox, "created_at": self.created_at, + "preferred_card_type": self.preferred_card_type, + "vault_id": self.vault_id, } def all(self, options={}): diff --git a/processout/cardcreaterequest.py b/processout/cardcreaterequest.py index 8aa4a05..c94ef49 100755 --- a/processout/cardcreaterequest.py +++ b/processout/cardcreaterequest.py @@ -24,6 +24,7 @@ def __init__(self, client, prefill=None): self._exp_year = None self._cvc2 = None self._preferred_scheme = None + self._preferred_card_type = None self._metadata = None self._token_type = None self._eci = None @@ -149,6 +150,19 @@ def preferred_scheme(self, val): self._preferred_scheme = val return self + @property + def preferred_card_type(self): + """Get preferred_card_type""" + return self._preferred_card_type + + @preferred_card_type.setter + def preferred_card_type(self, val): + """Set preferred_card_type + Keyword argument: + val -- New preferred_card_type value""" + self._preferred_card_type = val + return self + @property def metadata(self): """Get metadata""" @@ -304,6 +318,8 @@ def fill_with_data(self, data): self.cvc2 = data["cvc2"] if "preferred_scheme" in data.keys(): self.preferred_scheme = data["preferred_scheme"] + if "preferred_card_type" in data.keys(): + self.preferred_card_type = data["preferred_card_type"] if "metadata" in data.keys(): self.metadata = data["metadata"] if "token_type" in data.keys(): @@ -335,6 +351,7 @@ def to_json(self): "exp_year": self.exp_year, "cvc2": self.cvc2, "preferred_scheme": self.preferred_scheme, + "preferred_card_type": self.preferred_card_type, "metadata": self.metadata, "token_type": self.token_type, "eci": self.eci, @@ -364,6 +381,7 @@ def create(self, options={}): 'exp_year': self.exp_year, 'cvc2': self.cvc2, 'preferred_scheme': self.preferred_scheme, + 'preferred_card_type': self.preferred_card_type, 'metadata': self.metadata, 'token_type': self.token_type, 'eci': self.eci, @@ -372,7 +390,8 @@ def create(self, options={}): 'applepay_mid': self.applepay_mid, 'payment_token': self.payment_token, 'contact': self.contact, - 'shipping': self.shipping + 'shipping': self.shipping, + 'scheme_transaction': self.scheme_transaction } response = Response(request.post(path, data, options)) diff --git a/processout/cardupdaterequest.py b/processout/cardupdaterequest.py index aa8f2ef..5894752 100755 --- a/processout/cardupdaterequest.py +++ b/processout/cardupdaterequest.py @@ -17,6 +17,7 @@ def __init__(self, client, prefill=None): self._client = client self._preferred_scheme = None + self._preferred_card_type = None if prefill is not None: self.fill_with_data(prefill) @@ -33,18 +34,34 @@ def preferred_scheme(self, val): self._preferred_scheme = val return self + @property + def preferred_card_type(self): + """Get preferred_card_type""" + return self._preferred_card_type + + @preferred_card_type.setter + def preferred_card_type(self, val): + """Set preferred_card_type + Keyword argument: + val -- New preferred_card_type value""" + self._preferred_card_type = 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 "preferred_scheme" in data.keys(): self.preferred_scheme = data["preferred_scheme"] + if "preferred_card_type" in data.keys(): + self.preferred_card_type = data["preferred_card_type"] return self def to_json(self): return { "preferred_scheme": self.preferred_scheme, + "preferred_card_type": self.preferred_card_type, } def update(self, card_id, options={}): @@ -57,7 +74,8 @@ def update(self, card_id, options={}): request = Request(self._client) path = "/cards/" + quote_plus(card_id) + "" data = { - 'preferred_scheme': self.preferred_scheme + 'preferred_scheme': self.preferred_scheme, + 'scheme_transaction': self.scheme_transaction } response = Response(request.put(path, data, options)) diff --git a/processout/client.py b/processout/client.py index a051d14..bb220d9 100644 --- a/processout/client.py +++ b/processout/client.py @@ -32,18 +32,6 @@ def project_secret(self): """Get the project secret""" return self._project_secret - def new_activity(self, prefill=None): - """Create a new Activity instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Activity(self, prefill) - - def new_addon(self, prefill=None): - """Create a new Addon instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Addon(self, prefill) - def new_api_version(self, prefill=None): """Create a new APIVersion instance Keyword argument: @@ -99,12 +87,6 @@ def new_phone(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.Phone(self, prefill) - def new_coupon(self, prefill=None): - """Create a new Coupon instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Coupon(self, prefill) - def new_customer(self, prefill=None): """Create a new Customer instance Keyword argument: @@ -123,12 +105,6 @@ def new_token(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.Token(self, prefill) - def new_discount(self, prefill=None): - """Create a new Discount instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Discount(self, prefill) - def new_event(self, prefill=None): """Create a new Event instance Keyword argument: @@ -319,12 +295,6 @@ def new_payout_item_amount_breakdowns(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.PayoutItemAmountBreakdowns(self, prefill) - def new_plan(self, prefill=None): - """Create a new Plan instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Plan(self, prefill) - def new_product(self, prefill=None): """Create a new Product instance Keyword argument: @@ -355,12 +325,6 @@ def new_refund(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.Refund(self, prefill) - def new_subscription(self, prefill=None): - """Create a new Subscription instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.Subscription(self, prefill) - def new_transaction(self, prefill=None): """Create a new Transaction instance Keyword argument: @@ -427,6 +391,18 @@ def new_webhook_endpoint(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.WebhookEndpoint(self, prefill) + def new_card_update_request(self, prefill=None): + """Create a new CardUpdateRequest instance + Keyword argument: + prefill -- Data used to prefill the object (optional)""" + return processout.CardUpdateRequest(self, prefill) + + def new_card_create_request(self, prefill=None): + """Create a new CardCreateRequest instance + Keyword argument: + prefill -- Data used to prefill the object (optional)""" + return processout.CardCreateRequest(self, prefill) + def new_device(self, prefill=None): """Create a new Device instance Keyword argument: @@ -445,18 +421,6 @@ def new_card_shipping(self, prefill=None): prefill -- Data used to prefill the object (optional)""" return processout.CardShipping(self, prefill) - def new_card_update_request(self, prefill=None): - """Create a new CardUpdateRequest instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.CardUpdateRequest(self, prefill) - - def new_card_create_request(self, prefill=None): - """Create a new CardCreateRequest instance - Keyword argument: - prefill -- Data used to prefill the object (optional)""" - return processout.CardCreateRequest(self, prefill) - def new_error_codes(self, prefill=None): """Create a new ErrorCodes instance Keyword argument: diff --git a/processout/coupon.py b/processout/coupon.py deleted file mode 100755 index c8d41c7..0000000 --- a/processout/coupon.py +++ /dev/null @@ -1,391 +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 Coupon(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._amount_off = None - self._percent_off = None - self._currency = None - self._iteration_count = None - self._max_redemptions = None - self._expires_at = None - self._metadata = None - self._redeemed_number = 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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = val - return self - - @property - def amount_off(self): - """Get amount_off""" - return self._amount_off - - @amount_off.setter - def amount_off(self, val): - """Set amount_off - Keyword argument: - val -- New amount_off value""" - self._amount_off = val - return self - - @property - def percent_off(self): - """Get percent_off""" - return self._percent_off - - @percent_off.setter - def percent_off(self, val): - """Set percent_off - Keyword argument: - val -- New percent_off value""" - self._percent_off = val - return self - - @property - def currency(self): - """Get currency""" - return self._currency - - @currency.setter - def currency(self, val): - """Set currency - Keyword argument: - val -- New currency value""" - self._currency = val - return self - - @property - def iteration_count(self): - """Get iteration_count""" - return self._iteration_count - - @iteration_count.setter - def iteration_count(self, val): - """Set iteration_count - Keyword argument: - val -- New iteration_count value""" - self._iteration_count = val - return self - - @property - def max_redemptions(self): - """Get max_redemptions""" - return self._max_redemptions - - @max_redemptions.setter - def max_redemptions(self, val): - """Set max_redemptions - Keyword argument: - val -- New max_redemptions value""" - self._max_redemptions = 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 metadata(self): - """Get metadata""" - return self._metadata - - @metadata.setter - def metadata(self, val): - """Set metadata - Keyword argument: - val -- New metadata value""" - self._metadata = val - return self - - @property - def redeemed_number(self): - """Get redeemed_number""" - return self._redeemed_number - - @redeemed_number.setter - def redeemed_number(self, val): - """Set redeemed_number - Keyword argument: - val -- New redeemed_number value""" - self._redeemed_number = 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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "amount_off" in data.keys(): - self.amount_off = data["amount_off"] - if "percent_off" in data.keys(): - self.percent_off = data["percent_off"] - if "currency" in data.keys(): - self.currency = data["currency"] - if "iteration_count" in data.keys(): - self.iteration_count = data["iteration_count"] - if "max_redemptions" in data.keys(): - self.max_redemptions = data["max_redemptions"] - if "expires_at" in data.keys(): - self.expires_at = data["expires_at"] - if "metadata" in data.keys(): - self.metadata = data["metadata"] - if "redeemed_number" in data.keys(): - self.redeemed_number = data["redeemed_number"] - 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, - "project_id": self.project_id, - "amount_off": self.amount_off, - "percent_off": self.percent_off, - "currency": self.currency, - "iteration_count": self.iteration_count, - "max_redemptions": self.max_redemptions, - "expires_at": self.expires_at, - "metadata": self.metadata, - "redeemed_number": self.redeemed_number, - "sandbox": self.sandbox, - "created_at": self.created_at, - } - - def all(self, options={}): - """Get all the coupons. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/coupons" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['coupons']: - tmp = processout.Coupon(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create(self, options={}): - """Create a new coupon. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/coupons" - data = { - 'id': self.id, - 'amount_off': self.amount_off, - 'percent_off': self.percent_off, - 'currency': self.currency, - 'iteration_count': self.iteration_count, - 'max_redemptions': self.max_redemptions, - 'expires_at': self.expires_at, - 'metadata': self.metadata - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("coupon") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def find(self, coupon_id, options={}): - """Find a coupon by its ID. - Keyword argument: - coupon_id -- ID of the coupon - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/coupons/" + quote_plus(coupon_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("coupon") - - if body is not None: - - obj = processout.Coupon(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] - - def save(self, options={}): - """Save the updated coupon attributes. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/coupons/" + quote_plus(self.id) + "" - data = { - 'metadata': self.metadata - } - - response = Response(request.put(path, data, options)) - return_values = [] - - body = response.body - body = body.get("coupon") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def delete(self, options={}): - """Delete the coupon. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/coupons/" + quote_plus(self.id) + "" - data = { - - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] diff --git a/processout/customer.py b/processout/customer.py index 02c5f10..bb77e2c 100755 --- a/processout/customer.py +++ b/processout/customer.py @@ -22,7 +22,6 @@ def __init__(self, client, prefill=None): self._default_token = None self._default_token_id = None self._tokens = None - self._subscriptions = None self._transactions = None self._balance = None self._currency = None @@ -48,6 +47,7 @@ def __init__(self, client, prefill=None): self._registered_at = None self._date_of_birth = None self._reference_id = None + self._vault_id = None if prefill is not None: self.fill_with_data(prefill) @@ -159,31 +159,6 @@ def tokens(self, val): self._tokens = l return self - @property - def subscriptions(self): - """Get subscriptions""" - return self._subscriptions - - @subscriptions.setter - def subscriptions(self, val): - """Set subscriptions - Keyword argument: - val -- New subscriptions value""" - if val is None: - self._subscriptions = [] - return self - - if len(val) > 0 and isinstance(val[0], processout.Subscription): - self._subscriptions = val - else: - l = [] - for v in val: - obj = processout.Subscription(self._client) - obj.fill_with_data(v) - l.append(obj) - self._subscriptions = l - return self - @property def transactions(self): """Get transactions""" @@ -530,6 +505,19 @@ def reference_id(self, val): self._reference_id = val return self + @property + def vault_id(self): + """Get vault_id""" + return self._vault_id + + @vault_id.setter + def vault_id(self, val): + """Set vault_id + Keyword argument: + val -- New vault_id value""" + self._vault_id = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -546,8 +534,6 @@ def fill_with_data(self, data): self.default_token_id = data["default_token_id"] if "tokens" in data.keys(): self.tokens = data["tokens"] - if "subscriptions" in data.keys(): - self.subscriptions = data["subscriptions"] if "transactions" in data.keys(): self.transactions = data["transactions"] if "balance" in data.keys(): @@ -598,6 +584,8 @@ def fill_with_data(self, data): self.date_of_birth = data["date_of_birth"] if "reference_id" in data.keys(): self.reference_id = data["reference_id"] + if "vault_id" in data.keys(): + self.vault_id = data["vault_id"] return self @@ -609,7 +597,6 @@ def to_json(self): "default_token": self.default_token, "default_token_id": self.default_token_id, "tokens": self.tokens, - "subscriptions": self.subscriptions, "transactions": self.transactions, "balance": self.balance, "currency": self.currency, @@ -635,35 +622,9 @@ def to_json(self): "registered_at": self.registered_at, "date_of_birth": self.date_of_birth, "reference_id": self.reference_id, + "vault_id": self.vault_id, } - def fetch_subscriptions(self, options={}): - """Get the subscriptions belonging to the customer. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/customers/" + quote_plus(self.id) + "/subscriptions" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['subscriptions']: - tmp = processout.Subscription(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - def fetch_tokens(self, options={}): """Get the customer's tokens. Keyword argument: diff --git a/processout/device.py b/processout/device.py index 501efe2..1df6df0 100755 --- a/processout/device.py +++ b/processout/device.py @@ -19,6 +19,8 @@ def __init__(self, client, prefill=None): self._request_origin = None self._id = None self._channel = None + self._threeds_sdk = None + self._platform = None self._ip_address = None self._user_agent = None self._header_accept = None @@ -71,6 +73,32 @@ def channel(self, val): self._channel = val return self + @property + def threeds_sdk(self): + """Get threeds_sdk""" + return self._threeds_sdk + + @threeds_sdk.setter + def threeds_sdk(self, val): + """Set threeds_sdk + Keyword argument: + val -- New threeds_sdk value""" + self._threeds_sdk = val + return self + + @property + def platform(self): + """Get platform""" + return self._platform + + @platform.setter + def platform(self, val): + """Set platform + Keyword argument: + val -- New platform value""" + self._platform = val + return self + @property def ip_address(self): """Get ip_address""" @@ -211,6 +239,10 @@ def fill_with_data(self, data): self.id = data["id"] if "channel" in data.keys(): self.channel = data["channel"] + if "threeds_sdk" in data.keys(): + self.threeds_sdk = data["threeds_sdk"] + if "platform" in data.keys(): + self.platform = data["platform"] if "ip_address" in data.keys(): self.ip_address = data["ip_address"] if "user_agent" in data.keys(): @@ -239,6 +271,8 @@ def to_json(self): "request_origin": self.request_origin, "id": self.id, "channel": self.channel, + "threeds_sdk": self.threeds_sdk, + "platform": self.platform, "ip_address": self.ip_address, "user_agent": self.user_agent, "header_accept": self.header_accept, diff --git a/processout/discount.py b/processout/discount.py deleted file mode 100755 index d334c8a..0000000 --- a/processout/discount.py +++ /dev/null @@ -1,402 +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 Discount(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._subscription = None - self._subscription_id = None - self._coupon = None - self._coupon_id = None - self._name = None - self._amount = None - self._percent = None - self._expires_at = None - self._metadata = 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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = val - return self - - @property - def subscription(self): - """Get subscription""" - return self._subscription - - @subscription.setter - def subscription(self, val): - """Set subscription - Keyword argument: - val -- New subscription value""" - if val is None: - self._subscription = val - return self - - if isinstance(val, dict): - obj = processout.Subscription(self._client) - obj.fill_with_data(val) - self._subscription = obj - else: - self._subscription = val - return self - - @property - def subscription_id(self): - """Get subscription_id""" - return self._subscription_id - - @subscription_id.setter - def subscription_id(self, val): - """Set subscription_id - Keyword argument: - val -- New subscription_id value""" - self._subscription_id = val - return self - - @property - def coupon(self): - """Get coupon""" - return self._coupon - - @coupon.setter - def coupon(self, val): - """Set coupon - Keyword argument: - val -- New coupon value""" - if val is None: - self._coupon = val - return self - - if isinstance(val, dict): - obj = processout.Coupon(self._client) - obj.fill_with_data(val) - self._coupon = obj - else: - self._coupon = val - return self - - @property - def coupon_id(self): - """Get coupon_id""" - return self._coupon_id - - @coupon_id.setter - def coupon_id(self, val): - """Set coupon_id - Keyword argument: - val -- New coupon_id value""" - self._coupon_id = val - return self - - @property - def name(self): - """Get name""" - return self._name - - @name.setter - def name(self, val): - """Set name - Keyword argument: - val -- New name value""" - self._name = val - return self - - @property - def amount(self): - """Get amount""" - return self._amount - - @amount.setter - def amount(self, val): - """Set amount - Keyword argument: - val -- New amount value""" - self._amount = val - return self - - @property - def percent(self): - """Get percent""" - return self._percent - - @percent.setter - def percent(self, val): - """Set percent - Keyword argument: - val -- New percent value""" - self._percent = 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 metadata(self): - """Get metadata""" - return self._metadata - - @metadata.setter - def metadata(self, val): - """Set metadata - Keyword argument: - val -- New metadata value""" - self._metadata = 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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "subscription" in data.keys(): - self.subscription = data["subscription"] - if "subscription_id" in data.keys(): - self.subscription_id = data["subscription_id"] - if "coupon" in data.keys(): - self.coupon = data["coupon"] - if "coupon_id" in data.keys(): - self.coupon_id = data["coupon_id"] - if "name" in data.keys(): - self.name = data["name"] - if "amount" in data.keys(): - self.amount = data["amount"] - if "percent" in data.keys(): - self.percent = data["percent"] - if "expires_at" in data.keys(): - self.expires_at = data["expires_at"] - if "metadata" in data.keys(): - self.metadata = data["metadata"] - 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, - "project_id": self.project_id, - "subscription": self.subscription, - "subscription_id": self.subscription_id, - "coupon": self.coupon, - "coupon_id": self.coupon_id, - "name": self.name, - "amount": self.amount, - "percent": self.percent, - "expires_at": self.expires_at, - "metadata": self.metadata, - "sandbox": self.sandbox, - "created_at": self.created_at, - } - - def fetch_subscription_discounts(self, subscription_id, options={}): - """Get the discounts applied to the subscription. - Keyword argument: - subscription_id -- ID of the subscription - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(subscription_id) + "/discounts" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['discounts']: - tmp = processout.Discount(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create(self, options={}): - """Create a new discount for the given subscription ID. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.subscription_id) + "/discounts" - data = { - 'coupon_id': self.coupon_id, - 'name': self.name, - 'amount': self.amount, - 'expires_at': self.expires_at, - 'metadata': self.metadata - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("discount") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def find(self, subscription_id, discount_id, options={}): - """Find a subscription's discount by its ID. - Keyword argument: - subscription_id -- ID of the subscription on which the discount was applied - discount_id -- ID of the discount - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(subscription_id) + "/discounts/" + quote_plus(discount_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("discount") - - if body is not None: - - obj = processout.Discount(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] - - def delete(self, options={}): - """Delete a discount applied to a subscription. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.subscription_id) + "/discounts/" + quote_plus(self.id) + "" - data = { - - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] diff --git a/processout/invoice.py b/processout/invoice.py index 2a8f9a9..83518cb 100755 --- a/processout/invoice.py +++ b/processout/invoice.py @@ -23,8 +23,6 @@ def __init__(self, client, prefill=None): self._transaction_id = None self._customer = None self._customer_id = None - self._subscription = None - self._subscription_id = None self._token = None self._token_id = None self._details = None @@ -189,41 +187,6 @@ def customer_id(self, val): self._customer_id = val return self - @property - def subscription(self): - """Get subscription""" - return self._subscription - - @subscription.setter - def subscription(self, val): - """Set subscription - Keyword argument: - val -- New subscription value""" - if val is None: - self._subscription = val - return self - - if isinstance(val, dict): - obj = processout.Subscription(self._client) - obj.fill_with_data(val) - self._subscription = obj - else: - self._subscription = val - return self - - @property - def subscription_id(self): - """Get subscription_id""" - return self._subscription_id - - @subscription_id.setter - def subscription_id(self, val): - """Set subscription_id - Keyword argument: - val -- New subscription_id value""" - self._subscription_id = val - return self - @property def token(self): """Get token""" @@ -903,10 +866,6 @@ def fill_with_data(self, data): self.customer = data["customer"] if "customer_id" in data.keys(): self.customer_id = data["customer_id"] - if "subscription" in data.keys(): - self.subscription = data["subscription"] - if "subscription_id" in data.keys(): - self.subscription_id = data["subscription_id"] if "token" in data.keys(): self.token = data["token"] if "token_id" in data.keys(): @@ -1005,8 +964,6 @@ def to_json(self): "transaction_id": self.transaction_id, "customer": self.customer, "customer_id": self.customer_id, - "subscription": self.subscription, - "subscription_id": self.subscription_id, "token": self.token, "token_id": self.token_id, "details": self.details, @@ -1052,6 +1009,50 @@ def to_json(self): "reference_id": self.reference_id, } + def authenticate(self, source, options={}): + """Autheticate the invoice using the given source (customer or token) + Keyword argument: + source -- Source used to authenticate the payment. Can be a card, token or a gateway request. + options -- Options for the request""" + self.fill_with_data(options) + + request = Request(self._client) + path = "/invoices/:invoice_id/authenticate" + data = { + 'device': self.device, + 'incremental': self.incremental, + 'capture_type': self.capture_type, + 'split_allocations': self.split_allocations, + 'installment_plan_id': self.installment_plan_id, + 'synchronous': options.get("synchronous"), + 'retry_drop_liability_shift': options.get("retry_drop_liability_shift"), + 'capture_amount': options.get("capture_amount"), + 'enable_three_d_s_2': options.get("enable_three_d_s_2"), + 'allow_fallback_to_sale': options.get("allow_fallback_to_sale"), + 'auto_capture_at': options.get("auto_capture_at"), + 'metadata': options.get("metadata"), + 'override_mac_blocking': options.get("override_mac_blocking"), + 'external_three_d_s': options.get("external_three_d_s"), + 'save_source': options.get("save_source"), + 'source': source} + + response = Response(request.post(path, data, options)) + return_values = [] + + body = response.body + body = body.get("transaction") + if body is not None: + transaction = processout.Transaction(self._client) + return_values.append(transaction.fill_with_data(body)) + body = response.body + body = body.get("customer_action") + if body is not None: + customerAction = processout.CustomerAction(self._client) + customerAction_filled = customerAction.fill_with_data(body) + setattr(return_values[0], "customer_action", customerAction_filled) + + return tuple(return_values) + def increment_authorization(self, amount, options={}): """Create an incremental authorization Keyword argument: @@ -1089,6 +1090,9 @@ def authorize(self, source, options={}): data = { 'device': self.device, 'incremental': self.incremental, + 'capture_type': self.capture_type, + 'split_allocations': self.split_allocations, + 'installment_plan_id': self.installment_plan_id, 'synchronous': options.get("synchronous"), 'retry_drop_liability_shift': options.get("retry_drop_liability_shift"), 'capture_amount': options.get("capture_amount"), @@ -1129,7 +1133,9 @@ def capture(self, source, options={}): path = "/invoices/" + quote_plus(self.id) + "/capture" data = { 'device': self.device, + 'authenticate_only': self.authenticate_only, 'incremental': self.incremental, + 'installment_plan_id': self.installment_plan_id, 'authorize_only': options.get("authorize_only"), 'synchronous': options.get("synchronous"), 'retry_drop_liability_shift': options.get("retry_drop_liability_shift"), @@ -1220,6 +1226,7 @@ def payout(self, gateway_configuration_id, source, options={}): path = "/invoices/" + quote_plus(self.id) + "/payout" data = { 'force_gateway_configuration_id': options.get("force_gateway_configuration_id"), + 'metadata': options.get("metadata"), 'gateway_configuration_id': gateway_configuration_id, 'source': source} @@ -1443,7 +1450,8 @@ def create(self, options={}): 'unsupported_feature_bypass': self.unsupported_feature_bypass, 'verification': self.verification, 'auto_capture_at': self.auto_capture_at, - 'expires_at': self.expires_at + 'expires_at': self.expires_at, + 'split_allocations': self.split_allocations } response = Response(request.post(path, data, options)) diff --git a/processout/invoicedevice.py b/processout/invoicedevice.py index eff4740..970d2c8 100755 --- a/processout/invoicedevice.py +++ b/processout/invoicedevice.py @@ -17,6 +17,7 @@ def __init__(self, client, prefill=None): self._client = client self._channel = None + self._platform = None self._ip_address = None self._id = None if prefill is not None: @@ -35,6 +36,19 @@ def channel(self, val): self._channel = val return self + @property + def platform(self): + """Get platform""" + return self._platform + + @platform.setter + def platform(self, val): + """Set platform + Keyword argument: + val -- New platform value""" + self._platform = val + return self + @property def ip_address(self): """Get ip_address""" @@ -67,6 +81,8 @@ def fill_with_data(self, data): data -- The data from which to pull the new values""" if "channel" in data.keys(): self.channel = data["channel"] + if "platform" in data.keys(): + self.platform = data["platform"] if "ip_address" in data.keys(): self.ip_address = data["ip_address"] if "id" in data.keys(): @@ -77,6 +93,7 @@ def fill_with_data(self, data): def to_json(self): return { "channel": self.channel, + "platform": self.platform, "ip_address": self.ip_address, "id": self.id, } diff --git a/processout/invoiceexternalfraudtools.py b/processout/invoiceexternalfraudtools.py index 1f6536a..bc88898 100755 --- a/processout/invoiceexternalfraudtools.py +++ b/processout/invoiceexternalfraudtools.py @@ -19,6 +19,7 @@ def __init__(self, client, prefill=None): self._forter = None self._ravelin = None self._signifyd = None + self._riskified = None if prefill is not None: self.fill_with_data(prefill) @@ -61,6 +62,19 @@ def signifyd(self, val): self._signifyd = val return self + @property + def riskified(self): + """Get riskified""" + return self._riskified + + @riskified.setter + def riskified(self, val): + """Set riskified + Keyword argument: + val -- New riskified value""" + self._riskified = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -71,6 +85,8 @@ def fill_with_data(self, data): self.ravelin = data["ravelin"] if "signifyd" in data.keys(): self.signifyd = data["signifyd"] + if "riskified" in data.keys(): + self.riskified = data["riskified"] return self @@ -79,4 +95,5 @@ def to_json(self): "forter": self.forter, "ravelin": self.ravelin, "signifyd": self.signifyd, + "riskified": self.riskified, } diff --git a/processout/plan.py b/processout/plan.py deleted file mode 100755 index e316612..0000000 --- a/processout/plan.py +++ /dev/null @@ -1,413 +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 Plan(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._url = None - self._name = None - self._amount = None - self._currency = None - self._metadata = None - self._interval = None - self._trial_period = None - self._return_url = None - self._cancel_url = 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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = 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 name(self): - """Get name""" - return self._name - - @name.setter - def name(self, val): - """Set name - Keyword argument: - val -- New name value""" - self._name = val - return self - - @property - def amount(self): - """Get amount""" - return self._amount - - @amount.setter - def amount(self, val): - """Set amount - Keyword argument: - val -- New amount value""" - self._amount = val - return self - - @property - def currency(self): - """Get currency""" - return self._currency - - @currency.setter - def currency(self, val): - """Set currency - Keyword argument: - val -- New currency value""" - self._currency = val - return self - - @property - def metadata(self): - """Get metadata""" - return self._metadata - - @metadata.setter - def metadata(self, val): - """Set metadata - Keyword argument: - val -- New metadata value""" - self._metadata = val - return self - - @property - def interval(self): - """Get interval""" - return self._interval - - @interval.setter - def interval(self, val): - """Set interval - Keyword argument: - val -- New interval value""" - self._interval = val - return self - - @property - def trial_period(self): - """Get trial_period""" - return self._trial_period - - @trial_period.setter - def trial_period(self, val): - """Set trial_period - Keyword argument: - val -- New trial_period value""" - self._trial_period = val - return self - - @property - def return_url(self): - """Get return_url""" - return self._return_url - - @return_url.setter - def return_url(self, val): - """Set return_url - Keyword argument: - val -- New return_url value""" - self._return_url = val - return self - - @property - def cancel_url(self): - """Get cancel_url""" - return self._cancel_url - - @cancel_url.setter - def cancel_url(self, val): - """Set cancel_url - Keyword argument: - val -- New cancel_url value""" - self._cancel_url = 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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "url" in data.keys(): - self.url = data["url"] - if "name" in data.keys(): - self.name = data["name"] - if "amount" in data.keys(): - self.amount = data["amount"] - if "currency" in data.keys(): - self.currency = data["currency"] - if "metadata" in data.keys(): - self.metadata = data["metadata"] - if "interval" in data.keys(): - self.interval = data["interval"] - if "trial_period" in data.keys(): - self.trial_period = data["trial_period"] - if "return_url" in data.keys(): - self.return_url = data["return_url"] - if "cancel_url" in data.keys(): - self.cancel_url = data["cancel_url"] - 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, - "project_id": self.project_id, - "url": self.url, - "name": self.name, - "amount": self.amount, - "currency": self.currency, - "metadata": self.metadata, - "interval": self.interval, - "trial_period": self.trial_period, - "return_url": self.return_url, - "cancel_url": self.cancel_url, - "sandbox": self.sandbox, - "created_at": self.created_at, - } - - def all(self, options={}): - """Get all the plans. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/plans" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['plans']: - tmp = processout.Plan(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create(self, options={}): - """Create a new plan. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/plans" - data = { - 'id': self.id, - 'name': self.name, - 'amount': self.amount, - 'currency': self.currency, - 'interval': self.interval, - 'trial_period': self.trial_period, - 'metadata': self.metadata, - 'return_url': self.return_url, - 'cancel_url': self.cancel_url - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("plan") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def find(self, plan_id, options={}): - """Find a plan by its ID. - Keyword argument: - plan_id -- ID of the plan - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/plans/" + quote_plus(plan_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("plan") - - if body is not None: - - obj = processout.Plan(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] - - def save(self, options={}): - """Save the updated plan attributes. This action won't affect subscriptions already linked to this plan. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/plans/" + quote_plus(self.id) + "" - data = { - 'name': self.name, - 'trial_period': self.trial_period, - 'metadata': self.metadata, - 'return_url': self.return_url, - 'cancel_url': self.cancel_url - } - - response = Response(request.put(path, data, options)) - return_values = [] - - body = response.body - body = body.get("plan") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def end(self, options={}): - """Delete a plan. Subscriptions linked to this plan won't be affected. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/plans/" + quote_plus(self.id) + "" - data = { - - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] diff --git a/processout/project.py b/processout/project.py index 28d2581..ceb426a 100755 --- a/processout/project.py +++ b/processout/project.py @@ -316,60 +316,3 @@ def delete(self, options={}): return_values.append(response.success) return return_values[0] - - def fetch_supervised(self, options={}): - """Get all the supervised projects. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/supervised-projects" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['projects']: - tmp = processout.Project(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create_supervised(self, options={}): - """Create a new supervised project. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/supervised-projects" - data = { - 'id': self.id, - 'name': self.name, - 'default_currency': self.default_currency, - 'dunning_configuration': self.dunning_configuration, - 'applepay_settings': options.get("applepay_settings"), - 'public_metadata': options.get("public_metadata") - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("project") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] diff --git a/processout/refund.py b/processout/refund.py index e24d18b..34ea736 100755 --- a/processout/refund.py +++ b/processout/refund.py @@ -240,6 +240,7 @@ def create_for_invoice(self, invoice_id, options={}): 'reason': self.reason, 'information': self.information, 'invoice_detail_ids': self.invoice_detail_ids, + 'split_allocations': self.split_allocations, 'metadata': options.get("metadata") } @@ -319,6 +320,7 @@ def create(self, options={}): 'reason': self.reason, 'information': self.information, 'invoice_detail_ids': self.invoice_detail_ids, + 'split_allocations': self.split_allocations, 'metadata': options.get("metadata") } diff --git a/processout/subscription.py b/processout/subscription.py deleted file mode 100755 index 975cc21..0000000 --- a/processout/subscription.py +++ /dev/null @@ -1,1049 +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 Subscription(object): - def __init__(self, client, prefill=None): - self._client = client - - self._id = None - self._project = None - self._project_id = None - self._plan = None - self._plan_id = None - self._discounts = None - self._addons = None - self._transactions = None - self._customer = None - self._customer_id = None - self._token = None - self._token_id = None - self._url = None - self._name = None - self._amount = None - self._billable_amount = None - self._discounted_amount = None - self._addons_amount = None - self._currency = None - self._metadata = None - self._interval = None - self._trial_end_at = None - self._activated = None - self._active = None - self._cancel_at = None - self._canceled = None - self._cancellation_reason = None - self._pending_cancellation = None - self._return_url = None - self._cancel_url = None - self._unpaid_state = None - self._sandbox = None - self._created_at = None - self._activated_at = None - self._iterate_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 project_id(self): - """Get project_id""" - return self._project_id - - @project_id.setter - def project_id(self, val): - """Set project_id - Keyword argument: - val -- New project_id value""" - self._project_id = val - return self - - @property - def plan(self): - """Get plan""" - return self._plan - - @plan.setter - def plan(self, val): - """Set plan - Keyword argument: - val -- New plan value""" - if val is None: - self._plan = val - return self - - if isinstance(val, dict): - obj = processout.Plan(self._client) - obj.fill_with_data(val) - self._plan = obj - else: - self._plan = val - return self - - @property - def plan_id(self): - """Get plan_id""" - return self._plan_id - - @plan_id.setter - def plan_id(self, val): - """Set plan_id - Keyword argument: - val -- New plan_id value""" - self._plan_id = val - return self - - @property - def discounts(self): - """Get discounts""" - return self._discounts - - @discounts.setter - def discounts(self, val): - """Set discounts - Keyword argument: - val -- New discounts value""" - if val is None: - self._discounts = [] - return self - - if len(val) > 0 and isinstance(val[0], processout.Discount): - self._discounts = val - else: - l = [] - for v in val: - obj = processout.Discount(self._client) - obj.fill_with_data(v) - l.append(obj) - self._discounts = l - return self - - @property - def addons(self): - """Get addons""" - return self._addons - - @addons.setter - def addons(self, val): - """Set addons - Keyword argument: - val -- New addons value""" - if val is None: - self._addons = [] - return self - - if len(val) > 0 and isinstance(val[0], processout.Addon): - self._addons = val - else: - l = [] - for v in val: - obj = processout.Addon(self._client) - obj.fill_with_data(v) - l.append(obj) - self._addons = l - return self - - @property - def transactions(self): - """Get transactions""" - return self._transactions - - @transactions.setter - def transactions(self, val): - """Set transactions - Keyword argument: - val -- New transactions value""" - if val is None: - self._transactions = [] - return self - - if len(val) > 0 and isinstance(val[0], processout.Transaction): - self._transactions = val - else: - l = [] - for v in val: - obj = processout.Transaction(self._client) - obj.fill_with_data(v) - l.append(obj) - self._transactions = l - return self - - @property - def customer(self): - """Get customer""" - return self._customer - - @customer.setter - def customer(self, val): - """Set customer - Keyword argument: - val -- New customer value""" - if val is None: - self._customer = val - return self - - if isinstance(val, dict): - obj = processout.Customer(self._client) - obj.fill_with_data(val) - self._customer = obj - else: - self._customer = val - return self - - @property - def customer_id(self): - """Get customer_id""" - return self._customer_id - - @customer_id.setter - def customer_id(self, val): - """Set customer_id - Keyword argument: - val -- New customer_id value""" - self._customer_id = val - return self - - @property - def token(self): - """Get token""" - return self._token - - @token.setter - def token(self, val): - """Set token - Keyword argument: - val -- New token value""" - if val is None: - self._token = val - return self - - if isinstance(val, dict): - obj = processout.Token(self._client) - obj.fill_with_data(val) - self._token = obj - else: - self._token = val - return self - - @property - def token_id(self): - """Get token_id""" - return self._token_id - - @token_id.setter - def token_id(self, val): - """Set token_id - Keyword argument: - val -- New token_id value""" - self._token_id = 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 name(self): - """Get name""" - return self._name - - @name.setter - def name(self, val): - """Set name - Keyword argument: - val -- New name value""" - self._name = val - return self - - @property - def amount(self): - """Get amount""" - return self._amount - - @amount.setter - def amount(self, val): - """Set amount - Keyword argument: - val -- New amount value""" - self._amount = val - return self - - @property - def billable_amount(self): - """Get billable_amount""" - return self._billable_amount - - @billable_amount.setter - def billable_amount(self, val): - """Set billable_amount - Keyword argument: - val -- New billable_amount value""" - self._billable_amount = val - return self - - @property - def discounted_amount(self): - """Get discounted_amount""" - return self._discounted_amount - - @discounted_amount.setter - def discounted_amount(self, val): - """Set discounted_amount - Keyword argument: - val -- New discounted_amount value""" - self._discounted_amount = val - return self - - @property - def addons_amount(self): - """Get addons_amount""" - return self._addons_amount - - @addons_amount.setter - def addons_amount(self, val): - """Set addons_amount - Keyword argument: - val -- New addons_amount value""" - self._addons_amount = val - return self - - @property - def currency(self): - """Get currency""" - return self._currency - - @currency.setter - def currency(self, val): - """Set currency - Keyword argument: - val -- New currency value""" - self._currency = val - return self - - @property - def metadata(self): - """Get metadata""" - return self._metadata - - @metadata.setter - def metadata(self, val): - """Set metadata - Keyword argument: - val -- New metadata value""" - self._metadata = val - return self - - @property - def interval(self): - """Get interval""" - return self._interval - - @interval.setter - def interval(self, val): - """Set interval - Keyword argument: - val -- New interval value""" - self._interval = val - return self - - @property - def trial_end_at(self): - """Get trial_end_at""" - return self._trial_end_at - - @trial_end_at.setter - def trial_end_at(self, val): - """Set trial_end_at - Keyword argument: - val -- New trial_end_at value""" - self._trial_end_at = val - return self - - @property - def activated(self): - """Get activated""" - return self._activated - - @activated.setter - def activated(self, val): - """Set activated - Keyword argument: - val -- New activated value""" - self._activated = val - return self - - @property - def active(self): - """Get active""" - return self._active - - @active.setter - def active(self, val): - """Set active - Keyword argument: - val -- New active value""" - self._active = val - return self - - @property - def cancel_at(self): - """Get cancel_at""" - return self._cancel_at - - @cancel_at.setter - def cancel_at(self, val): - """Set cancel_at - Keyword argument: - val -- New cancel_at value""" - self._cancel_at = val - return self - - @property - def canceled(self): - """Get canceled""" - return self._canceled - - @canceled.setter - def canceled(self, val): - """Set canceled - Keyword argument: - val -- New canceled value""" - self._canceled = val - return self - - @property - def cancellation_reason(self): - """Get cancellation_reason""" - return self._cancellation_reason - - @cancellation_reason.setter - def cancellation_reason(self, val): - """Set cancellation_reason - Keyword argument: - val -- New cancellation_reason value""" - self._cancellation_reason = val - return self - - @property - def pending_cancellation(self): - """Get pending_cancellation""" - return self._pending_cancellation - - @pending_cancellation.setter - def pending_cancellation(self, val): - """Set pending_cancellation - Keyword argument: - val -- New pending_cancellation value""" - self._pending_cancellation = val - return self - - @property - def return_url(self): - """Get return_url""" - return self._return_url - - @return_url.setter - def return_url(self, val): - """Set return_url - Keyword argument: - val -- New return_url value""" - self._return_url = val - return self - - @property - def cancel_url(self): - """Get cancel_url""" - return self._cancel_url - - @cancel_url.setter - def cancel_url(self, val): - """Set cancel_url - Keyword argument: - val -- New cancel_url value""" - self._cancel_url = val - return self - - @property - def unpaid_state(self): - """Get unpaid_state""" - return self._unpaid_state - - @unpaid_state.setter - def unpaid_state(self, val): - """Set unpaid_state - Keyword argument: - val -- New unpaid_state value""" - self._unpaid_state = 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 - - @property - def activated_at(self): - """Get activated_at""" - return self._activated_at - - @activated_at.setter - def activated_at(self, val): - """Set activated_at - Keyword argument: - val -- New activated_at value""" - self._activated_at = val - return self - - @property - def iterate_at(self): - """Get iterate_at""" - return self._iterate_at - - @iterate_at.setter - def iterate_at(self, val): - """Set iterate_at - Keyword argument: - val -- New iterate_at value""" - self._iterate_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 "project_id" in data.keys(): - self.project_id = data["project_id"] - if "plan" in data.keys(): - self.plan = data["plan"] - if "plan_id" in data.keys(): - self.plan_id = data["plan_id"] - if "discounts" in data.keys(): - self.discounts = data["discounts"] - if "addons" in data.keys(): - self.addons = data["addons"] - if "transactions" in data.keys(): - self.transactions = data["transactions"] - if "customer" in data.keys(): - self.customer = data["customer"] - if "customer_id" in data.keys(): - self.customer_id = data["customer_id"] - if "token" in data.keys(): - self.token = data["token"] - if "token_id" in data.keys(): - self.token_id = data["token_id"] - if "url" in data.keys(): - self.url = data["url"] - if "name" in data.keys(): - self.name = data["name"] - if "amount" in data.keys(): - self.amount = data["amount"] - if "billable_amount" in data.keys(): - self.billable_amount = data["billable_amount"] - if "discounted_amount" in data.keys(): - self.discounted_amount = data["discounted_amount"] - if "addons_amount" in data.keys(): - self.addons_amount = data["addons_amount"] - if "currency" in data.keys(): - self.currency = data["currency"] - if "metadata" in data.keys(): - self.metadata = data["metadata"] - if "interval" in data.keys(): - self.interval = data["interval"] - if "trial_end_at" in data.keys(): - self.trial_end_at = data["trial_end_at"] - if "activated" in data.keys(): - self.activated = data["activated"] - if "active" in data.keys(): - self.active = data["active"] - if "cancel_at" in data.keys(): - self.cancel_at = data["cancel_at"] - if "canceled" in data.keys(): - self.canceled = data["canceled"] - if "cancellation_reason" in data.keys(): - self.cancellation_reason = data["cancellation_reason"] - if "pending_cancellation" in data.keys(): - self.pending_cancellation = data["pending_cancellation"] - if "return_url" in data.keys(): - self.return_url = data["return_url"] - if "cancel_url" in data.keys(): - self.cancel_url = data["cancel_url"] - if "unpaid_state" in data.keys(): - self.unpaid_state = data["unpaid_state"] - if "sandbox" in data.keys(): - self.sandbox = data["sandbox"] - if "created_at" in data.keys(): - self.created_at = data["created_at"] - if "activated_at" in data.keys(): - self.activated_at = data["activated_at"] - if "iterate_at" in data.keys(): - self.iterate_at = data["iterate_at"] - - return self - - def to_json(self): - return { - "id": self.id, - "project": self.project, - "project_id": self.project_id, - "plan": self.plan, - "plan_id": self.plan_id, - "discounts": self.discounts, - "addons": self.addons, - "transactions": self.transactions, - "customer": self.customer, - "customer_id": self.customer_id, - "token": self.token, - "token_id": self.token_id, - "url": self.url, - "name": self.name, - "amount": self.amount, - "billable_amount": self.billable_amount, - "discounted_amount": self.discounted_amount, - "addons_amount": self.addons_amount, - "currency": self.currency, - "metadata": self.metadata, - "interval": self.interval, - "trial_end_at": self.trial_end_at, - "activated": self.activated, - "active": self.active, - "cancel_at": self.cancel_at, - "canceled": self.canceled, - "cancellation_reason": self.cancellation_reason, - "pending_cancellation": self.pending_cancellation, - "return_url": self.return_url, - "cancel_url": self.cancel_url, - "unpaid_state": self.unpaid_state, - "sandbox": self.sandbox, - "created_at": self.created_at, - "activated_at": self.activated_at, - "iterate_at": self.iterate_at, - } - - def fetch_addons(self, options={}): - """Get the addons applied to the subscription. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "/addons" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['addons']: - tmp = processout.Addon(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def find_addon(self, addon_id, options={}): - """Find a subscription's addon by its ID. - Keyword argument: - addon_id -- ID of the addon - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.id) + "/addons/" + quote_plus(addon_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("addon") - if body is not None: - addon = processout.Addon(self._client) - return_values.append(addon.fill_with_data(body)) - - return return_values[0] - - def delete_addon(self, addon_id, options={}): - """Delete an addon applied to a subscription. - Keyword argument: - addon_id -- ID of the addon or plan to be removed from the subscription - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.id) + "/addons/" + quote_plus(addon_id) + "" - data = { - 'prorate': options.get("prorate"), - 'proration_date': options.get("proration_date"), - 'preview': options.get("preview") - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] - - def fetch_customer(self, options={}): - """Get the customer owning the subscription. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "/customers" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("customer") - if body is not None: - customer = processout.Customer(self._client) - return_values.append(customer.fill_with_data(body)) - - return return_values[0] - - def fetch_discounts(self, options={}): - """Get the discounts applied to the subscription. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "/discounts" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['discounts']: - tmp = processout.Discount(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def find_discount(self, discount_id, options={}): - """Find a subscription's discount by its ID. - Keyword argument: - discount_id -- ID of the discount - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.id) + "/discounts/" + quote_plus(discount_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("discount") - if body is not None: - discount = processout.Discount(self._client) - return_values.append(discount.fill_with_data(body)) - - return return_values[0] - - def delete_discount(self, discount_id, options={}): - """Delete a discount applied to a subscription. - Keyword argument: - discount_id -- ID of the discount or coupon to be removed from the subscription - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + \ - quote_plus(self.id) + "/discounts/" + quote_plus(discount_id) + "" - data = { - - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - return_values.append(response.success) - - return return_values[0] - - def fetch_transactions(self, options={}): - """Get the subscriptions past transactions. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "/transactions" - data = { - - } - - response = Response(request.get(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 all(self, options={}): - """Get all the subscriptions. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - a = [] - body = response.body - for v in body['subscriptions']: - tmp = processout.Subscription(self._client) - tmp.fill_with_data(v) - a.append(tmp) - - return_values.append(a) - - return return_values[0] - - def create(self, options={}): - """Create a new subscription for the given customer. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions" - data = { - 'plan_id': self.plan_id, - 'cancel_at': self.cancel_at, - 'name': self.name, - 'amount': self.amount, - 'currency': self.currency, - 'metadata': self.metadata, - 'interval': self.interval, - 'trial_end_at': self.trial_end_at, - 'customer_id': self.customer_id, - 'return_url': self.return_url, - 'cancel_url': self.cancel_url, - 'source': options.get("source"), - 'coupon_id': options.get("coupon_id") - } - - response = Response(request.post(path, data, options)) - return_values = [] - - body = response.body - body = body.get("subscription") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def find(self, subscription_id, options={}): - """Find a subscription by its ID. - Keyword argument: - subscription_id -- ID of the subscription - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(subscription_id) + "" - data = { - - } - - response = Response(request.get(path, data, options)) - return_values = [] - - body = response.body - body = body.get("subscription") - - if body is not None: - - obj = processout.Subscription(self._client) - return_values.append(obj.fill_with_data(body)) - - return return_values[0] - - def save(self, options={}): - """Save the updated subscription attributes. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "" - data = { - 'plan_id': self.plan_id, - 'name': self.name, - 'amount': self.amount, - 'interval': self.interval, - 'trial_end_at': self.trial_end_at, - 'metadata': self.metadata, - 'coupon_id': options.get("coupon_id"), - 'source': options.get("source"), - 'prorate': options.get("prorate"), - 'proration_date': options.get("proration_date"), - 'preview': options.get("preview") - } - - response = Response(request.put(path, data, options)) - return_values = [] - - body = response.body - body = body.get("subscription") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] - - def cancel(self, options={}): - """Cancel a subscription. The reason may be provided as well. - Keyword argument: - - options -- Options for the request""" - self.fill_with_data(options) - - request = Request(self._client) - path = "/subscriptions/" + quote_plus(self.id) + "" - data = { - 'cancel_at': self.cancel_at, - 'cancellation_reason': self.cancellation_reason, - 'cancel_at_end': options.get("cancel_at_end") - } - - response = Response(request.delete(path, data, options)) - return_values = [] - - body = response.body - body = body.get("subscription") - - if body is not None: - - return_values.append(self.fill_with_data(body)) - - return return_values[0] diff --git a/processout/token.py b/processout/token.py index 1005620..c97f4b2 100755 --- a/processout/token.py +++ b/processout/token.py @@ -39,6 +39,7 @@ def __init__(self, client, prefill=None): self._verification_status = None self._can_get_balance = None self._webhook_url = None + self._vault_id = None if prefill is not None: self.fill_with_data(prefill) @@ -377,6 +378,19 @@ def webhook_url(self, val): self._webhook_url = val return self + @property + def vault_id(self): + """Get vault_id""" + return self._vault_id + + @vault_id.setter + def vault_id(self, val): + """Set vault_id + Keyword argument: + val -- New vault_id value""" + self._vault_id = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -427,6 +441,8 @@ def fill_with_data(self, data): self.can_get_balance = data["can_get_balance"] if "webhook_url" in data.keys(): self.webhook_url = data["webhook_url"] + if "vault_id" in data.keys(): + self.vault_id = data["vault_id"] return self @@ -455,6 +471,7 @@ def to_json(self): "verification_status": self.verification_status, "can_get_balance": self.can_get_balance, "webhook_url": self.webhook_url, + "vault_id": self.vault_id, } def fetch_customer_tokens(self, customer_id, options={}): diff --git a/processout/transaction.py b/processout/transaction.py index 9cd6ef0..3ba37ba 100755 --- a/processout/transaction.py +++ b/processout/transaction.py @@ -23,8 +23,6 @@ def __init__(self, client, prefill=None): self._invoice_id = None self._customer = None self._customer_id = None - self._subscription = None - self._subscription_id = None self._token = None self._token_id = None self._card = None @@ -83,6 +81,7 @@ def __init__(self, client, prefill=None): self._eci = None self._native_apm = None self._external_details = None + self._origin = None if prefill is not None: self.fill_with_data(prefill) @@ -204,41 +203,6 @@ def customer_id(self, val): self._customer_id = val return self - @property - def subscription(self): - """Get subscription""" - return self._subscription - - @subscription.setter - def subscription(self, val): - """Set subscription - Keyword argument: - val -- New subscription value""" - if val is None: - self._subscription = val - return self - - if isinstance(val, dict): - obj = processout.Subscription(self._client) - obj.fill_with_data(val) - self._subscription = obj - else: - self._subscription = val - return self - - @property - def subscription_id(self): - """Get subscription_id""" - return self._subscription_id - - @subscription_id.setter - def subscription_id(self, val): - """Set subscription_id - Keyword argument: - val -- New subscription_id value""" - self._subscription_id = val - return self - @property def token(self): """Get token""" @@ -1072,6 +1036,19 @@ def external_details(self, val): self._external_details = val return self + @property + def origin(self): + """Get origin""" + return self._origin + + @origin.setter + def origin(self, val): + """Set origin + Keyword argument: + val -- New origin value""" + self._origin = val + return self + def fill_with_data(self, data): """Fill the current object with the new values pulled from data Keyword argument: @@ -1090,10 +1067,6 @@ def fill_with_data(self, data): self.customer = data["customer"] if "customer_id" in data.keys(): self.customer_id = data["customer_id"] - if "subscription" in data.keys(): - self.subscription = data["subscription"] - if "subscription_id" in data.keys(): - self.subscription_id = data["subscription_id"] if "token" in data.keys(): self.token = data["token"] if "token_id" in data.keys(): @@ -1211,6 +1184,8 @@ def fill_with_data(self, data): self.native_apm = data["native_apm"] if "external_details" in data.keys(): self.external_details = data["external_details"] + if "origin" in data.keys(): + self.origin = data["origin"] return self @@ -1223,8 +1198,6 @@ def to_json(self): "invoice_id": self.invoice_id, "customer": self.customer, "customer_id": self.customer_id, - "subscription": self.subscription, - "subscription_id": self.subscription_id, "token": self.token, "token_id": self.token_id, "card": self.card, @@ -1283,6 +1256,7 @@ def to_json(self): "eci": self.eci, "native_apm": self.native_apm, "external_details": self.external_details, + "origin": self.origin, } def fetch_refunds(self, options={}): diff --git a/processout/transactionoperation.py b/processout/transactionoperation.py index 87b9797..f49ff9e 100755 --- a/processout/transactionoperation.py +++ b/processout/transactionoperation.py @@ -43,6 +43,7 @@ def __init__(self, client, prefill=None): self._scheme_id = None self._processed_with_network_token = None self._payment_type = None + self._capture_type = None self._metadata = None self._gateway_fee = None self._created_at = None @@ -463,6 +464,19 @@ def payment_type(self, val): self._payment_type = val return self + @property + def capture_type(self): + """Get capture_type""" + return self._capture_type + + @capture_type.setter + def capture_type(self, val): + """Set capture_type + Keyword argument: + val -- New capture_type value""" + self._capture_type = val + return self + @property def metadata(self): """Get metadata""" @@ -560,6 +574,8 @@ def fill_with_data(self, data): self.processed_with_network_token = data["processed_with_network_token"] if "payment_type" in data.keys(): self.payment_type = data["payment_type"] + if "capture_type" in data.keys(): + self.capture_type = data["capture_type"] if "metadata" in data.keys(): self.metadata = data["metadata"] if "gateway_fee" in data.keys(): @@ -598,6 +614,7 @@ def to_json(self): "scheme_id": self.scheme_id, "processed_with_network_token": self.processed_with_network_token, "payment_type": self.payment_type, + "capture_type": self.capture_type, "metadata": self.metadata, "gateway_fee": self.gateway_fee, "created_at": self.created_at, diff --git a/processout/unsupportedfeaturebypass.py b/processout/unsupportedfeaturebypass.py index acf2e45..49a3c99 100755 --- a/processout/unsupportedfeaturebypass.py +++ b/processout/unsupportedfeaturebypass.py @@ -17,6 +17,7 @@ def __init__(self, client, prefill=None): self._client = client self._incremental_authorization = None + self._split_payments = None if prefill is not None: self.fill_with_data(prefill) @@ -33,16 +34,32 @@ def incremental_authorization(self, val): self._incremental_authorization = val return self + @property + def split_payments(self): + """Get split_payments""" + return self._split_payments + + @split_payments.setter + def split_payments(self, val): + """Set split_payments + Keyword argument: + val -- New split_payments value""" + self._split_payments = 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 "incremental_authorization" in data.keys(): self.incremental_authorization = data["incremental_authorization"] + if "split_payments" in data.keys(): + self.split_payments = data["split_payments"] return self def to_json(self): return { "incremental_authorization": self.incremental_authorization, + "split_payments": self.split_payments, } diff --git a/setup.py b/setup.py index b6b5eac..a11fe95 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name = 'processout', packages = ['processout', 'processout.errors', 'processout.networking'], - version = '8.0.0', + version = '9.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/8.0.0', + download_url = 'https://github.com/processout/processout-python/tarball/9.0.0', keywords = ['ProcessOut', 'api', 'bindings'], classifiers = [], )