Example #1
0
def test_create_transaction_with_refund_success_response(
        stripe_payment, stripe_refund_success_response):
    payment_info = create_payment_information(stripe_payment)

    response = _create_response(payment_information=payment_info,
                                kind='ANYKIND',
                                response=stripe_refund_success_response,
                                error=None)

    assert response.transaction_id == TRANSACTION_TOKEN
    assert response.is_success is True
    assert isclose(response.amount, TRANSACTION_REFUND_AMOUNT)
    assert response.currency == TRANSACTION_CURRENCY
Example #2
0
def test_create_transaction_with_charge_success_response(
        stripe_payment, stripe_charge_success_response):
    payment_info = create_payment_information(stripe_payment)

    response = _create_response(payment_information=payment_info,
                                kind='ANYKIND',
                                response=stripe_charge_success_response,
                                error=None)

    assert response['transaction_id'] == TRANSACTION_TOKEN
    assert response['is_success'] is True
    assert isclose(response['amount'], TRANSACTION_AMOUNT)
    assert response['currency'] == TRANSACTION_CURRENCY
Example #3
0
def test_create_response_with_error_response(stripe_payment):
    payment = stripe_payment
    payment_info = create_payment_information(payment, FAKE_TOKEN)
    stripe_error_response = {}

    response = _create_response(
        payment_information=payment_info, kind='ANYKIND',
        response=stripe_error_response, error=None)

    assert response['transaction_id'] == FAKE_TOKEN
    assert response['is_success'] is False
    assert response['amount'] == payment.total
    assert response['currency'] == payment.currency
Example #4
0
def test_create_transaction_with_refund_success_response(
        stripe_payment,
        stripe_refund_success_response):
    payment_info = create_payment_information(stripe_payment)

    response = _create_response(
        payment_information=payment_info, kind='ANYKIND',
        response=stripe_refund_success_response, error=None)

    assert response['transaction_id'] == TRANSACTION_TOKEN
    assert response['is_success'] is True
    assert isclose(response['amount'], TRANSACTION_REFUND_AMOUNT)
    assert response['currency'] == TRANSACTION_CURRENCY
Example #5
0
def test_create_response_with_error_response(stripe_payment):
    payment = stripe_payment
    payment_info = create_payment_information(payment, FAKE_TOKEN)
    stripe_error_response = {}

    response = _create_response(payment_information=payment_info,
                                kind='ANYKIND',
                                response=stripe_error_response,
                                error=None)

    assert response.transaction_id == FAKE_TOKEN
    assert response.is_success is False
    assert response.amount == payment.total
    assert response.currency == payment.currency
Example #6
0
def test_create_response_with_error_response(stripe_payment):
    payment = stripe_payment
    payment_info = create_payment_information(payment, FAKE_TOKEN)
    stripe_error_response = {}

    response = _create_response(
        payment_information=payment_info,
        kind="ANYKIND",
        response=stripe_error_response,
        error=None,
    )

    assert response.transaction_id == FAKE_TOKEN
    assert response.is_success is False
    assert response.amount == payment.total
    assert response.currency == payment.currency
Example #7
0
def test_create_transaction_with_refund_success_response(
    stripe_payment, stripe_refund_success_response
):
    payment_info = create_payment_information(stripe_payment)

    response = _create_response(
        payment_information=payment_info,
        kind="ANYKIND",
        response=stripe_refund_success_response,
        error=None,
    )

    assert response.transaction_id == TRANSACTION_TOKEN
    assert response.is_success is True
    assert isclose(response.amount, TRANSACTION_REFUND_AMOUNT)
    assert response.currency == TRANSACTION_CURRENCY