feat(medusa,fulfillment): pass stock location data to fulfillment provider (#9322)
**What** - Fetches the stock location's details when creating a fulfillment and return fulfillment. - Passes the data to the fulfillment module, which in turn passes it to the fulfillment provider. **Why** - When creating a fulfillment in a multi-location setup the fulfillment provider will need to know where the package is being sent from (so the shipping service can pick it up). - Previously, we didn't pass anything but the location id to the fulfillment provider. Because the fulfillment provider can't have a dependency on the stock location module this was not sufficient. - This change ensures there is enough data passed to the fulfillment provider to build integrations properly.
This commit is contained in:
@@ -9,12 +9,13 @@ export function generateCreateFulfillmentData(
|
||||
provider_id: string
|
||||
shipping_option_id: string
|
||||
order_id: string
|
||||
location_id: string
|
||||
}
|
||||
) {
|
||||
const randomString = Math.random().toString(36).substring(7)
|
||||
|
||||
return {
|
||||
location_id: "test-location",
|
||||
location_id: data.location_id,
|
||||
packed_at: null,
|
||||
shipped_at: null,
|
||||
delivered_at: null,
|
||||
@@ -97,8 +98,10 @@ export async function setupFullDataFulfillmentStructure(
|
||||
service: IFulfillmentModuleService,
|
||||
{
|
||||
providerId,
|
||||
locationId,
|
||||
}: {
|
||||
providerId: string
|
||||
locationId: string
|
||||
}
|
||||
) {
|
||||
const randomString = Math.random().toString(36).substring(7)
|
||||
@@ -133,6 +136,8 @@ export async function setupFullDataFulfillmentStructure(
|
||||
|
||||
await service.createFulfillment(
|
||||
generateCreateFulfillmentData({
|
||||
order_id: "fake-order",
|
||||
location_id: locationId,
|
||||
provider_id: providerId,
|
||||
shipping_option_id: shippingOption.id,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user