diff --git a/threescale_api/resources.py b/threescale_api/resources.py index 312d924..f086afc 100644 --- a/threescale_api/resources.py +++ b/threescale_api/resources.py @@ -890,6 +890,17 @@ def charge(self, entity_id: int): return instance +class PaymentTransactions(DefaultClient): + def __init__(self, *args, entity_name='payment_transaction', + entity_collection='payment_transactions', **kwargs): + super().__init__(*args, entity_name=entity_name, + entity_collection=entity_collection, **kwargs) + + @property + def url(self) -> str: + return self.parent.url + '/payment_transactions' + + class FieldsDefinitions(DefaultClient): def __init__(self, *args, entity_name='fields_definition', entity_collection='fields_definitions', **kwargs): @@ -1252,6 +1263,16 @@ def applications(self) -> Applications: def users(self) -> AccountUsers: return AccountUsers(parent=self, instance_klass=AccountUser) + def credit_card_set(self, params: dict = None, **kwargs): + url = self.url + "/credit_card" + response = self.client.rest.put(url=url, json=params, **kwargs) + return response + + def credit_card_delete(self, params: dict = None, **kwargs): + url = self.url + "/credit_card" + response = self.client.rest.delete(url=url, json=params, **kwargs) + return response + class UserPermissions(DefaultResource): pass @@ -1416,6 +1437,15 @@ def state_update(self, state: InvoiceState): def charge(self): return self.client.charge(entity_id=self.entity_id) + @property + def payment_transactions(self) -> 'PaymentTransactions': + return PaymentTransactions(parent=self, instance_klass=PaymentTransaction) + + +class PaymentTransaction(DefaultResource): + def __init__(self, entity_name='name', **kwargs): + super().__init__(entity_name=entity_name, **kwargs) + class FieldsDefinition(DefaultResource): def __init__(self, entity_name='name', **kwargs):