Working with incomplete data on a new software project costs companies time and money. Data integration projects involve data sources that can be difficult to access and use. Some of them require domain knowledge to even make sense out of their responses. Others fall short of delivering all the necessary information.
Use Xapix to enrich incomplete customer payments data using a map unit. Normalize a collection of international payment records to have a consistent currency using a transformation formula.
On your onboarding exercise project’s home screen
click on the endpoint
select Edit Pipeline to get to your customer payments pipeline dashboard.
Click Add Unit on the upper left corner. In the overlay dialogue, add the Connector unit named "exchangeratesapi.io latest" to the pipeline.
Then, add a second Connector unit called "Internal Customer Payments DB" to the pipeline in the same way.
Back on the pipeline dashboard, connect both connector units to the Request unit.
Click Add Unit again and this time add a Map unit to the pipeline
Using drag and drop, connect both your connectors to the Map unit and connect the Map unit to the endpoint.
Now, click on the Map unit and
drag and drop the "body" attribute object into the Input collection field of the Map unit, so that the field "item" shows a data sample.
Unfold the "params" object by clicking on it
Drag and drop the "rates" object from exchangeratesapi.io connector’s body into a new "params" property.
Next, click on Inspect Sub Pipeline to create the map units transformations.
The sub pipeline dashboard has all the features as the regular pipeline dashboard, allowing for complex data flows. For this exercise;
Connect the Entry unit with the Result unit.
Click on the Result unit and drag and drop over all four input attributes into new result properties.
Add another property called "amount_eur” of type literal and click “Set formula”.
In the formula editor add the item’s attribute “amount”, by typing or clicking, and type a slash for division.
Next, add the attribute “rate” from your params and type a square bracket for accessing a field inside the rates object.
Inside the brackets, add the item’s “currency” attribute to dynamically access the respective currency value.
Click on the Endpoint unit and drag and drop the Map unit’s “result” attribute over into a new property.
Use the Publish button to deploy your project.
Test whether the response matches your expectations by copying the cURL command in the bottom right corner into a new terminal window on your computer.