@shipengine/connect-fulfillment-provider-api 0.3.0 → 0.5.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 (61) hide show
  1. package/lib/app/fulfillment-provider-app-definition.d.ts +10 -6
  2. package/lib/app/fulfillment-provider-app.js +12 -7
  3. package/lib/app/fulfillment-provider-app.js.map +1 -1
  4. package/lib/models/index.d.ts +1 -1
  5. package/lib/models/index.js +1 -1
  6. package/lib/models/index.js.map +1 -1
  7. package/lib/models/sales-order-fulfillments.d.ts +19 -0
  8. package/lib/{requests/delegation-request.js → models/sales-order-fulfillments.js} +1 -1
  9. package/lib/models/sales-order-fulfillments.js.map +1 -0
  10. package/lib/requests/{cancellation-request.d.ts → cancel-fulfillment-request.d.ts} +1 -1
  11. package/lib/requests/cancel-fulfillment-request.js +3 -0
  12. package/lib/requests/cancel-fulfillment-request.js.map +1 -0
  13. package/lib/requests/{delegation-request.d.ts → delegate-fulfillment-request.d.ts} +1 -1
  14. package/lib/requests/delegate-fulfillment-request.js +3 -0
  15. package/lib/requests/delegate-fulfillment-request.js.map +1 -0
  16. package/lib/requests/{status-request.d.ts → get-fulfillments-request.d.ts} +1 -1
  17. package/lib/requests/{inventory-request.js → get-fulfillments-request.js} +1 -1
  18. package/lib/requests/get-fulfillments-request.js.map +1 -0
  19. package/lib/requests/{inventory-request.d.ts → get-inventory-request.d.ts} +1 -1
  20. package/lib/requests/{cancellation-request.js → get-inventory-request.js} +1 -1
  21. package/lib/requests/get-inventory-request.js.map +1 -0
  22. package/lib/requests/index.d.ts +4 -4
  23. package/lib/requests/index.js +4 -4
  24. package/lib/requests/index.js.map +1 -1
  25. package/lib/responses/cancel-fulfillment-response.d.ts +1 -0
  26. package/lib/responses/cancel-fulfillment-response.js +3 -0
  27. package/lib/responses/cancel-fulfillment-response.js.map +1 -0
  28. package/lib/responses/delegate-fulfillment-response.d.ts +3 -0
  29. package/lib/responses/delegate-fulfillment-response.js +3 -0
  30. package/lib/responses/delegate-fulfillment-response.js.map +1 -0
  31. package/lib/responses/get-fulfillments-response.d.ts +7 -0
  32. package/lib/{models/sales-order-status-change.js → responses/get-fulfillments-response.js} +1 -1
  33. package/lib/responses/get-fulfillments-response.js.map +1 -0
  34. package/lib/responses/{inventory-response.d.ts → get-inventory-response.d.ts} +1 -1
  35. package/lib/{requests/status-request.js → responses/get-inventory-response.js} +1 -1
  36. package/lib/responses/get-inventory-response.js.map +1 -0
  37. package/lib/responses/get-recent-changes-response.d.ts +2 -2
  38. package/lib/responses/index.d.ts +4 -4
  39. package/lib/responses/index.js +4 -4
  40. package/lib/responses/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/spec.json +2820 -2609
  43. package/spec.yaml +242 -96
  44. package/tsconfig.tsbuildinfo +1 -1
  45. package/lib/models/sales-order-status-change.d.ts +0 -22
  46. package/lib/models/sales-order-status-change.js.map +0 -1
  47. package/lib/requests/cancellation-request.js.map +0 -1
  48. package/lib/requests/delegation-request.js.map +0 -1
  49. package/lib/requests/inventory-request.js.map +0 -1
  50. package/lib/requests/status-request.js.map +0 -1
  51. package/lib/responses/cancellation-response.d.ts +0 -3
  52. package/lib/responses/cancellation-response.js +0 -3
  53. package/lib/responses/cancellation-response.js.map +0 -1
  54. package/lib/responses/delegation-response.d.ts +0 -3
  55. package/lib/responses/delegation-response.js +0 -3
  56. package/lib/responses/delegation-response.js.map +0 -1
  57. package/lib/responses/inventory-response.js +0 -3
  58. package/lib/responses/inventory-response.js.map +0 -1
  59. package/lib/responses/status-response.d.ts +0 -8
  60. package/lib/responses/status-response.js +0 -3
  61. package/lib/responses/status-response.js.map +0 -1
package/spec.yaml CHANGED
@@ -5,7 +5,7 @@ info:
5
5
  paths:
6
6
  /connect:
7
7
  post:
8
- summary: Connect to Partner
8
+ summary: Connect to Fulfillment Provider
9
9
  operationId: post-connect
10
10
  responses:
11
11
  '200':
@@ -32,9 +32,10 @@ paths:
32
32
  auth:
33
33
  $ref: '#/components/schemas/Auth'
34
34
  description: Contains form data for connecting to the app
35
- /fulfillment/delegation:
35
+ description: Verify credentials are valid for a new connection to a fulfillment provider
36
+ /delegate_fulfillment:
36
37
  post:
37
- summary: Fulfillment Delegation Request
38
+ summary: Delegate Fulfillment
38
39
  operationId: post-fulfillment-delegation
39
40
  responses:
40
41
  '200':
@@ -44,9 +45,9 @@ paths:
44
45
  schema:
45
46
  type: object
46
47
  properties:
47
- fulfillment_partner_order_id:
48
+ fulfillment_provider_order_id:
48
49
  type: string
49
- description: ''
50
+ description: Delegate a sales order to a fulfillment provider. The fulfillment provider will attempt to fulfill the shipment of all line items. Returns the identifier used by the fulfillment provider for subsequent status updates for the order and it's fulfillments. Often this is the same as the order_id.
50
51
  requestBody:
51
52
  content:
52
53
  application/json:
@@ -304,9 +305,10 @@ paths:
304
305
  type: string
305
306
  in: header
306
307
  name: tenant-id
307
- /fulfillment/status:
308
+ parameters: []
309
+ /get_fulfillments:
308
310
  post:
309
- summary: Get Fulfillment Status
311
+ summary: Get Fulfillments
310
312
  operationId: post-fulfillment-status
311
313
  responses:
312
314
  '200':
@@ -316,18 +318,121 @@ paths:
316
318
  schema:
317
319
  type: object
318
320
  properties:
321
+ fulfillment_provider_order_id:
322
+ type: string
319
323
  status:
320
- $ref: '#/components/schemas/SalesOrderStatusChange'
324
+ type: string
325
+ fulfillments:
326
+ type: array
327
+ items:
328
+ $ref: '#/components/schemas/SalesOrderFulfillment'
329
+ shipments:
330
+ type: array
331
+ items:
332
+ $ref: '#/components/schemas/ShipmentNotification'
321
333
  polling:
322
334
  type: object
323
335
  properties:
324
336
  is_final_update_state:
325
337
  type: boolean
326
- enum:
327
- - once
328
- - changes_since
329
338
  max_age_seconds:
330
339
  type: number
340
+ required:
341
+ - fulfillment_provider_order_id
342
+ examples:
343
+ example-1:
344
+ value:
345
+ fulfillment_provider_order_id: string
346
+ status: string
347
+ fulfillments:
348
+ - status: Processing
349
+ reason: string
350
+ explanation: string
351
+ line_items:
352
+ - line_item_id: string
353
+ sku: string
354
+ quantity: 0
355
+ shipments:
356
+ - carrier_code: string
357
+ carrier_service_code: string
358
+ currency: 'USD,EUR,NZD'
359
+ ext_location_id: string
360
+ fulfillment_cost: 0
361
+ insurance_cost: 0
362
+ integration_context: {}
363
+ items:
364
+ - description: string
365
+ line_item_id: string
366
+ product_id: string
367
+ quantity: 0
368
+ sku: string
369
+ notes:
370
+ - text: string
371
+ type: BackOrderMessage
372
+ notification_id: string
373
+ notify_buyer: true
374
+ order_id: string
375
+ order_number: string
376
+ return_address:
377
+ address_line_1: string
378
+ address_line_2: string
379
+ address_line_3: string
380
+ city: string
381
+ company: string
382
+ country_code: 'US,MX,CA'
383
+ is_verified: true
384
+ name: string
385
+ first_name: string
386
+ last_name: string
387
+ phone: string
388
+ pickup_location:
389
+ carrier_id: string
390
+ relay_id: string
391
+ postal_code: string
392
+ residential_indicator: R
393
+ state_province: string
394
+ ship_date: '2021-03-31T18:21:14.858Z'
395
+ ship_from:
396
+ address_line_1: string
397
+ address_line_2: string
398
+ address_line_3: string
399
+ city: string
400
+ company: string
401
+ country_code: 'US,MX,CA'
402
+ is_verified: true
403
+ name: string
404
+ first_name: string
405
+ last_name: string
406
+ phone: string
407
+ pickup_location:
408
+ carrier_id: string
409
+ relay_id: string
410
+ postal_code: string
411
+ residential_indicator: R
412
+ state_province: string
413
+ ship_to:
414
+ address_line_1: string
415
+ address_line_2: string
416
+ address_line_3: string
417
+ city: string
418
+ company: string
419
+ country_code: 'US,MX,CA'
420
+ is_verified: true
421
+ name: string
422
+ first_name: string
423
+ last_name: string
424
+ phone: string
425
+ pickup_location:
426
+ carrier_id: string
427
+ relay_id: string
428
+ postal_code: string
429
+ residential_indicator: R
430
+ state_province: string
431
+ tracking_number: string
432
+ tracking_url: string
433
+ polling:
434
+ is_final_update_state: true
435
+ max_age_seconds: 0
331
436
  requestBody:
332
437
  content:
333
438
  application/json:
@@ -336,39 +441,28 @@ paths:
336
441
  properties:
337
442
  auth:
338
443
  $ref: '#/components/schemas/Auth'
339
- fulfillment_partner_order_id:
444
+ fulfillment_provider_order_id:
340
445
  type: string
341
446
  required:
342
447
  - auth
343
- - fulfillment_partner_order_id
448
+ - fulfillment_provider_order_id
344
449
  description: |-
345
- Receives an single partner orderid id that was returned from the /fulfillment/delegation resource.
346
- It should return matching fulfillment quantity updates for all line items of the original fulfillment delegations.
347
- It should return quantities for rejected, cancelled, and shipped per line item.
348
- Rejected means the partner cannot fulfill that item.
349
- Cancelled means the client has requested an item not be fulfilled and the partner was able to stop fulfillment.
350
- Shipped means the item has left for delivery.
450
+ Returns a list of fulfillments that the fulfillment provider has decided to use to fulfill an order. It may return only a root level status, which indicates a single status for all line items on an order. It may also return a list of fulfillments, their status, and the line items included in that fulfillment. Fulfillments may or may not match a list of shipments, this is completely up to the fulfillment provider.
351
451
 
352
- The original fulfillment will be marked shipped when all line items are either rejected/cancelled/shipped and at least one is shipped.
452
+ To communicate that the results for an order will no longer change the polling fields is_final_update_state should be set to true.
353
453
 
354
- This resource is requested after the first time /fulfillment/status returns a polling method of "Batch".
355
- The polling interval is once every 30 minutes.
356
- The maximum number of ids per request is 50.
357
- When there are more than 50 ids to request they are sequentially sent in batches of 50.
454
+ The polling fields max_age_seconds refers to the expected cachable time of this result.
358
455
 
359
- Polling can be controlled by returning the polling.max_age_seconds or polling.per_request_limit property.
360
- The polling.max_age_seconds property overrides the 30 minute interval.
361
- The polling.per_request_limit property overrides the 50 ids sent per request.
362
-
363
- Individual fulfillments can be removed from the batch polling method by returning "once" or "cursor" in the polling.method property.
456
+ To instead return a list of changes on a periodic basis, refer to the /get_recent_changes path instead.
364
457
  parameters:
365
458
  - schema:
366
459
  type: string
367
460
  in: header
368
461
  name: tenant-id
369
- /fulfillment/cancellation:
462
+ parameters: []
463
+ /cancel_fulfillment:
370
464
  post:
371
- summary: Fulfillment Cancellation Request
465
+ summary: Request Fulfillment Cancellation
372
466
  operationId: post-fulfillment-cancellation
373
467
  responses:
374
468
  '200':
@@ -377,9 +471,6 @@ paths:
377
471
  application/json:
378
472
  schema:
379
473
  type: object
380
- properties:
381
- reason:
382
- type: string
383
474
  parameters:
384
475
  - schema:
385
476
  type: string
@@ -393,15 +484,17 @@ paths:
393
484
  properties:
394
485
  auth:
395
486
  $ref: '#/components/schemas/Auth'
396
- partner_fulfillment_order_id:
487
+ fulfillment_provider_order_id:
397
488
  type: string
398
489
  reason:
399
490
  type: string
400
491
  required:
401
492
  - auth
402
- - partner_fulfillment_order_id
493
+ - fulfillment_provider_order_id
403
494
  - reason
404
- /rates:
495
+ description: Request the cancellation of a requested fulfillment send using the /delegate_fulfillment path. This will likely only start the cancellation process. Status updates via /get_fulfillments and /get_recent_changes will return the cancellation status when it is completed.
496
+ parameters: []
497
+ /get_rates:
405
498
  post:
406
499
  summary: Get Estimated Rates
407
500
  operationId: post-rates
@@ -472,10 +565,11 @@ paths:
472
565
  type: string
473
566
  in: header
474
567
  name: tenant-id
475
- /get-recent-changes:
568
+ parameters: []
569
+ /get_recent_changes:
476
570
  parameters: []
477
571
  post:
478
- summary: Get recent fulfillment changes since when
572
+ summary: Get Recent Changes
479
573
  operationId: post-fulfillment-get-recent-changes
480
574
  responses:
481
575
  '200':
@@ -488,26 +582,15 @@ paths:
488
582
  changes:
489
583
  type: array
490
584
  items:
491
- $ref: '#/components/schemas/SalesOrderStatusChange'
585
+ $ref: '#/components/schemas/SalesOrderFulfillment'
492
586
  next_request:
493
587
  type: string
494
- since:
495
- type: string
496
- '':
497
- content:
498
- application/json:
499
- schema:
500
- type: object
501
- properties:
502
- changes:
503
- type: string
504
- next_request:
505
- type:
506
- - object
507
- - string
508
588
  description: |-
509
- Receives a timestamp and returns a list of line item changes since then.
510
- It may also return order level status changes that should be applied to all line items on the order as a whole.
589
+ Receives a timestamp of the last time requested changes was made, automatically buffered to include duplicate results to prevent skipping time.
590
+
591
+ Returns a list of changes. These changes include fulfillments that the fulfillment provider has decided to use to fulfill an order. It may return only an order level status, which indicates a single status for all line items on an order. It may also return a list of fulfillments, their status, and the line items included in that fulfillment. Fulfillments may or may not match a list of shipments, this is completely up to the fulfillment provider.
592
+
593
+ To instead return status on single orders at a time , refer to the /get_fulfillments path instead.
511
594
  requestBody:
512
595
  content:
513
596
  application/json:
@@ -522,13 +605,67 @@ paths:
522
605
  - string
523
606
  since:
524
607
  type: string
608
+ examples: {}
525
609
  parameters:
526
610
  - schema:
527
611
  type: string
528
612
  in: header
529
613
  name: tenant-id
530
- /reconnect: {}
531
- /inventory: {}
614
+ /get_inventory:
615
+ post:
616
+ summary: Get Inventory
617
+ operationId: post-get-inventory
618
+ responses:
619
+ '200':
620
+ description: OK
621
+ content:
622
+ application/json:
623
+ schema:
624
+ type: object
625
+ properties:
626
+ inventory:
627
+ type: object
628
+ properties:
629
+ sku:
630
+ type: string
631
+ warehouse_id:
632
+ type: string
633
+ available_quantity:
634
+ type: string
635
+ committed_quantity:
636
+ type: string
637
+ on_hand_quantity:
638
+ type: string
639
+ next_request:
640
+ type:
641
+ - string
642
+ - object
643
+ examples:
644
+ example-1:
645
+ value:
646
+ inventory:
647
+ sku: string
648
+ warehouse_id: string
649
+ available_quantity: string
650
+ committed_quantity: string
651
+ on_hand_quantity: string
652
+ next_request: string
653
+ requestBody:
654
+ content:
655
+ application/json:
656
+ schema:
657
+ type: object
658
+ properties:
659
+ auth:
660
+ $ref: '#/components/schemas/Auth'
661
+ next_request:
662
+ type:
663
+ - object
664
+ - string
665
+ required:
666
+ - auth
667
+ description: Return the inventory that a fulfillment provider currently has for this merchant. Pagination is supplied via the next_request field. Pagination requests will be made until next_request is set to null. This is an optional path only for fulfillment providers who support inventory and are added as inventory provider integrations.
668
+ parameters: []
532
669
  components:
533
670
  schemas:
534
671
  Address:
@@ -599,7 +736,7 @@ components:
599
736
  connection_context:
600
737
  type: string
601
738
  description: Custom Value 3
602
- fulfillment_partner_api_code:
739
+ fulfillment_provider_api_code:
603
740
  type: string
604
741
  password:
605
742
  type: string
@@ -608,7 +745,7 @@ components:
608
745
  username:
609
746
  type: string
610
747
  required:
611
- - fulfillment_partner_api_code
748
+ - fulfillment_provider_api_code
612
749
  BillingCategory:
613
750
  type: string
614
751
  title: BillingCategory
@@ -1326,29 +1463,6 @@ components:
1326
1463
  type: string
1327
1464
  required:
1328
1465
  - rates
1329
- LineItemQuantityStatus:
1330
- title: LineItemQuantityStatus
1331
- type: object
1332
- properties:
1333
- line_item_id:
1334
- type: string
1335
- sku:
1336
- type: string
1337
- quantity:
1338
- type: number
1339
- shipped_quantity:
1340
- type: number
1341
- cancelled_quantity:
1342
- $ref: '#/components/schemas/QuantityWithReason'
1343
- rejected_quantity:
1344
- $ref: '#/components/schemas/QuantityWithReason'
1345
- unknown_quantity:
1346
- $ref: '#/components/schemas/QuantityWithReason'
1347
- required:
1348
- - line_item_id
1349
- - sku
1350
- - quantity
1351
- description: Sales order line item quantity fulfillment statuses
1352
1466
  Note:
1353
1467
  title: Note
1354
1468
  type: object
@@ -1715,31 +1829,29 @@ components:
1715
1829
  required:
1716
1830
  - description
1717
1831
  - quantity
1718
- SalesOrderStatus:
1832
+ SalesOrderFulfillmentStatus:
1719
1833
  type: string
1720
- title: SalesOrderStatus
1834
+ title: SalesOrderFulfillmentStatus
1721
1835
  enum:
1722
1836
  - Processing
1723
1837
  - Cancelled
1724
1838
  - Rejected
1725
- - Unknown
1726
- - PartiallyShipped
1727
1839
  - Shipped
1728
- SalesOrderStatusChange:
1729
- title: SalesOrderStatusChange
1840
+ SalesOrderFulfillment:
1841
+ title: SalesOrderFulfillment
1730
1842
  type: object
1731
1843
  description: Represents a status change update for a sales order
1732
1844
  properties:
1733
- order_id:
1734
- type: string
1735
1845
  status:
1736
- $ref: '#/components/schemas/SalesOrderStatus'
1737
- items:
1738
- $ref: '#/components/schemas/LineItemQuantityStatus'
1739
- shipments:
1846
+ $ref: '#/components/schemas/SalesOrderFulfillmentStatus'
1847
+ reason:
1848
+ type: string
1849
+ explanation:
1850
+ type: string
1851
+ line_items:
1740
1852
  type: array
1741
1853
  items:
1742
- $ref: '#/components/schemas/ShipmentNotification'
1854
+ $ref: '#/components/schemas/FulfillmentLineItem'
1743
1855
  ShipmentNotification:
1744
1856
  title: ShipmentNotification
1745
1857
  type: object
@@ -2037,4 +2149,38 @@ components:
2037
2149
  - weight_in_grams
2038
2150
  - source_weight
2039
2151
  - source_weight_unit
2152
+ FulfillmentLineItem:
2153
+ title: FulfillmentLineItem
2154
+ x-stoplight:
2155
+ id: 0wglkamy8lqi5
2156
+ type: object
2157
+ properties:
2158
+ line_item_id:
2159
+ type: string
2160
+ sku:
2161
+ type: string
2162
+ quantity:
2163
+ type: number
2164
+ required:
2165
+ - quantity
2166
+ SalesOrderFulfillments:
2167
+ title: SalesOrderFulfillments
2168
+ x-stoplight:
2169
+ id: 0mccgdffw5fq2
2170
+ type: object
2171
+ properties:
2172
+ fulfillment_provider_order_id:
2173
+ type: string
2174
+ status:
2175
+ $ref: '#/components/schemas/SalesOrderFulfillmentStatus'
2176
+ fulfillments:
2177
+ type: array
2178
+ items:
2179
+ $ref: '#/components/schemas/SalesOrderFulfillment'
2180
+ shipments:
2181
+ type: array
2182
+ items:
2183
+ $ref: '#/components/schemas/ShipmentNotification'
2184
+ required:
2185
+ - fulfillment_provider_order_id
2040
2186
  requestBodies: {}