Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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"
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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"
Ejemplo n.º 5
0
def test_as_dict(card_sample: dict):
    card = Card(**card_sample)
    assert card_sample == card._as_dict()