When you receive transactions from your partner, you may need to route them to several of your internal backend systems.
Orderful sends the transactions you receive to one communication channel. You can then leverage Orderful APIs to implement the routing you need in your connector.
In this article, we'll present use cases and solutions you can implement in your connector. Our solutions rely on the following prerequisites:
- You receive transactions through a HTTP or Poller communication channels.
- The data format you trade is JSON, meaning you receive transactions in JSON.
- You built a connector that processes transactions you receive through your communication channel before sending them to your ERP or SOR.
Use case 1: You receive a transaction from your partner that you want to send as JSON to one of your ERP/SOR and as X12 to another ERP/SOR
Here are the process you can use to configure this routing on your connector:
Step 1A: Retrieve the transaction ID
From the JSON transaction you polled or received to your HTTP communication channel, retrieve the transaction ID from the property `id`.
Step 1B: Retrieve the transaction in JSON
From the JSON transaction you polled or received to your HTTP communication channel, retrieve the transaction in JSON from the property `message`.
Step 2: Get the transaction using Orderful APIs
To get the transaction, use the Orderful API:
GET https://api.orderful.com/v3/transactions/transactionId.
Note: The path variable `transactionId` is the transaction ID you retrieved from step 1A.
Step 3: Retrieve the resource link to the Original X12 attachment
Retrieve the resource link of the attachment that contains the original X12 file hat was sent by your partner, from the HTTP Response you get from step 2.
The resource link can be found in the property `attachments[].url` when the property `attachments[].description` is equal to "Original X12".
{
"id": "<transactionId>",
"sender": { ...
},
"receiver": { ...
},
"type": { ...
},
"stream": "<stream>",
"state": { ...
},
"metadata": { ...
},
"revisions": {...
},
"workflow": { ...
},
"attachments": [
{
"description": "Original X12",
"url": "https://api.orderful.com/v3/attachments/<attachmentId>"
}
],
"lastUpdatedAt": "<lastUpdatedAt>",
"createdAt": "<createdAt>"
}
Step 4: Get the content of the Original X12 attachment
To get the Original X12 attachment, use the Orderful API:
GET https://api.orderful.com/v3/attachments/attachmentId/content
Note: The endpoint you're using can be build by adding the path `/content` to the resource link you retrieved from step 3.
Step 5: Send your JSON and X12 transactions to you ERPs
Send the JSON transaction from step 1B to your 1st ERP.
Send the X12 transaction from step 4 to your 2nd ERP.
Note: If you need to format or process the JSON or X12 transaction before sending it to your ERP, you can implement this custom logic in your connector.
Use case 2: You receive a transaction from your partner that you want to send as JSON to one of your two ERPs based on the content of the transaction
Step 1: Retrieve the transaction in JSON
From the JSON transaction you polled or received to your HTTP communication channel, retrieve the transaction in JSON from the property `message`.
Step 2: Find the transaction values that defines the routing conditions
From the JSON transaction message you retrieved in step 1, find all the important values of the transaction that builds your routing logic.
Step 3: Run your routing conditions to identify which ERP should receive the transaction
Your routing conditions are custom to your business logic. They can be very simple or complex.
At the end of this step, you should know if your transaction which ERP(s) should be receiving this transaction.
Step 4: Send your JSON and X12 transactions to your ERPs
Send the JSON transaction to the appropriate ERP(s).
Note: If you need to format or process the JSON transaction before sending it to your ERP, you can implement this custom logic in your connector.