All files / app/order orders.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 84 85 86 87 88 89    11x 11x 11x 11x   11x 81x                                                                                                 11x 82x                     11x 2x             11x 83x                    
import { GatewayOrderPayment, GiftCertificateOrderPayment, Order, OrderPayment } from '@bigcommerce/checkout-sdk';
 
import { getBillingAddress } from '../billing/billingAddresses.mock';
import { getGiftCertificateItem, getPhysicalItem } from '../cart/lineItem.mock';
import { getCoupon, getShippingCoupon } from '../coupon/coupons.mock';
import { getCurrency } from '../currency/currencies.mock';
 
export function getOrder(): Order {
    return {
        baseAmount: 200,
        billingAddress: getBillingAddress(),
        cartId: 'b20deef40f9699e48671bbc3fef6ca44dc80e3c7',
        coupons: [
            getCoupon(),
            getShippingCoupon(),
        ],
        currency: getCurrency(),
        customerMessage: '',
        customerCanBeCreated: true,
        customerId: 0,
        discountAmount: 10,
        hasDigitalItems: false,
        isComplete: true,
        status: 'ORDER_STATUS_AWAITING_FULFILLMENT',
        isDownloadable: false,
        isTaxIncluded: false,
        lineItems: {
            physicalItems: [
                getPhysicalItem(),
            ],
            digitalItems: [],
            giftCertificates: [
                getGiftCertificateItem(),
            ],
            customItems: [],
        },
        taxes: [
            {
                name: 'Tax',
                amount: 3,
            },
        ],
        giftWrappingCostTotal: 0,
        taxTotal: 3,
        shippingCostTotal: 15,
        shippingCostBeforeDiscount: 20,
        handlingCostTotal: 8,
        orderAmount: 190,
        orderAmountAsInteger: 19000,
        orderId: 295,
        payments: [
            getGatewayOrderPayment(),
            getGiftCertificateOrderPayment(),
        ],
    };
}
 
export function getGatewayOrderPayment(): GatewayOrderPayment {
    return {
        providerId: 'authorizenet',
        description: 'credit-card',
        amount: 190,
        detail: {
            step: 'FINALIZE',
            instructions: '<strong>295</strong> something',
        },
    };
}
 
export function getStoreCreditPayment(): OrderPayment {
    return {
        providerId: 'storecredit',
        description: 'sc',
        amount: 60,
    };
}
 
export function getGiftCertificateOrderPayment(): GiftCertificateOrderPayment {
    return {
        providerId: 'giftcertificate',
        description: 'gc',
        amount: 7,
        detail: {
            code: 'gc',
            remaining: 3,
        },
    };
}