UNPKG

@shipengine/connect-order-source-api

Version:

This is the typescript/javascript definitions for the order source api

61 lines 3.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PaymentSchema = exports.Payment = exports.PaymentStatusSchema = exports.PaymentStatus = void 0; const tslib_1 = require("tslib"); const joi_1 = tslib_1.__importDefault(require("joi")); const charge_1 = require("./charge"); const label_voucher_1 = require("./label-voucher"); /** @description The status of whether or not an order has been paid for */ var PaymentStatus; (function (PaymentStatus) { PaymentStatus["AwaitingPayment"] = "AwaitingPayment"; PaymentStatus["PaymentCancelled"] = "PaymentCancelled"; PaymentStatus["PaymentFailed"] = "PaymentFailed"; PaymentStatus["PaymentInProcess"] = "PaymentInProcess"; PaymentStatus["Paid"] = "Paid"; PaymentStatus["Other"] = "Other"; })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {})); exports.PaymentStatusSchema = joi_1.default.string().valid(...Object.values(PaymentStatus)); /** @description This represents a payment made for an order */ class Payment { /** @description An ID for this payment in the vendor API */ payment_id; /** @description The status of whether or not an order has been paid for */ payment_status; /** @description A list of tax charges. The description can convey the jurisdiction */ taxes; /** @description A list of shipping charges. */ shipping_charges; /** @description A list of adjustments applied that influence the order total. For example, promotions/discounts/coupons. The amount should always be a quantity of currency, not a percentage. */ adjustments; /** @description The amount of the currency */ amount_paid; /** @description Coupon code applied to obtain a discount. The discount amounts should be included as one of the adjustments. */ coupon_code; /** @description A list of coupon codes applied to obtain a discount. The discount amounts should be included as one of the adjustments. */ coupon_codes; /** @description The payment method */ payment_method; /** @description Represents information needed to leverage a third party Carrier API implementation */ label_voucher; /** @description A list containing any pre-paid vat taxes included in the amount paid */ prepaid_vat; /** @description The purchase order (PO) number entered by the buyer at checkout. */ purchase_order_number; } exports.Payment = Payment; exports.PaymentSchema = joi_1.default.object({ payment_id: joi_1.default.string().optional().empty(), payment_status: exports.PaymentStatusSchema.optional(), taxes: joi_1.default.array().optional().items(charge_1.ChargeSchema), shipping_charges: joi_1.default.array().optional().items(charge_1.ChargeSchema), adjustments: joi_1.default.array().optional().items(charge_1.ChargeSchema), amount_paid: joi_1.default.number().optional(), coupon_code: joi_1.default.string().optional().empty(), coupon_codes: joi_1.default.array().optional().items(joi_1.default.string()), payment_method: joi_1.default.string().optional().empty(), label_voucher: label_voucher_1.LabelVoucherSchema.optional(), prepaid_vat: joi_1.default.array().optional().items(charge_1.ChargeSchema), purchase_order_number: joi_1.default.string().optional().empty(), }); //# sourceMappingURL=payment.js.map