def get_credit_cards(self): if not self.paymill_client_id: return [] api = PayMillApi(settings.PAYMILL_PRIVATE_TEST_KEY) data = api.client_details(self.paymill_client_id) print data return data['payment']
def create_card_account(self): api = PayMillApi(settings.PAYMILL_PRIVATE_TEST_KEY) data = api.create_client(email=self.email, description=str(self)) self.paymill_client_id = data['id'] self.save()
def remove_credit_card(self, card_id): api = PayMillApi(settings.PAYMILL_PRIVATE_TEST_KEY) api.remove_card(card_id)
def add_credit_card(self, token): api = PayMillApi(settings.PAYMILL_PRIVATE_TEST_KEY) if not self.paymill_client_id: self.create_card_account() return api.create_card(token, self.paymill_client_id)