|
| 1 | +import Base, {ResourcePath} from '../../base-rest-resource'; |
| 2 | +import {SessionInterface} from '../../auth/session/types'; |
| 3 | +import {ApiVersion} from '../../base-types'; |
| 4 | + |
| 5 | +import {Currency} from './currency'; |
| 6 | +import {Customer} from './customer'; |
| 7 | +import {DiscountCode} from './discount_code'; |
| 8 | + |
| 9 | +interface CheckoutsArgs { |
| 10 | + [key: string]: unknown; |
| 11 | + session: SessionInterface; |
| 12 | + since_id?: unknown; |
| 13 | + created_at_min?: unknown; |
| 14 | + created_at_max?: unknown; |
| 15 | + updated_at_min?: unknown; |
| 16 | + updated_at_max?: unknown; |
| 17 | + status?: unknown; |
| 18 | + limit?: unknown; |
| 19 | +} |
| 20 | + |
| 21 | +export class AbandonedCheckout extends Base { |
| 22 | + public static API_VERSION = ApiVersion.April21; |
| 23 | + |
| 24 | + protected static NAME = 'abandoned_checkout'; |
| 25 | + protected static PLURAL_NAME = 'abandoned_checkouts'; |
| 26 | + protected static HAS_ONE: {[key: string]: typeof Base} = { |
| 27 | + currency: Currency, |
| 28 | + customer: Customer |
| 29 | + }; |
| 30 | + protected static HAS_MANY: {[key: string]: typeof Base} = { |
| 31 | + discount_codes: DiscountCode |
| 32 | + }; |
| 33 | + protected static PATHS: ResourcePath[] = [ |
| 34 | + {http_method: "get", operation: "checkouts", ids: [], path: "checkouts.json"}, |
| 35 | + {http_method: "get", operation: "checkouts", ids: [], path: "checkouts.json"} |
| 36 | + ]; |
| 37 | + |
| 38 | + public static async checkouts( |
| 39 | + { |
| 40 | + session, |
| 41 | + since_id = null, |
| 42 | + created_at_min = null, |
| 43 | + created_at_max = null, |
| 44 | + updated_at_min = null, |
| 45 | + updated_at_max = null, |
| 46 | + status = null, |
| 47 | + limit = null, |
| 48 | + ...otherArgs |
| 49 | + }: CheckoutsArgs |
| 50 | + ): Promise<unknown> { |
| 51 | + const response = await AbandonedCheckout.request({ |
| 52 | + http_method: "get", |
| 53 | + operation: "checkouts", |
| 54 | + session: session, |
| 55 | + urlIds: {}, |
| 56 | + params: {since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status, limit: limit, ...otherArgs}, |
| 57 | + body: {}, |
| 58 | + entity: null, |
| 59 | + }); |
| 60 | + |
| 61 | + return response ? response.body : null; |
| 62 | + } |
| 63 | + |
| 64 | + public abandoned_checkout_url: string | null; |
| 65 | + public billing_address: {[key: string]: unknown} | null; |
| 66 | + public buyer_accepts_marketing: boolean | null; |
| 67 | + public buyer_accepts_sms_marketing: boolean | null; |
| 68 | + public cart_token: string | null; |
| 69 | + public closed_at: string | null; |
| 70 | + public completed_at: string | null; |
| 71 | + public created_at: string | null; |
| 72 | + public currency: Currency | null | {[key: string]: any}; |
| 73 | + public customer: Customer | null | {[key: string]: any}; |
| 74 | + public customer_locale: string | null; |
| 75 | + public device_id: number | null; |
| 76 | + public discount_codes: DiscountCode[] | null | {[key: string]: any}; |
| 77 | + public email: string | null; |
| 78 | + public gateway: string | null; |
| 79 | + public id: number | null; |
| 80 | + public landing_site: string | null; |
| 81 | + public line_items: {[key: string]: unknown} | null; |
| 82 | + public location_id: number | null; |
| 83 | + public note: string | null; |
| 84 | + public phone: string | null; |
| 85 | + public presentment_currency: string | null; |
| 86 | + public referring_site: string | null; |
| 87 | + public shipping_address: {[key: string]: unknown} | null; |
| 88 | + public shipping_lines: {[key: string]: unknown} | null; |
| 89 | + public sms_marketing_phone: string | null; |
| 90 | + public source_name: string | null; |
| 91 | + public subtotal_price: string | null; |
| 92 | + public tax_lines: {[key: string]: unknown} | null; |
| 93 | + public taxes_included: boolean | null; |
| 94 | + public token: string | null; |
| 95 | + public total_discounts: string | null; |
| 96 | + public total_duties: string | null; |
| 97 | + public total_line_items_price: string | null; |
| 98 | + public total_price: string | null; |
| 99 | + public total_tax: string | null; |
| 100 | + public total_weight: number | null; |
| 101 | + public updated_at: string | null; |
| 102 | + public user_id: number | null; |
| 103 | +} |
0 commit comments