/
NUTRINTG Positive Fulfillment

NUTRINTG Positive Fulfillment

General overview:

Filling some forms in EnfamilCA should result in specific data transfer to the Fulfillment Center (POSITIVE FULFILLMENT) do that the Center could send some product samples to the customers.

Logic flow:

1. Router

Profiles with ASC = CANGWTCA should be redirected to both:

  • CDP Profile Adapter

  • Positive Fulfillment Adapter

 

2. Checking whether the particular profile should be sent to Fulfillment Center

The flag will be passed by the FrontEnd in unmapped attributes section as STRING with two possible values:

  • “true”

  • “false”

Exact JSON:

{ [...], "JsonExternalData": { "UnmappedAttributes": { "PositiveFulfill_flag": "true", [...] } [...] } }

Possible scenarios:

  • If “true” the profile should be transformed

  • In case of any other value, the profile in the adapter should be dropped

3. Transform a message:

INPUT MESSAGE:

  • Profile from MIDDLEWARE PROFILE SERVICE

OUTPUT MESSAGE:

{ "Consignee": { "FirstName": "TestAmx", "LastName": "TestAmx", "Address1": "TestAmx", "Address2": "TestAmx", "City": "Vaughan", "ProvinceCode": "ON", "PostalCode": "M5V 2A1", "CountryCode": "CA", "Telephone": "5235235235", "EMail": "amxtest217112019@mail.com", "LanguageCode": "FR" }, "UniqueOrderReference": "435453454", "DateOfOrder": "2020/05/30", "OrderLineDetails": [{ "CustomerProductCode": "MJN0624", "QuantityOrdered": 1, "QuantityToShip": 1, "UnitPrice": 4 }] }

MAPPING:

NOTICE:

  • we receive 3-letter CountryCode and we need to pass 2-letter

  • we receive 3-letter LanguageCode and we need to pass 2-letter

  • UniqueOrderReference mapped from SourceAccountNumber

  • Date of order is passed in format YYYY/MM/DD

{ "Consignee": { "FirstName" --> "FirstName" "LastName" --> "LastName" "Addresses"[0]-"AddressLine1" --> "Address1" "Addresses"[0]-"AddressLine1" --> "Address2" "Addresses"[0]-"City" --> "City" "Addresses"[0]-"StateCode" --> "ProvinceCode" "Addresses"[0]-"PostalCode" --> "PostalCode" "Addresses"[0]-"CountryCode" --> "CountryCode" "Phones"[0]-"PhoneNumber" --> "Telephone" "Emails"[0]-"EmailAddress" --> "EMail" "LanguageCode" --> "LanguageCode" }, "SourceAccountNumber" -->."UniqueOrderReference" "ActivityDate" -->. "DateOfOrder" "OrderLineDetails":[{ hardcoded as variable, value: "MJN0624" --> "CustomerProductCode" hardcoded as variable, value: 1 --> "QuantityOrdered" hardcoded as variable, value: 1 --> "QuantityToShip" hardcoded as variable, value: 4 --> "UnitPrice" }] }

4. Send the request to the Positive FulFillment

Method: POST

PROD EndPoint: https://api.efulfillment.ca/V2/Order/Add

Headers:

  • “Content-Type” : application/json

  • “apiKey” : “ask @Jakub.Krysiak (Unlicensed) “ for the values

Body: According to point 3

API documentation: https://api.efulfillment.ca/Help/Api/POST-V2-Order-Add

5. Retry

In 1.0.0 there is no retry. Unsuccessful try will result in saving message to error collection in DB along with error message and timestamp. The collection is middlewarePositiveFulfillmentAdapter_Errors

In the next versions the below can be considered:

In the case of failure response, the request should be sent again (max 4 times)

Await time between requests should be set for: XXX seconds

In the case of 4 consecutive errors, the request should XXX