Exemplo n.º 1
0
 def card_payment(self, processing_account):
     card_payment = pl.Payment.create(processing_id=processing_account.id,
                                      amount=100.0,
                                      payment_method=pl.Card(
                                          card_number="4242 4242 4242 4242",
                                          expiry="12/25"))
     return card_payment
    def test_convenience_fee(self, api_key):
        payment = pl.Payment.select("*", "conv_fee").create(
            amount=100,
            payment_method=pl.Card(card_number="4242 4242 4242 4242"))

        assert payment.fee
        assert payment.conv_fee != None
    def test_blind_refund_card_payment(self, api_key, processing_account):
        refund = pl.Refund.create(
            amount=10,
            processing_id=processing_account.id,
            payment_method=pl.Card(card_number="4242 4242 4242 4242"),
        )

        assert refund.type == "refund"
        assert refund.amount == 10
        assert refund.status_code == "approved"
    def test_unified_payout_batching(self, api_key, processing_account):
        pl.Refund.create(
            amount=10,
            processing_id=processing_account.id,
            payment_method=pl.Card(card_number="4242 4242 4242 4242"),
        )

        transactions = (pl.Transaction.select("*", "ledger").filter_by(
            type="refund", processing_id=processing_account.id).all())

        assert len(transactions) == 1
        assert transactions[0].processing_id == processing_account.id
    def test_payment_filters(self, api_key):
        letters = string.ascii_lowercase
        rand_description = "".join(random.choice(letters) for i in range(10))

        card_payment = pl.Payment.create(
            amount=100.0,
            description=rand_description,
            payment_method=pl.Card(card_number="4242 4242 4242 4242",
                                   expiry="05/22",
                                   card_code="123"),
        )

        payments = pl.Payment.filter_by(
            pl.attr.amount > 99,
            pl.attr.amount < (200),
            pl.attr.description.contains(rand_description),
            pl.attr.created_at > ("2019-12-31"),
        ).all()

        assert len(payments) == 1
        assert payments[0].id == card_payment.id
Exemplo n.º 6
0
 def card_payment(self):
     card_payment = pl.Payment.create(
         amount=100.0, payment_method=pl.Card(card_number="4242 4242 4242 4242")
     )
     return card_payment