Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
UpdatableAPIResource):
_base_path = '/merchant_orders'
class PaymentMethodAPI(ListableAPIResource):
_base_path = '/v1/payment_methods'
def card_issuers(self, payment_method_id):
return self._client.get('/card_issuers', params={'payment_method_id': payment_method_id})
def installments(self, **data):
return self._client.get('/installments', params=data)
class PaymentAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, SearchableAPIResource):
_base_path = '/v1/payments'
def cancel(self, id):
return self.update(id, status='cancelled')
def refund(self, id):
return self._client.post('/{id}/refunds', {'id': id})
def partial_refund(self, id, amount):
return self._client.post('/{id}/refunds', {'id': id}, json={'amount': amount})
class AdvancedPaymentAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, SearchableAPIResource):
_base_path = '/v1/advanced_payments'
class PaymentAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, SearchableAPIResource):
_base_path = '/v1/payments'
def cancel(self, id):
return self.update(id, status='cancelled')
def refund(self, id):
return self._client.post('/{id}/refunds', {'id': id})
def partial_refund(self, id, amount):
return self._client.post('/{id}/refunds', {'id': id}, json={'amount': amount})
class AdvancedPaymentAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, SearchableAPIResource):
_base_path = '/v1/advanced_payments'
def refund(self, id):
return self._client.post('/{id}/refunds', {'id': id})
def disburses(self, id, **data):
return self._client.post('/{id}/disburses', {'id': id}, json=data)
def disbursements(self, id):
return DisbursementAPI(self._client, id)
class DisbursementAPI(API):
_base_path = '/v1/advanced_payments/{payment_id}/disbursements'
class PlanAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource):
_base_path = '/v1/plans'
class PreferenceAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, ListableAPIResource):
_base_path = '/checkout/preferences'
class MoneyRequestAPI(RetrievableAPIResource, CreatableAPIResource):
_base_path = '/money_requests'
class PreapprovalAPI(CreatableAPIResource, UpdatableAPIResource,
SearchableAPIResource):
_base_path = '/preapproval'
def get(self, id):
# NOTE: this is actually performing a search with ID and mangling
# the response data to conform to a single object format.
# There is no method to retrieve a preapproval by ID at the moment.
res = self.search(id=id)
if not res.data['results']:
raise errors.NotFoundError('could not find preapproval with ID = %s' % id)
res = Response(self._client.client, res._response) # pylint: disable=protected-access
res.data = res.data['results'][0]
return res
def test_user_create(self, site_id):
return self._client.post('/test_user', json={'site_id': site_id})
class BankReportAPI(ListableAPIResource):
_base_path = '/v1/account/bank_report'
def get(self, file_name):
return self._client.get('/{file_name}', {'file_name': file_name})
def create(self, **data):
return self._client.post(json=data)
class SettlementReportAPI(SearchableAPIResource):
_base_path = '/v1/account/settlement_report'
def get(self, file_name):
return self._client.get('/{file_name}', {'file_name': file_name})
def config_new(self, **data):
return self._client.post('/config', json=data)
def config_update(self, **data):
return self._client.put('/config', json=data)
def config_get(self):
return self._client.get('/config')
def schedule_set(self, **data):
return self._client.post('/schedule', json=data)
class CardTokenAPI(API):
_base_path = '/v1/card_tokens'
def create(self, public_key, **data):
return self._client.post('/', params={'public_key': public_key}, json=data)
def get(self, id, public_key):
return self._client.get('/{id}', {'id': id}, params={'public_key': public_key})
def update(self, id, public_key, **data):
return self._client.put('/{id}', {'id': id}, params={'public_key': public_key}, json=data)
class CustomerAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource, DeletableAPIResource,
SearchableAPIResource):
_base_path = '/v1/customers'
def cards(self, id):
return CardAPI(self._client, id)
class IdentificationTypeAPI(ListableAPIResource):
_base_path = '/identification_types'
class InvoiceAPI(RetrievableAPIResource):
_base_path = '/v1/invoices'
class MerchantOrderAPI(RetrievableAPIResource, CreatableAPIResource,
UpdatableAPIResource):