def create(self, card: Card, **kwargs) -> NewCardResponse: """Store the card in the safe Args: card (Card): Customer card data """ response = self._post(self._format_url(), json=card._as_dict()) if "callback" in kwargs.keys(): kwargs["callback"](card._as_dict(), response, self._format_url()) return NewCardResponse(**response)
def verify(self, card: Card, **kwargs) -> bool: """Checks if the card is valid Args: card (Card): Customer card data """ response = self._post( self._format_url(card_id="verification"), json=card._as_dict() ) if "callback" in kwargs.keys(): kwargs["callback"](card._as_dict(), response, self._format_url(card_id="verification")) return response.get("status") == "VERIFIED"
def create(self, card: Card) -> NewCardResponse: """Store the card in the safe Args: card (Card): Customer card data """ response = self._post(self._format_url(), json=card._as_dict()) return NewCardResponse(**response)
def verify(self, card: Card) -> bool: """Checks if the card is valid Args: card (Card): Customer card data """ response = self._post(self._format_url(card_id="verification"), json=card._as_dict()) return response.get("status") == "VERIFIED"
def test_as_dict(card_sample: dict): card = Card(**card_sample) assert card_sample == card._as_dict()