...
3. Receive and persist fee information in DMP
The create delivery request sent by partners-service is received by DMP /orders endpoint, which creates and OrderResponseDTO object in Dynamo DB. First we need to include the fee field in the three relevant DTOs: OrderResponseDto
, DeliveryWebhookRbiDto
and DeliveryWebhookDto
.
intl-partners-delivery/src/modules/orders/dto/order-response.dto.ts
intl-partners-delivery/src/modules/orders/dto/delivery-webhook.dto.ts
intl-partners-delivery/src/modules/orders/dto/delivery-webhook-rbi.dto.ts
Code Block | ||
---|---|---|
| ||
export class FeesDto {
@Type(() => Amount)
@ValidateNested()
@IsObject()
@ApiProperty({ description: 'Delivery fee charged in the order', type: Amount })
deliveryFee: Amount;
@Type(() => Amount)
@ValidateNested()
@IsObject()
@ApiProperty({ description: 'Service fee charged in the order', type: Amount })
serviceFee: Amount;
}
export class OrderResponseDto {
...
@ApiProperty({ description: 'Fees charged in the order', type: FeesDto })
fees?: FeesDto;
}
export class DeliveryWebhookRbiDto {
...
@ApiProperty({ description: 'Fees charged in the order', type: FeesDto })
fees?: FeesDto;
}
export class DeliveryWebhookDto {
...
@ApiProperty({ description: 'Fees charged in the order', type: FeesDto })
fees?: FeesDto;
} |
After the above it’s done, it’s a matter of adjusting the relevant formatter methods used by the webhook.
Code Block | ||
---|---|---|
| ||
async webhookCreateOrder(...) {
...
const body: DeliveryWebhookDto = {
...
fees: payload.fees,
};
}
private async formatOrderFromWebhook(...) {
return {
...
fees: body.fees,
}
} |
And now the orders are created in dynamo with the fee information:
...
4. Display fee breakdown in expeditor tablet, including printed tickets
We’ll have to align with the UI/UX team to find the best way to display the new information, but as long as the backend is returning it, expeditor tablet has only to adjust the Order interface and create the new react components responsible for showing the fees.
Task breakdown
[intl-fulfillment-service]
Adjust fee calculation to stop aggregating all fees into delivery
[intl-partners-service]
Update crete delivery to send the fee information
[intl-partners-delivery]
Update create delivery webhook to receive the fee information
Create/update e2e order tests to include the new scenario
[intl-expeditor-tablet]
Display fee breakdown in order detail
Validate if the order ticket is printed with the fees
Create/update e2e order tests to include the new scenario