File: card.py

package info (click to toggle)
chargebee-python 1.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 484 kB
  • sloc: python: 1,008; makefile: 6; sh: 3
file content (32 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError

class Card(Model):

    fields = ["status", "gateway", "reference_id", "first_name", "last_name", "iin", "last4", \
    "card_type", "expiry_month", "expiry_year", "billing_addr1", "billing_addr2", "billing_city", \
    "billing_state_code", "billing_state", "billing_country", "billing_zip", "ip_address", "customer_id", \
    "masked_number"]


    @staticmethod
    def retrieve(id, env=None, headers=None):
        return request.send('get', request.uri_path("cards",id), None, env, headers)

    @staticmethod
    def update_card_for_customer(id, params, env=None, headers=None):
        return request.send('post', request.uri_path("customers",id,"credit_card"), params, env, headers)

    @staticmethod
    def update_card_for_customer_using_payment_intent(id, params=None, env=None, headers=None):
        return request.send('post', request.uri_path("customers",id,"credit_card_using_payment_intent"), params, env, headers)

    @staticmethod
    def switch_gateway_for_customer(id, params, env=None, headers=None):
        return request.send('post', request.uri_path("customers",id,"switch_gateway"), params, env, headers)

    @staticmethod
    def delete_card_for_customer(id, env=None, headers=None):
        return request.send('post', request.uri_path("customers",id,"delete_card"), None, env, headers)