@sommpicks/sommpicks-shopify 24.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/Logger.ts +18 -0
  2. package/README.md +258 -0
  3. package/addTypings.sh +2 -0
  4. package/bitbucket-pipelines.yml +38 -0
  5. package/index.ts +132 -0
  6. package/package.json +57 -0
  7. package/publish.sh +20 -0
  8. package/services/CacheWrapper.ts +30 -0
  9. package/services/CountryCodeService.ts +507 -0
  10. package/shopify/ShopifyAppService.ts +109 -0
  11. package/shopify/ShopifyAssetService.ts +20 -0
  12. package/shopify/ShopifyBillingService.ts +73 -0
  13. package/shopify/ShopifyCartTrasnformationService.ts +207 -0
  14. package/shopify/ShopifyCollectionService.ts +523 -0
  15. package/shopify/ShopifyCustomerService.ts +472 -0
  16. package/shopify/ShopifyDeliveryCustomisationService.ts +220 -0
  17. package/shopify/ShopifyDiscountService.ts +131 -0
  18. package/shopify/ShopifyDraftOrderService.ts +125 -0
  19. package/shopify/ShopifyFulfillmentService.ts +41 -0
  20. package/shopify/ShopifyFunctionsProductDiscountsService.ts +166 -0
  21. package/shopify/ShopifyInventoryService.ts +415 -0
  22. package/shopify/ShopifyLocationService.ts +29 -0
  23. package/shopify/ShopifyOrderRefundsService.ts +138 -0
  24. package/shopify/ShopifyOrderRiskService.ts +19 -0
  25. package/shopify/ShopifyOrderService.ts +1143 -0
  26. package/shopify/ShopifyPageService.ts +62 -0
  27. package/shopify/ShopifyProductService.ts +772 -0
  28. package/shopify/ShopifyShippingZonesService.ts +37 -0
  29. package/shopify/ShopifyShopService.ts +101 -0
  30. package/shopify/ShopifyTemplateService.ts +30 -0
  31. package/shopify/ShopifyThemeService.ts +33 -0
  32. package/shopify/ShopifyUtils.ts +56 -0
  33. package/shopify/ShopifyWebhookService.ts +110 -0
  34. package/shopify/base/APIVersion.ts +4 -0
  35. package/shopify/base/AbstractService.ts +152 -0
  36. package/shopify/base/ErrorHelper.ts +24 -0
  37. package/shopify/errors/InspiraShopifyCustomError.ts +7 -0
  38. package/shopify/errors/InspiraShopifyError.ts +15 -0
  39. package/shopify/errors/InspiraShopifyUnableToReserveInventoryError.ts +7 -0
  40. package/shopify/helpers/ShopifyProductServiceHelper.ts +450 -0
  41. package/shopify/product/ShopifyProductCountService.ts +110 -0
  42. package/shopify/product/ShopifyProductListService.ts +333 -0
  43. package/shopify/product/ShopifyProductMetafieldsService.ts +405 -0
  44. package/shopify/product/ShopifyProductPublicationsService.ts +112 -0
  45. package/shopify/product/ShopifyVariantService.ts +584 -0
  46. package/shopify/router/ShopifyMandatoryRouter.ts +37 -0
  47. package/shopify/router/ShopifyRouter.ts +85 -0
  48. package/shopify/router/ShopifyRouterBis.ts +85 -0
  49. package/shopify/router/ShopifyRouterBisBis.ts +85 -0
  50. package/shopify/router/ShopifyRouterBisBisBis.ts +85 -0
  51. package/shopify/router/ShopifyRouterBisBisBisBis.ts +85 -0
  52. package/shopify/router/WebhookSkipMiddleware.ts +73 -0
  53. package/shopify/router/services/CryptoService.ts +26 -0
  54. package/shopify/router/services/HmacValidator.ts +36 -0
  55. package/shopify/router/services/OauthService.ts +17 -0
  56. package/shopify/router/services/RestUtils.ts +13 -0
  57. package/shopify/router/services/rateLimiter/MemoryStores.ts +46 -0
  58. package/shopify/router/services/rateLimiter/StoreRateLimiter.ts +46 -0
  59. package/test/README.md +223 -0
  60. package/test/router/ShopifyRouter.test.ts +71 -0
  61. package/test/router/WebhookSkipMiddleware.test.ts +86 -0
  62. package/test/router/services/HmacValidator.test.ts +24 -0
  63. package/test/router/services/RestUtils.test.ts +13 -0
  64. package/test/router/services/rateLimiter/StoreRateLimiter.test.ts +62 -0
  65. package/test/services/CacheWrapper.test.ts +30 -0
  66. package/test/shopify/ShopifyOrderService.test.ts +29 -0
  67. package/test/shopify/ShopifyProductService.test.ts +118 -0
  68. package/test/shopify/ShopifyWebhookService.test.ts +105 -0
  69. package/tsconfig.json +10 -0
  70. package/typings/axios.d.ts +8 -0
  71. package/typings/index.d.ts +1682 -0
@@ -0,0 +1,1682 @@
1
+ interface IRest_Options {
2
+ timeout: number;
3
+ retries: number;
4
+ logger: any;
5
+ max_requests_per_sec: number;
6
+ enableCache: boolean;
7
+ cacheTimeInMiliseconds: number;
8
+ }
9
+ interface ITheme {
10
+ id: number;
11
+ name: string;
12
+ created_at: string;
13
+ updated_at: string;
14
+ role: 'main' | 'unpublished';
15
+ previewable: boolean;
16
+ }
17
+
18
+ interface ITemplate {
19
+ key: string;
20
+ public_url: string;
21
+ value: string;
22
+ content_type: 'text/x-liquid';
23
+ }
24
+
25
+ interface IRisk {
26
+ id: number;
27
+ order_id: number;
28
+ checkout_id: number;
29
+ source: string;
30
+ score: string;
31
+ recommendation: string;
32
+ display: boolean;
33
+ cause_cancel: boolean;
34
+ message: string;
35
+ merchant_message: string;
36
+ }
37
+
38
+ interface ILocation {
39
+ id?: number;
40
+ name?: string;
41
+ address1?: string;
42
+ address2?: string;
43
+ city?: string;
44
+ zip?: string;
45
+ province?: string;
46
+ phone?: string;
47
+ legacy: boolean;
48
+ active: boolean;
49
+ }
50
+
51
+ interface ICustomer {
52
+ id?: number;
53
+ email: string;
54
+ first_name: string;
55
+ last_name: string;
56
+ phone?: string;
57
+ verified_email: boolean;
58
+ tags?: string;
59
+ note?: string;
60
+ addresses?: IAddress[];
61
+ default_address: IAddress;
62
+ send_email_invite: boolean;
63
+ state: 'disabled' | 'invited' | 'enabled' | 'declined';
64
+ email_marketing_consent?: {
65
+ state: 'subscribed' | 'not_subscribed';
66
+ opt_in_level?: 'single_opt_in' | 'confirmed_opt_in';
67
+ consent_updated_at?: string;
68
+ };
69
+ tax_exempt?: boolean;
70
+ tax_exemptions?: string[];
71
+ }
72
+
73
+ interface ICollection {
74
+ id?: number;
75
+ title?: string;
76
+ handle?: string;
77
+ published?: boolean;
78
+ body_html?: string;
79
+ sort_order?:
80
+ | 'alpha-asc'
81
+ | 'alpha-desc'
82
+ | 'best-selling'
83
+ | 'created'
84
+ | 'created-desc'
85
+ | 'manual'
86
+ | 'price-asc'
87
+ | 'price-desc';
88
+ image?: { attachment: string };
89
+ metafields?: IMetafield[];
90
+ products_count?: number;
91
+ collects?: ICollect[];
92
+ }
93
+
94
+ type IMetafieldType =
95
+ | 'single_line_text_field'
96
+ | 'multi_line_text_field'
97
+ | 'page_reference'
98
+ | 'product_reference'
99
+ | 'variant_reference'
100
+ | 'file_reference'
101
+ | 'number_integer'
102
+ | 'number_decimal'
103
+ | 'date'
104
+ | 'date_time'
105
+ | 'json'
106
+ | 'boolean'
107
+ | 'color'
108
+ | 'weight'
109
+ | 'volume'
110
+ | 'dimension';
111
+
112
+ interface IMetafield {
113
+ key: string;
114
+ value: string;
115
+ type: IMetafieldType;
116
+ description: string;
117
+ namespace: string;
118
+ id?: number;
119
+ }
120
+
121
+ interface IMetafieldGraphQL {
122
+ key: string;
123
+ value: string;
124
+ type: IMetafieldType;
125
+ description: string;
126
+ namespace: string;
127
+ id?: string;
128
+ }
129
+
130
+ interface IMetafieldCreate_GraphQL {
131
+ key: string;
132
+ value: string;
133
+ type: IMetafieldType;
134
+ namespace: string;
135
+ ownerId?: string;
136
+ }
137
+
138
+ interface IMetafieldOfProduct {
139
+ key: string;
140
+ value: string;
141
+ type?: IMetafieldType;
142
+ description?: string;
143
+ namespace: string;
144
+ id?: number;
145
+ product_id: number;
146
+ }
147
+
148
+ interface IVariantMetafield {
149
+ variant_id: number;
150
+ metafields: IMetafield[];
151
+ }
152
+
153
+ interface ICollect {
154
+ id?: number;
155
+ product_id: number;
156
+ collection_id: number;
157
+ }
158
+
159
+ interface IAddress {
160
+ id?: number;
161
+ address1: string;
162
+ address2?: string;
163
+ city: string;
164
+ province?: string;
165
+ phone?: string;
166
+ zip?: string;
167
+ country?: string;
168
+ first_name: string;
169
+ last_name: string;
170
+ country_code?: string;
171
+ province_code?: string;
172
+ company?: string;
173
+ default?: boolean;
174
+ }
175
+
176
+ type webhookTopic =
177
+ | 'collections/create'
178
+ | 'collections/update'
179
+ | 'collections/delete'
180
+ | 'orders/create'
181
+ | 'orders/delete'
182
+ | 'orders/cancelled'
183
+ | 'orders/fulfilled'
184
+ | 'orders/paid'
185
+ | 'orders/partially_fulfilled'
186
+ | 'orders/updated'
187
+ | 'customers/create'
188
+ | 'customers/delete'
189
+ | 'customers/disable'
190
+ | 'customers/enable'
191
+ | 'customers/update'
192
+ | 'products/create'
193
+ | 'products/update'
194
+ | 'products/delete'
195
+ | 'app/uninstalled'
196
+ | 'product_listings/add'
197
+ | 'product_listings/remove'
198
+ | 'product_listings/update'
199
+ | 'inventory_items/update'
200
+ | 'inventory_items/create'
201
+ | 'inventory_levels/create'
202
+ | 'inventory_levels/update'
203
+ | 'locations/create'
204
+ | 'locations/update'
205
+ | 'shop/update';
206
+
207
+ interface IWeebHook {
208
+ topic: webhookTopic;
209
+ address: string;
210
+ format: 'json';
211
+ api_version?: string;
212
+ id?: number;
213
+ }
214
+
215
+ interface IShop {
216
+ email: string;
217
+ shop_owner: string;
218
+ id: number;
219
+ name: string;
220
+ domain: string;
221
+ province: string;
222
+ country: string;
223
+ address1: string;
224
+ zip: string;
225
+ city: string;
226
+ phone: string;
227
+ latitude: number;
228
+ longitude: number;
229
+ primary_locale: string;
230
+ address2: string;
231
+ created_at: string;
232
+ updated_at: string;
233
+ country_code: string;
234
+ country_name: string;
235
+ currency: ICurrency;
236
+ customer_email: string;
237
+ timezone: string;
238
+ iana_timezone: string;
239
+ money_format: string;
240
+ money_with_currency_format: string;
241
+ weight_unit: string;
242
+ province_code: string;
243
+ taxes_included: boolean;
244
+ tax_shipping: boolean;
245
+ county_taxes: true;
246
+ has_discounts: true;
247
+ has_gift_cards: true;
248
+ myshopify_domain: string;
249
+ eligible_for_payments: boolean;
250
+ requires_extra_payments_agreement: boolean;
251
+ password_enabled: boolean;
252
+ has_storefront: boolean;
253
+ eligible_for_card_reader_giveaway: boolean;
254
+ finances: boolean;
255
+ primary_location_id: number;
256
+ checkout_api_supported: boolean;
257
+ multi_location_enabled: boolean;
258
+ setup_required: boolean;
259
+ pre_launch_enabled: boolean;
260
+ plan_display_name: string;
261
+ plan_name: string;
262
+ }
263
+
264
+ interface IProduct {
265
+ id?: number;
266
+ title?: string;
267
+ body_html?: string;
268
+ vendor?: string;
269
+ product_type?: string;
270
+ images?: { id?: number; src?: string; variant_ids?: number[] }[];
271
+ tags?: string[] | string;
272
+ variants?: IVariant[];
273
+ options?: { name: string; }[];
274
+ handle?: string;
275
+ published?: boolean;
276
+ created_at?: string;
277
+ updated_at?: string;
278
+ published_at?: string;
279
+ status?: 'ACTIVE' | 'DRAFT' | 'ARCHIVED';
280
+ }
281
+
282
+ interface IProductUpdateRequest {
283
+ category?: string;
284
+ giftCardTemplateSuffix?: string;
285
+ templateSuffix?: string;
286
+ id: number | string;
287
+ title?: string;
288
+ requiresSellingPlan?:boolean;
289
+ vendor?: string;
290
+ descriptionHtml?: string;
291
+ handle?: string;
292
+ productType?: string;
293
+ status?: 'ACTIVE' | 'DRAFT' | 'ARCHIVED';
294
+ tags?: string[];
295
+ collectionsToJoin?: number[];
296
+ collectionsToLeave?: number[];
297
+ }
298
+
299
+
300
+ interface IProductCreateRequest {
301
+ category?: string;
302
+ giftCard?: boolean;
303
+ giftCardTemplateSuffix?: string;
304
+ templateSuffix?: string;
305
+ productOptions?: { name: string; position: number; values: { name: string; }[]; }[];
306
+ title?: string;
307
+ vendor?: string;
308
+ descriptionHtml?: string;
309
+ handle?: string;
310
+ productType?: string;
311
+ status?: 'ACTIVE' | 'DRAFT' | 'ARCHIVED';
312
+ tags?: string[];
313
+ collectionsToJoin?: number[];
314
+ collectionsToLeave?: number[];
315
+ requiresSellingPlan?: boolean;
316
+ }
317
+
318
+ interface IProductPublishResult {
319
+ id?: number;
320
+ productPublications: { name: string; }[];
321
+ }
322
+
323
+ interface IProductUnpublishResult {
324
+ id?: number;
325
+ }
326
+
327
+ interface IProductStocks {
328
+ id: number;
329
+ variants: IVariantStock[];
330
+ }
331
+
332
+ interface IProductInventory {
333
+ id: number;
334
+ variants: IVariantInventory[];
335
+ }
336
+
337
+ interface IProductCollection {
338
+ id: number;
339
+ tags: string[];
340
+ vendor: string;
341
+ productType: string;
342
+ collectionsContained: number[];
343
+ }
344
+ type IWeigh = 'POUNDS' | 'OUNCES' | 'KILOGRAMS' | 'GRAMS';
345
+ type IInventoryPolicy = 'DENY' | 'CONTINUE';
346
+
347
+ interface IVariant {
348
+ id?: number;
349
+ product_id?: number;
350
+ barcode?: string;
351
+ weight?: number;
352
+ weight_unit?: IWeigh;
353
+ inventory_quantity?: number;
354
+ inventory_policy?: IInventoryPolicy;
355
+ price?: string;
356
+ compare_at_price?: string;
357
+ title?: string;
358
+ sku?: string;
359
+ inventory_item_id?: number;
360
+ inventory_management?: 'shopify' | 'NOT_MANAGED' | string;
361
+ option1?: string;
362
+ option2?: string;
363
+ option3?: string;
364
+ taxable?: boolean;
365
+ image_id?: number;
366
+ }
367
+
368
+ interface IVariantStock {
369
+ cursor: string;
370
+ id?: number;
371
+ inventory_quantity?: number;
372
+ inventory_policy?: 'DENY' | 'CONTINUE';
373
+ inventory_item_id?: number;
374
+ inventory_management?: 'shopify' | 'NOT_MANAGED';
375
+ }
376
+
377
+ interface IVariantInventory {
378
+ id?: number;
379
+ inventory_quantity?: number;
380
+ inventory_policy?: 'DENY' | 'CONTINUE';
381
+ inventory_item_id?: number;
382
+ inventory_management?: 'shopify' | 'NOT_MANAGED';
383
+ available_for_sale: boolean;
384
+ price: string;
385
+ sku: string;
386
+ inventory_item: IInventoryItem;
387
+ }
388
+
389
+ interface IInventoryLevel {
390
+ id: number;
391
+ available?: number;
392
+ location_id?: number;
393
+ inventory_item_id?: number;
394
+ admin_graphql_api_id?: string;
395
+ }
396
+
397
+ interface IInventoryItem {
398
+ id: number;
399
+ sku: string;
400
+ tracked: boolean;
401
+ cost: number;
402
+ levels?: IInventoryLevel[];
403
+ created_at?: string;
404
+ updated_at?: string;
405
+ requires_shipping?: boolean;
406
+ admin_graphql_api_id: string;
407
+ }
408
+
409
+ interface IInventoryItemGQL {
410
+ id: string;
411
+ measurement: {
412
+ id: number;
413
+ weight: {
414
+ unit: string;
415
+ value: number;
416
+ }
417
+ };
418
+ unitCost: {
419
+ amount: string;
420
+ currencyCode: ICurrency;
421
+ };
422
+ requiresShipping: boolean;
423
+ tracked: boolean;
424
+ variant: {
425
+ id: number;
426
+ price: number;
427
+ }
428
+ }
429
+
430
+ interface IInventoryItemWithVariantGQL extends IInventoryItemGQL {
431
+ variant_price: number;
432
+ variant_id: number;
433
+ }
434
+
435
+ interface IIventoryItemCostChangeRequest {
436
+ inventoryId: number;
437
+ cost: number;
438
+ }
439
+ interface IInventoryItemWithVariant extends IInventoryItem {
440
+ variant_price: number;
441
+ variant_id: number;
442
+ }
443
+
444
+ interface IOrderToCreate {
445
+ note?: string;
446
+ email?: string;
447
+ line_items?: ILineItem[];
448
+ note_attributes?: IAttr[];
449
+ tags?: string;
450
+ customer?: ICustomer;
451
+ financial_status?:
452
+ | 'pending'
453
+ | 'authorized'
454
+ | 'partially_paid'
455
+ | 'paid'
456
+ | 'partially_refunded'
457
+ | 'refunded'
458
+ | 'voided';
459
+ billing_address?: IAddress;
460
+ tax_lines?: ITaxLine[];
461
+ }
462
+
463
+ interface IShippingLine {
464
+ id?: number;
465
+ code: string;
466
+ price: string;
467
+ price_set?: {
468
+ shop_money: {
469
+ amount: string;
470
+ currency_code: ICurrency;
471
+ };
472
+ presentment_money: {
473
+ amount: string;
474
+ currency_code: ICurrency;
475
+ };
476
+ };
477
+ discounted_price?: string;
478
+ discounted_price_set?: {
479
+ shop_money: {
480
+ amount: string;
481
+ currency_code: ICurrency;
482
+ };
483
+ presentment_money: {
484
+ amount: string;
485
+ currency_code: ICurrency;
486
+ };
487
+ };
488
+ source: string;
489
+ title: string;
490
+ tax_lines: any[];
491
+ }
492
+
493
+ interface ICartLineItem {
494
+ id: number;
495
+ properties: { name: string; value: string }[];
496
+ quantity: number;
497
+ variant_id: number;
498
+ key: string;
499
+ discounted_price: number;
500
+ discounts: any[];
501
+ gift_card: false;
502
+ grams: number;
503
+ line_price: string;
504
+ original_line_price: string;
505
+ original_price: string;
506
+ price: number;
507
+ product_id: number;
508
+ sku: string;
509
+ taxable: boolean;
510
+ title: string;
511
+ total_discount: string;
512
+ vendor: string;
513
+ final_price: number;
514
+ final_line_price: number;
515
+ requires_shipping: boolean;
516
+ applied_discount?: IAppliedDiscount;
517
+ }
518
+
519
+ interface ICart {
520
+ id: string;
521
+ token: string;
522
+ note: string;
523
+ updated_at: string;
524
+ created_at: string;
525
+ attributes?: any;
526
+ original_total_price: number;
527
+ total_price: number;
528
+ total_discount: number;
529
+ total_weight: number;
530
+ item_count: number;
531
+ items: ICartLineItem[];
532
+ requires_shipping: true;
533
+ items_subtotal_price: number;
534
+ cart_level_discount_applications: any[];
535
+ }
536
+
537
+ interface IDraftOrder {
538
+ id?: number;
539
+ order_id?: number;
540
+ name?: string;
541
+ customer?: ICustomer;
542
+ shipping_address?: IAddress;
543
+ billing_address?: IAddress;
544
+ note?: string;
545
+ note_attributes?: IAttr[];
546
+ email?: string;
547
+ currency?: ICurrency;
548
+ invoice_sent_at?: string;
549
+ invoice_url?: string;
550
+ line_items?: ILineItem[];
551
+ shipping_line?: IShippingLine;
552
+ tags?: string;
553
+ tax_exempt?: boolean;
554
+ tax_lines?: ITaxLine[];
555
+ applied_discount?: IAppliedDiscount;
556
+ taxes_included?: boolean;
557
+ total_tax?: number;
558
+ subtotal_price?: number;
559
+ total_price?: number;
560
+ completed_at?: string;
561
+ created_at?: string;
562
+ updated_at?: string;
563
+ status?: 'open' | 'invoice_sent' | 'completed';
564
+ }
565
+
566
+ interface IAppliedDiscount {
567
+ title: string;
568
+ description: string;
569
+ value: number;
570
+ value_type: 'percentage' | 'fixed_amount';
571
+ amount: number;
572
+ }
573
+
574
+ interface IDiscountApplication {
575
+ allocation_method?: 'across' | 'each' | 'one';
576
+ code?: string;
577
+ description?: string;
578
+ target_selection?: 'all' | 'entitled' | 'explicit';
579
+ target_type?: 'line_item' | 'shipping_line';
580
+ title?: string;
581
+ type?: 'automatic' | 'discount_code' | 'manual' | 'script';
582
+ value?: number;
583
+ value_type?: 'percentage' | 'fixed_amount';
584
+ }
585
+
586
+ interface IDiscountAllocation {
587
+ amount?: string;
588
+ discount_application_index?: number;
589
+ amount_set?: {
590
+ shop_money?: {
591
+ amount?: string;
592
+ currency_code?: ICurrency;
593
+ };
594
+ presentment_money?: {
595
+ amount?: string;
596
+ currency_code?: ICurrency;
597
+ };
598
+ };
599
+ }
600
+
601
+ interface IShippingInput {
602
+ price: string;
603
+ title: string;
604
+ }
605
+
606
+ interface IOrder {
607
+ id?: number;
608
+ phone?: string;
609
+ admin_graphql_api_id?: string;
610
+ order_number?: number;
611
+ email?: string;
612
+ number?: number;
613
+ note?: string;
614
+ created_at?: string;
615
+ updated_at?: string;
616
+ token?: string;
617
+ gateway?: string;
618
+ payment_gateway_names?: string[];
619
+ total_price?: number;
620
+ subtotal_price?: number;
621
+ total_weight?: number;
622
+ total_tax?: number;
623
+ taxes_included?: boolean;
624
+ currency?: ICurrency;
625
+ financial_status?:
626
+ | 'pending'
627
+ | 'paid'
628
+ | 'authorized'
629
+ | 'partially_paid'
630
+ | 'partially_refunded'
631
+ | 'refunded'
632
+ | 'voided';
633
+ confirmed?: boolean;
634
+ total_discounts?: number;
635
+ total_line_items_price?: number;
636
+ cart_token?: string;
637
+ name?: string;
638
+ cancel_reason?: string;
639
+ user_id?: number;
640
+ location_id?: number;
641
+ fulfillment_status?: string;
642
+ line_items?: ILineItem[];
643
+ refunds?: IRefund[];
644
+ fulfillments?: any[];
645
+ shipping_lines?: IShippingLine[];
646
+ shipping_address?: IAddress;
647
+ billing_address?: IAddress;
648
+ order_status_url?: string;
649
+ processing_method?: string;
650
+ note_attributes?: IAttr[];
651
+ tags?: string;
652
+ customer?: ICustomer;
653
+ processed_at?: string;
654
+ inventory_behaviour?: 'bypass' | 'decrement_ignoring_policy' | 'decrement_obeying_policy';
655
+ tax_lines?: ITaxLine[];
656
+ discount_applications?: IDiscountApplication[];
657
+ transaction?: { gateway: string; authorization_code: string; };
658
+ }
659
+
660
+ interface IOrderMinimal {
661
+ id: number;
662
+ line_items: ILineItemMinimal[];
663
+ }
664
+
665
+ interface IOrderProductTags {
666
+ id: number;
667
+ email: string;
668
+ phone: string;
669
+ note: string;
670
+ note_attributes?: IAttr[];
671
+ shipping_address: IAddress;
672
+ billing_address: IAddress;
673
+ customer: {
674
+ first_name: string;
675
+ last_name: string;
676
+ }
677
+ line_items: {
678
+ variant_id: number;
679
+ title: string;
680
+ product: {
681
+ id: number;
682
+ tags: string[];
683
+ }
684
+ }[];
685
+ }
686
+
687
+ type IOrderStatus = 'open' | 'closed' | 'cancelled' | 'any';
688
+
689
+ type ICurrency =
690
+ | 'AFN'
691
+ | 'EUR'
692
+ | 'ALL'
693
+ | 'DZD'
694
+ | 'USD'
695
+ | 'EUR'
696
+ | 'AOA'
697
+ | 'XCD'
698
+ | 'XCD'
699
+ | 'ARS'
700
+ | 'AMD'
701
+ | 'AWG'
702
+ | 'AUD'
703
+ | 'EUR'
704
+ | 'AZN'
705
+ | 'BSD'
706
+ | 'BHD'
707
+ | 'BDT'
708
+ | 'BBD'
709
+ | 'BYN'
710
+ | 'EUR'
711
+ | 'BZD'
712
+ | 'XOF'
713
+ | 'BMD'
714
+ | 'INR'
715
+ | 'BTN'
716
+ | 'BOB'
717
+ | 'BOV'
718
+ | 'USD'
719
+ | 'BAM'
720
+ | 'BWP'
721
+ | 'NOK'
722
+ | 'BRL'
723
+ | 'USD'
724
+ | 'BND'
725
+ | 'BGN'
726
+ | 'XOF'
727
+ | 'BIF'
728
+ | 'CVE'
729
+ | 'KHR'
730
+ | 'XAF'
731
+ | 'CAD'
732
+ | 'KYD'
733
+ | 'XAF'
734
+ | 'XAF'
735
+ | 'CLP'
736
+ | 'CLF'
737
+ | 'CNY'
738
+ | 'AUD'
739
+ | 'AUD'
740
+ | 'COP'
741
+ | 'COU'
742
+ | 'KMF'
743
+ | 'CDF'
744
+ | 'XAF'
745
+ | 'NZD'
746
+ | 'CRC'
747
+ | 'XOF'
748
+ | 'HRK'
749
+ | 'CUP'
750
+ | 'CUC'
751
+ | 'ANG'
752
+ | 'EUR'
753
+ | 'CZK'
754
+ | 'DKK'
755
+ | 'DJF'
756
+ | 'XCD'
757
+ | 'DOP'
758
+ | 'USD'
759
+ | 'EGP'
760
+ | 'SVC'
761
+ | 'USD'
762
+ | 'XAF'
763
+ | 'ERN'
764
+ | 'EUR'
765
+ | 'SZL'
766
+ | 'ETB'
767
+ | 'EUR'
768
+ | 'FKP'
769
+ | 'DKK'
770
+ | 'FJD'
771
+ | 'EUR'
772
+ | 'EUR'
773
+ | 'EUR'
774
+ | 'XPF'
775
+ | 'EUR'
776
+ | 'XAF'
777
+ | 'GMD'
778
+ | 'GEL'
779
+ | 'EUR'
780
+ | 'GHS'
781
+ | 'GIP'
782
+ | 'EUR'
783
+ | 'DKK'
784
+ | 'XCD'
785
+ | 'EUR'
786
+ | 'USD'
787
+ | 'GTQ'
788
+ | 'GBP'
789
+ | 'GNF'
790
+ | 'XOF'
791
+ | 'GYD'
792
+ | 'HTG'
793
+ | 'USD'
794
+ | 'AUD'
795
+ | 'EUR'
796
+ | 'HNL'
797
+ | 'HKD'
798
+ | 'HUF'
799
+ | 'ISK'
800
+ | 'INR'
801
+ | 'IDR'
802
+ | 'XDR'
803
+ | 'IRR'
804
+ | 'IQD'
805
+ | 'EUR'
806
+ | 'GBP'
807
+ | 'ILS'
808
+ | 'EUR'
809
+ | 'JMD'
810
+ | 'JPY'
811
+ | 'GBP'
812
+ | 'JOD'
813
+ | 'KZT'
814
+ | 'KES'
815
+ | 'AUD'
816
+ | 'KPW'
817
+ | 'KRW'
818
+ | 'KWD'
819
+ | 'KGS'
820
+ | 'LAK'
821
+ | 'EUR'
822
+ | 'LBP'
823
+ | 'LSL'
824
+ | 'ZAR'
825
+ | 'LRD'
826
+ | 'LYD'
827
+ | 'CHF'
828
+ | 'EUR'
829
+ | 'EUR'
830
+ | 'MOP'
831
+ | 'MKD'
832
+ | 'MGA'
833
+ | 'MWK'
834
+ | 'MYR'
835
+ | 'MVR'
836
+ | 'XOF'
837
+ | 'EUR'
838
+ | 'USD'
839
+ | 'EUR'
840
+ | 'MRU'
841
+ | 'MUR'
842
+ | 'EUR'
843
+ | 'XUA'
844
+ | 'MXN'
845
+ | 'MXV'
846
+ | 'USD'
847
+ | 'MDL'
848
+ | 'EUR'
849
+ | 'MNT'
850
+ | 'EUR'
851
+ | 'XCD'
852
+ | 'MAD'
853
+ | 'MZN'
854
+ | 'MMK'
855
+ | 'NAD'
856
+ | 'ZAR'
857
+ | 'AUD'
858
+ | 'NPR'
859
+ | 'EUR'
860
+ | 'XPF'
861
+ | 'NZD'
862
+ | 'NIO'
863
+ | 'XOF'
864
+ | 'NGN'
865
+ | 'NZD'
866
+ | 'AUD'
867
+ | 'USD'
868
+ | 'NOK'
869
+ | 'OMR'
870
+ | 'PKR'
871
+ | 'USD'
872
+ | 'PAB'
873
+ | 'USD'
874
+ | 'PGK'
875
+ | 'PYG'
876
+ | 'PEN'
877
+ | 'PHP'
878
+ | 'NZD'
879
+ | 'PLN'
880
+ | 'EUR'
881
+ | 'USD'
882
+ | 'QAR'
883
+ | 'EUR'
884
+ | 'RON'
885
+ | 'RUB'
886
+ | 'RWF'
887
+ | 'EUR'
888
+ | 'SHP'
889
+ | 'XCD'
890
+ | 'XCD'
891
+ | 'EUR'
892
+ | 'EUR'
893
+ | 'XCD'
894
+ | 'WST'
895
+ | 'EUR'
896
+ | 'STN'
897
+ | 'SAR'
898
+ | 'XOF'
899
+ | 'RSD'
900
+ | 'SCR'
901
+ | 'SLL'
902
+ | 'SGD'
903
+ | 'ANG'
904
+ | 'XSU'
905
+ | 'EUR'
906
+ | 'EUR'
907
+ | 'SBD'
908
+ | 'SOS'
909
+ | 'ZAR'
910
+ | 'SSP'
911
+ | 'EUR'
912
+ | 'LKR'
913
+ | 'SDG'
914
+ | 'SRD'
915
+ | 'NOK'
916
+ | 'SEK'
917
+ | 'CHF'
918
+ | 'CHE'
919
+ | 'CHW'
920
+ | 'SYP'
921
+ | 'TWD'
922
+ | 'TJS'
923
+ | 'TZS'
924
+ | 'THB'
925
+ | 'USD'
926
+ | 'XOF'
927
+ | 'NZD'
928
+ | 'TOP'
929
+ | 'TTD'
930
+ | 'TND'
931
+ | 'TRY'
932
+ | 'TMT'
933
+ | 'USD'
934
+ | 'AUD'
935
+ | 'UGX'
936
+ | 'UAH'
937
+ | 'AED'
938
+ | 'GBP'
939
+ | 'USD'
940
+ | 'USD'
941
+ | 'USN'
942
+ | 'UYU'
943
+ | 'UYI'
944
+ | 'UYW'
945
+ | 'UZS'
946
+ | 'VUV'
947
+ | 'VES'
948
+ | 'VND'
949
+ | 'USD'
950
+ | 'USD'
951
+ | 'XPF'
952
+ | 'MAD'
953
+ | 'YER'
954
+ | 'ZMW'
955
+ | 'ZWL'
956
+ | 'XBA'
957
+ | 'XBB'
958
+ | 'XBC'
959
+ | 'XBD'
960
+ | 'XTS'
961
+ | 'XXX'
962
+ | 'XAU'
963
+ | 'XPD'
964
+ | 'XPT'
965
+ | 'XAG';
966
+
967
+ interface IAttr {
968
+ name: string;
969
+ value: string;
970
+ }
971
+
972
+ interface IProperty {
973
+ name: string;
974
+ value: string;
975
+ }
976
+
977
+ interface ILineItem {
978
+ id?: number;
979
+ variant_id?: number;
980
+ variant_title?: string;
981
+ title?: string;
982
+ quantity: number;
983
+ price?: number | string;
984
+ final_price?: string;
985
+ sku?: string;
986
+ fulfillment_status?: string;
987
+ fulfillment_service?: string;
988
+ properties?: IProperty[];
989
+ product_id?: number;
990
+ fulfillable_quantity?: number;
991
+ grams?: number;
992
+ requires_shipping?: boolean;
993
+ taxable?: boolean;
994
+ tax_lines?: ITaxLine[];
995
+ admin_graphql_api_id?: string;
996
+ product_title?: string;
997
+ total_discount?: string;
998
+ discount_allocations?: IDiscountAllocation[];
999
+ }
1000
+
1001
+ interface ILineItemMinimal {
1002
+ id: number;
1003
+ variant_id: number;
1004
+ product_id: number;
1005
+ properties: IProperty[];
1006
+ unfulfilledQuantity: number;
1007
+ }
1008
+
1009
+ interface ITaxLine {
1010
+ price: string;
1011
+ rate: number;
1012
+ title: string;
1013
+ }
1014
+
1015
+ interface IFulfillmentsPost {
1016
+ message?: string;
1017
+ notify_customer: boolean;
1018
+ tracking_info?: { number: number; url: string; company: string };
1019
+ line_items_by_fulfillment_order: {
1020
+ fulfillment_order_id: number;
1021
+ fulfillment_order_line_items: { id: number; quantity: number }[];
1022
+ }[];
1023
+ }
1024
+
1025
+ interface IFulfillmentEvent {
1026
+ id: number;
1027
+ fulfillment_id: number;
1028
+ status: IShipmentStatus;
1029
+ message: string;
1030
+ happened_at: string;
1031
+ city: string;
1032
+ province: string;
1033
+ country: string;
1034
+ zip: string;
1035
+ address1: string;
1036
+ latitude: number;
1037
+ longitude: number;
1038
+ shop_id: number;
1039
+ created_at: string;
1040
+ updated_at: string;
1041
+ estimated_delivery_at: string;
1042
+ order_id: number;
1043
+ }
1044
+
1045
+ interface IFulFillment {
1046
+ id?: number;
1047
+ order_id?: number;
1048
+ status?: 'pending' | 'open' | 'success' | 'cancelled' | 'error' | 'failure';
1049
+ created_at?: string;
1050
+ service?: 'manual' | string;
1051
+ location_id?: number;
1052
+ line_items?: ILineItem[];
1053
+ shipment_status?: IShipmentStatus;
1054
+ notify_customer?: boolean;
1055
+ tracking_company?: string;
1056
+ tracking_urls?: string[];
1057
+ tracking_numbers?: string[];
1058
+ }
1059
+
1060
+ interface IFulFillmentOrder {
1061
+ id?: number;
1062
+ assigned_location_id?: number;
1063
+ destination: IAddress;
1064
+ delivery_method: {
1065
+ id: number;
1066
+ method_type: string;
1067
+ min_delivery_date_time: string; //"2022-04-20T23:59:59-04:00"
1068
+ max_delivery_date_time: string;
1069
+ };
1070
+ fulfill_at: string;
1071
+ fulfill_by: string;
1072
+ fulfillment_holds: { reason: string; reason_notes: string }[];
1073
+ line_items: {
1074
+ id: number;
1075
+ shop_id: number;
1076
+ fulfillment_order_id: number;
1077
+ line_item_id: number;
1078
+ inventory_item_id: number;
1079
+ quantity: number;
1080
+ fulfillable_quantity: number;
1081
+ variant_id: number;
1082
+ }[];
1083
+ order_id?: number;
1084
+ status?: 'pending' | 'open' | 'success' | 'cancelled' | 'error' | 'failure';
1085
+ request_status?:
1086
+ | 'closed'
1087
+ | 'cancellation_rejected'
1088
+ | 'cancellation_accepted'
1089
+ | 'cancellation_requested'
1090
+ | 'unsubmitted'
1091
+ | 'submitted'
1092
+ | 'accepted'
1093
+ | 'rejected';
1094
+ shop_id: number;
1095
+ }
1096
+
1097
+ interface IFulFillmentLine {
1098
+ line_item_id?: number;
1099
+ quantity_delivered?: number;
1100
+ }
1101
+
1102
+ interface IFulfillmentService {
1103
+ name: string;
1104
+ callback_url: string;
1105
+ inventory_management: boolean;
1106
+ tracking_support: boolean;
1107
+ requires_shipping_method: boolean;
1108
+ format: 'json';
1109
+ }
1110
+
1111
+ interface ITransaction {
1112
+ id?: number;
1113
+ order_id?: number;
1114
+ kind: string;
1115
+ gateway?: string;
1116
+ status?: string;
1117
+ message?: string;
1118
+ created_at?: string;
1119
+ test?: boolean;
1120
+ authorization?: string;
1121
+ location_id?: number;
1122
+ user_id?: number;
1123
+ parent_id?: number;
1124
+ processed_at?: string;
1125
+ device_id?: number;
1126
+ error_code?: string;
1127
+ source?: string;
1128
+ source_name?: string;
1129
+ amount: string;
1130
+ currency: ICurrency;
1131
+ admin_graphql_api_id?: string;
1132
+ }
1133
+
1134
+ interface IRecurringBillingRequest {
1135
+ name: string;
1136
+ price: number;
1137
+ return_url: string;
1138
+ trial_days?: number;
1139
+ capped_amount?: string;
1140
+ terms?: string;
1141
+ test: boolean | null;
1142
+ }
1143
+
1144
+ interface IUsageCharge {
1145
+ id: number;
1146
+ description: string;
1147
+ price: string;
1148
+ created_at: string;
1149
+ balance_used: number;
1150
+ balance_remaining: number;
1151
+ risk_level: number;
1152
+ }
1153
+
1154
+ interface IRecurringBillingResponse {
1155
+ id: number;
1156
+ name: string;
1157
+ api_client_id: number;
1158
+ price: number;
1159
+ status: string;
1160
+ return_url: string;
1161
+ created_at: Date;
1162
+ updated_at: Date;
1163
+ test: boolean;
1164
+ activated_on: Date;
1165
+ trial_ends_on: Date;
1166
+ cancelled_on: Date;
1167
+ trial_days: number;
1168
+ decorated_return_url: string;
1169
+ confirmation_url?: string;
1170
+ }
1171
+
1172
+ interface IBillingResponse {
1173
+ id: number;
1174
+ name: string;
1175
+ api_client_id: number;
1176
+ price: string;
1177
+ status: 'active' | 'pending';
1178
+ return_url: string;
1179
+ test: boolean;
1180
+ created_at: string;
1181
+ updated_at: string;
1182
+ charge_type: null;
1183
+ decorated_return_url: string;
1184
+ }
1185
+
1186
+ interface ICustomerRedactRequest {
1187
+ shop_id: number;
1188
+ shop_domain: string;
1189
+ customer: {
1190
+ id: number;
1191
+ email: string;
1192
+ phone: string;
1193
+ };
1194
+ orders_to_redact: number[];
1195
+ }
1196
+
1197
+ interface IShopRedactRequest {
1198
+ shop_id: number;
1199
+ shop_domain: string;
1200
+ }
1201
+
1202
+ interface ICustomerRequestData {
1203
+ shop_id: number;
1204
+ shop_domain: string;
1205
+ customer: {
1206
+ id: number;
1207
+ email: string;
1208
+ phone: string;
1209
+ };
1210
+ orders_requested: number[];
1211
+ }
1212
+
1213
+ interface IPage {
1214
+ id?: number;
1215
+ title: string;
1216
+ shop_id?: number;
1217
+ handle?: string;
1218
+ body_html: string;
1219
+ author?: string;
1220
+ created_at?: Date;
1221
+ updated_at?: Date;
1222
+ published_at?: Date;
1223
+ template_suffix: string;
1224
+ }
1225
+
1226
+ interface IProductBatch {
1227
+ products: IProduct[];
1228
+ nextCursor: string;
1229
+ }
1230
+
1231
+ interface IOrderBatch {
1232
+ orders: IOrderInBatch[];
1233
+ nextCursor: string;
1234
+ }
1235
+
1236
+ interface IOrderBatch_DEPRECATED {
1237
+ orders: IOrder[];
1238
+ batches: number;
1239
+ count: number;
1240
+ nextSinceId: number;
1241
+ }
1242
+
1243
+ interface IOrderInBatch { id: string; createdAt: string; email: string;
1244
+ customAttributes: { key: string; value: string; }[];
1245
+ customer: { id: string; tags: string[]; defaultEmailAddress: { marketingOptInLevel: 'SINGLE_OPT_IN' | 'UNKOWN'; marketingState: 'SUBSCRIBED' | 'NOT_SUBSCRIBED'; marketingUpdatedAt: string; }}
1246
+ }
1247
+
1248
+ interface IProductBatchOld {
1249
+ products: IProduct[];
1250
+ nextSinceId: number;
1251
+ batches: number;
1252
+ totalProducts: number;
1253
+ }
1254
+
1255
+ interface IProductMetafieldInBatch {
1256
+ id: number;
1257
+ cursor: string;
1258
+ metafields: { namespace: string; key: string; value: string }[];
1259
+ }
1260
+
1261
+ interface IProductPublications {
1262
+ id: string;
1263
+ name: string;
1264
+ supportsFuturePublishing: boolean;
1265
+ autoPublish: boolean;
1266
+ }
1267
+
1268
+ interface IOrderMetafield {
1269
+ id: number;
1270
+ metafield: { namespace: string; key: string; value: string };
1271
+ }
1272
+
1273
+ interface ICustomerBatch {
1274
+ customers: ICustomer[];
1275
+ batches: number;
1276
+ nextSinceId: number;
1277
+ }
1278
+
1279
+ type IShipmentStatus = 'confirmed' | 'in_transit' | 'out_for_delivery' | 'delivered' | 'failure';
1280
+ type ICustomerRedactCallback = (customerRedactRequest: ICustomerRedactRequest) => Promise<any>;
1281
+ type IShopRedactCallback = (shopRedactRequest: IShopRedactRequest) => Promise<any>;
1282
+ type ICustomersDataCallback = (customersDataRequest: ICustomerRequestData) => Promise<IOrder[]>;
1283
+
1284
+ interface IShippingProvince {
1285
+ id: number;
1286
+ country_id: number;
1287
+ name: string;
1288
+ code: string;
1289
+ tax: number;
1290
+ tax_name: string;
1291
+ tax_type: string;
1292
+ tax_percentage: number;
1293
+ shipping_zone_id: number;
1294
+ }
1295
+
1296
+ interface IShippingCountry {
1297
+ id: number;
1298
+ name: string;
1299
+ tax: number;
1300
+ code: string;
1301
+ tax_name: string;
1302
+ shipping_zone_id: number;
1303
+ provinces: IShippingProvince[];
1304
+ }
1305
+
1306
+ interface IWeightRule {
1307
+ id: number;
1308
+ name: string;
1309
+ price: string;
1310
+ shipping_zone_id: number;
1311
+ weight_low: number;
1312
+ weight_high: number;
1313
+ }
1314
+ interface IPriceRule {
1315
+ id: number;
1316
+ name: string;
1317
+ price: string;
1318
+ shipping_zone_id: number;
1319
+ min_order_subtotal: number;
1320
+ max_order_subtotal: number;
1321
+ }
1322
+
1323
+ interface IShippingZone {
1324
+ id: number;
1325
+ name: string;
1326
+ countries: IShippingCountry[];
1327
+ weight_based_shipping_rates: IWeightRule[];
1328
+ price_based_shipping_rates: IPriceRule[];
1329
+ carrier_shipping_rate_providers: [];
1330
+ }
1331
+
1332
+ interface IPriceRule {
1333
+ id: number;
1334
+ value_type: 'fixed_amount' | 'percentage';
1335
+ value: string;
1336
+ customer_selection: 'all' | 'prerequisite';
1337
+ target_type: 'line_item' | 'shipping_line';
1338
+ target_selection: 'all' | 'entitled';
1339
+ allocation_method: 'across' | 'each';
1340
+ allocation_limit: number;
1341
+ once_per_customer: boolean;
1342
+ usage_limit: number;
1343
+ starts_at: string;
1344
+ ends_at: string;
1345
+ created_at: string;
1346
+ updated_at: string;
1347
+ entitled_product_ids: number[];
1348
+ entitled_variant_ids: number[];
1349
+ entitled_collection_ids: number[];
1350
+ entitled_country_ids: number[];
1351
+ prerequisite_product_ids: number[];
1352
+ prerequisite_variant_ids: number[];
1353
+ prerequisite_collection_ids: number[];
1354
+ prerequisite_saved_search_ids: number[];
1355
+ prerequisite_customer_ids: number[];
1356
+ prerequisite_to_entitlement_quantity_ratio: {
1357
+ prerequisite_quantity: number;
1358
+ entitled_quantity: number;
1359
+ };
1360
+ title: string;
1361
+ }
1362
+
1363
+ interface IDiscountCode {
1364
+ id: number;
1365
+ price_rule_id: number;
1366
+ code: string;
1367
+ usage_count: number;
1368
+ created_at: string;
1369
+ updated_at: string;
1370
+ }
1371
+
1372
+ interface IDiscount {
1373
+ code: IDiscountCode;
1374
+ rule: IPriceRule;
1375
+ }
1376
+
1377
+ interface IRefund {
1378
+ id: number;
1379
+ order_id: number;
1380
+ created_at: string;
1381
+ note: string;
1382
+ user_id: number;
1383
+ processed_at: string;
1384
+ restock: boolean;
1385
+ duties: any[];
1386
+ total_duties_set: {
1387
+ shop_money: {
1388
+ amount: string;
1389
+ currency_code: ICurrency;
1390
+ };
1391
+ presentment_money: {
1392
+ amount: string;
1393
+ currency_code: ICurrency;
1394
+ };
1395
+ };
1396
+ refund_line_items: IRefundLineItem[];
1397
+ }
1398
+
1399
+ interface IRefundLineItem {
1400
+ id?: number;
1401
+ quantity?: number;
1402
+ line_item_id?: number;
1403
+ location_id?: number;
1404
+ restock_type?: 'legacy_restock' | 'return' | 'cancel' | 'no_restock';
1405
+ subtotal?: number;
1406
+ total_tax?: number;
1407
+ subtotal_set?: {
1408
+ shop_money: {
1409
+ amount: string;
1410
+ currency_code: ICurrency;
1411
+ };
1412
+ presentment_money: {
1413
+ amount: string;
1414
+ currency_code: ICurrency;
1415
+ };
1416
+ };
1417
+ total_tax_set?: {
1418
+ shop_money: {
1419
+ amount: string;
1420
+ currency_code: ICurrency;
1421
+ };
1422
+ presentment_money: {
1423
+ amount: string;
1424
+ currency_code: ICurrency;
1425
+ };
1426
+ };
1427
+ line_item?: ILineItem;
1428
+ }
1429
+
1430
+ interface IAvailableShippingRate {
1431
+ handle: string;
1432
+ title: string;
1433
+ price: {
1434
+ amount: string;
1435
+ currencyCode: string;
1436
+ };
1437
+ }
1438
+
1439
+ interface ICalculatedDraftOrder {
1440
+ availableShippings: IAvailableShippingRate[];
1441
+ totalTaxes: number;
1442
+ taxLines: ITaxLine[];
1443
+ shippingTaxLines: ITaxLine[];
1444
+ }
1445
+
1446
+ interface IShopifySinglePayment {
1447
+ name: string;
1448
+ price: number;
1449
+ return_url: string;
1450
+ test: boolean;
1451
+ }
1452
+
1453
+ interface IShopifySinglePaymentResponse {
1454
+ id: number;
1455
+ name: string;
1456
+ api_client_id: number;
1457
+ price: string;
1458
+ status: 'pending';
1459
+ return_url: string;
1460
+ created_at: string;
1461
+ updated_at: string;
1462
+ charge_type: null;
1463
+ decorated_return_url: string;
1464
+ confirmation_url: string;
1465
+ }
1466
+
1467
+ interface IShopifyDraftOrderCalculate {
1468
+ calculatedDraftOrder: {
1469
+ subtotalPrice: string;
1470
+ totalPrice: string;
1471
+ totalShippingPrice: string;
1472
+ totalTax: string;
1473
+ shippingLine: {
1474
+ taxLines: IShopifyTaxLine[];
1475
+ };
1476
+ taxLines: IShopifyTaxLine[];
1477
+ };
1478
+ }
1479
+
1480
+ interface IShopifyTaxLine {
1481
+ rate: number;
1482
+ title: string;
1483
+ priceSet: {
1484
+ shopMoney: {
1485
+ amount: string;
1486
+ currencyCode: ICurrency;
1487
+ };
1488
+ };
1489
+ }
1490
+
1491
+ interface ILineItemForDraftCalculation {
1492
+ variantId?: string;
1493
+ quantity?: number;
1494
+ originalUnitPrice?: string;
1495
+ title?: string;
1496
+ }
1497
+
1498
+ interface IDeliveryCustomisation {
1499
+ id: number;
1500
+ title: string;
1501
+ enabled: boolean;
1502
+ metafield: IMetafield;
1503
+ }
1504
+
1505
+ interface ICartTransforms {
1506
+ functionId: string;
1507
+ id: number;
1508
+ metafield: { value: string; };
1509
+ }
1510
+
1511
+ interface ICheckout {
1512
+ id: number;
1513
+ token: string;
1514
+ cart_token: string;
1515
+ email: string;
1516
+ gateway: string;
1517
+ buyer_accepts_marketing: false,
1518
+ buyer_accepts_sms_marketing: false,
1519
+ sms_marketing_phone: null,
1520
+ created_at: string;
1521
+ updated_at: string;
1522
+ landing_site: string;
1523
+ note: string;
1524
+ note_attributes: string[];
1525
+ referring_site: string;
1526
+ shipping_lines:
1527
+ {
1528
+ code: string;
1529
+ price: string;
1530
+ original_shop_price: string;
1531
+ original_shop_markup: string;
1532
+ source: 'shopify';
1533
+ title: string;
1534
+ presentment_title: string;
1535
+ phone: string;
1536
+ tax_lines: any[],
1537
+ markup: string;
1538
+ carrier_identifier: string;
1539
+ carrier_service_id: number;
1540
+ api_client_id: string;
1541
+ delivery_option_group: {
1542
+ token: string;
1543
+ type: 'one_time_purchase' | string;
1544
+ };
1545
+ id: number;
1546
+ requested_fulfillment_service_id: number;
1547
+ delivery_category: number;
1548
+ validation_context: number;
1549
+ applied_discounts: any[];
1550
+ }[];
1551
+ shipping_address: IAddress;
1552
+ taxes_included: boolean;
1553
+ total_weight: number;
1554
+ currency: ICurrency;
1555
+ completed_at: string;
1556
+ phone: string;
1557
+ customer_locale: string;
1558
+ line_items: ILineItem[];
1559
+ name: string;
1560
+ abandoned_checkout_url: string;
1561
+ discount_codes: any[];
1562
+ tax_lines:
1563
+ {
1564
+ price: string;
1565
+ rate: number;
1566
+ title: string;
1567
+ }[];
1568
+ presentment_currency: ICurrency;
1569
+ total_line_items_price: string;
1570
+ total_tax: string;
1571
+ total_discounts: string;
1572
+ subtotal_price: string;
1573
+ total_price: string;
1574
+ total_duties: string;
1575
+ device_id: number;
1576
+ user_id: number;
1577
+ location_id: number;
1578
+ billing_address: IAddress;
1579
+ customer: ICustomer;
1580
+ }
1581
+
1582
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1583
+ declare namespace ShopifygraphQl {
1584
+
1585
+ export interface IResponseExtensions {
1586
+ cost: {
1587
+ requestedQueryCost: 362,
1588
+ actualQueryCost: 52,
1589
+ throttleStatus: {
1590
+ maximumAvailable: number;
1591
+ currentlyAvailable: number;
1592
+ restoreRate: number;
1593
+ }
1594
+ }
1595
+ }
1596
+ export interface IPageInfo {
1597
+ endCursor: string;
1598
+ hasNextPage: boolean;
1599
+ }
1600
+ export interface IProductResponseFrame {
1601
+ products: { edges: { node: IGenericProductResponse}[]; pageInfo: IPageInfo; };
1602
+ extensions: IResponseExtensions;
1603
+ }
1604
+ export interface IGenericVariantResponse {
1605
+ id: string;
1606
+ barcode?: string;
1607
+ compareAtPrice: string;
1608
+ price: string;
1609
+ sku: string;
1610
+ availableForSale: boolean;
1611
+ inventoryQuantity: 6,
1612
+ inventoryPolicy: 'DENY' | 'CONTINUE';
1613
+ taxable: boolean;
1614
+ inventoryItem: {
1615
+ id: string;
1616
+ tracked: boolean;
1617
+ unitCost: {
1618
+ amount: number;
1619
+ }
1620
+ measurement?: {
1621
+ weight: {
1622
+ unit: 'POUNDS' | 'OUNCES' | 'KILOGRAMS' | 'GRAMS';
1623
+ value: number;
1624
+ }
1625
+ };
1626
+ };
1627
+ media?: {
1628
+ nodes: {id: string;}[]
1629
+ };
1630
+ selectedOptions?: { name: string; value: string; }[];
1631
+ }
1632
+ export interface IGenericProductResponse {
1633
+ id: string;
1634
+ vendor: string;
1635
+ descriptionHtml?: string;
1636
+ title?: string;
1637
+ productType: string;
1638
+ createdAt: string;
1639
+ updatedAt: string;
1640
+ publishedAt: string;
1641
+ handle: string;
1642
+ status: 'ACTIVE' | 'DRAFT' | 'ARCHIVED';
1643
+ images: {
1644
+ edges: {
1645
+ node: {
1646
+ id: string;
1647
+ url: string;
1648
+ }
1649
+ }[];
1650
+ };
1651
+ tags?: string[];
1652
+ options?: { name: string; position: number; optionValues: { name: string }[]; }[];
1653
+ variants: {
1654
+ edges: { node: IGenericVariantResponse; }[];
1655
+ };
1656
+ }
1657
+
1658
+ export interface IGenericOrderResponse {
1659
+ id: string;
1660
+ name: string;
1661
+ transaction?: { gateway: string; authorization_code: string; };
1662
+ }
1663
+
1664
+
1665
+ export interface IVariantToPost {
1666
+ id?: string;
1667
+ mediaId?: string;
1668
+ barcode?: string; compareAtPrice?: string; inventoryPolicy?: IInventoryPolicy;
1669
+ mediaSrc?: string[]; optionValues?: { name: string; optionName: string; }[]; price?: string;
1670
+ inventoryQuantities?: { availableQuantity: number; locationId: string; }[]; taxable?: boolean;
1671
+ inventoryItem?: { sku?: string; tracked?: boolean; cost?: number; measurement?: { weight: { unit?: IWeigh, value?: number; } } }
1672
+ }
1673
+
1674
+ export interface IVariantInventoryToPut {
1675
+ ignoreCompareQuantity?: boolean;
1676
+ reason: 'correction';
1677
+ name: 'available';
1678
+ referenceDocumentUri?: string;
1679
+ changes?: { delta: number, inventoryItemId: string; locationId: string; }[];
1680
+ quantities?: { quantity: number, inventoryItemId: string; locationId: string; }[];
1681
+ }
1682
+ }