All files / app/checkout checkouts.mock.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83    23x 23x 23x 23x   23x 305x                                                                       23x 6x               23x 5x                 23x 1x               23x 29x                  
import { Checkout, CheckoutPayment } from '@bigcommerce/checkout-sdk';
 
import { getCart } from '../cart/carts.mock';
import { getCoupon } from '../coupon/coupons.mock';
import { getGuestCustomer } from '../customer/customers.mock';
import { getPromotion } from '../promotion/promotions.mock';
 
export function getCheckout(): Checkout {
    return {
        id: 'b20deef40f9699e48671bbc3fef6ca44dc80e3c7',
        cart: getCart(),
        customer: getGuestCustomer(),
        customerMessage: 'comment',
        billingAddress: undefined,
        consignments: [],
        taxes: [
            {
                name: 'Tax',
                amount: 3,
            },
        ],
        discounts: [],
        isStoreCreditApplied: false,
        coupons: [
            getCoupon(),
        ],
        orderId: 295,
        shippingCostTotal: 15,
        shippingCostBeforeDiscount: 20,
        shouldExecuteSpamCheck: false,
        handlingCostTotal: 8,
        taxTotal: 3,
        subtotal: 190,
        grandTotal: 190,
        giftWrappingCostTotal: 0,
        outstandingBalance: 190,
        giftCertificates: [],
        balanceDue: 0,
        createdTime: '2018-03-06T04:41:49+00:00',
        updatedTime: '2018-03-07T03:44:51+00:00',
        promotions: [],
    };
}
 
export function getCheckoutWithPayments(): Checkout {
    return {
        ...getCheckout(),
        payments: [
            getCheckoutPayment(),
        ],
    };
}
 
export function getCheckoutWithAmazonPay(): Checkout {
    return {
        ...getCheckout(),
        payments: [{
            ...getCheckoutPayment(),
            providerId: 'amazonpay',
        }],
    };
}
 
export function getCheckoutWithPromotions(): Checkout {
    return {
        ...getCheckout(),
        promotions: [
            getPromotion(),
        ],
    };
}
 
export function getCheckoutPayment(): CheckoutPayment {
    return {
        providerId: 'amazon',
        gatewayId: undefined,
        providerType: 'PAYMENT_TYPE_HOSTED',
        detail: {
            step: 'ACKNOWLEDGE',
        },
    };
}