Esempio n. 1
0
def dummy_response(payment_dummy, transaction_data, transaction_token):
    return GatewayResponse(
        is_success=True,
        transaction_id=transaction_token,
        error=EXAMPLE_ERROR,
        amount=payment_dummy.total,
        currency=payment_dummy.currency,
        kind=TransactionKind.AUTH,
        raw_response=None,
    )
def dummy_response(payment_dummy, transaction_token, card_details):
    return GatewayResponse(
        is_success=True,
        action_required=False,
        transaction_id=transaction_token,
        error=EXAMPLE_ERROR,
        amount=payment_dummy.total,
        currency=payment_dummy.currency,
        kind=TransactionKind.AUTH,
        raw_response=None,
        card_info=card_details,
    )
Esempio n. 3
0
def gateway_response(settings):
    return GatewayResponse(
        is_success=True,
        transaction_id="transaction-token",
        amount=Decimal(14.50),
        currency=settings.DEFAULT_CURRENCY,
        kind=TransactionKind.CAPTURE,
        error=None,
        raw_response={
            "credit_card_four": "1234",
            "transaction-id": "transaction-token",
        },
    )
Esempio n. 4
0
def gateway_response(settings):
    return GatewayResponse(
        is_success=True,
        transaction_id='transaction-token',
        amount=Decimal(14.50),
        currency=settings.DEFAULT_CURRENCY,
        kind=TransactionKind.CAPTURE,
        error=None,
        raw_response={
            'credit_card_four': '1234',
            'transaction-id': 'transaction-token',
        }
    )
from decimal import Decimal

import pytest

import saleor.payment.gateway as gateway
from saleor.payment import ChargeStatus, TransactionKind
from saleor.payment.interface import GatewayResponse
from saleor.payment.utils import create_payment_information

RAW_RESPONSE = {"test": "abcdefgheijklmn"}
PROCESS_PAYMENT_RESPONSE = GatewayResponse(
    is_success=True,
    customer_id="test_customer",
    action_required=False,
    kind=TransactionKind.CAPTURE,
    amount=Decimal(10.0),
    currency="usd",
    transaction_id="1234",
    error=None,
    raw_response=RAW_RESPONSE,
)
AUTHORIZE_RESPONSE = GatewayResponse(
    is_success=True,
    customer_id="test_customer",
    action_required=False,
    kind=TransactionKind.AUTH,
    amount=Decimal(10.0),
    currency="usd",
    transaction_id="1234",
    error=None,
    raw_response=RAW_RESPONSE,