- We want to build a new web application that will allow us to create and store foreign exchange trades.
- The main view is the Ebury Trading application, which contains a Trade list view, displaying the list of already booked trades and the relevant fields
- Apex Class
- Apex Test Class
- Apex Mock Class
- Fixer API
- Lightning Web Component (LWC)
- Custom Labels
- Named Credentials
- Custom Settings
- After push the components of this project in Salesforce a Custom Setting named Ebury Custom Setting will be created. So, you need fill the fields below with the correct data for the code execute as expected:
- ApiKey: get your key in Fixer API site. My apiKey is C2NlwIvwyXnRC2smGYyGRc9kDlctJ82O
- Ebury Queue: TradeReviewers
- Template Email Notification: NewTrade
- Sell Currency and Buy Currency: initial value should be empty.
- App: retrieve latest rate for the selected currency pair and display it.
- Buy Amount: not be editable and be automatically calculated.
- Rate: not be editable.
- Buy Amount formula: Sell Amount x Rate.
- I created the New Trade View using LWC as imagem below provided in the test.
- I used the newTrade.js of the NewTrade LWC provided in the test.
- I added the fields to view and follow the requirements above:
- Notify all users in a queue named Trade Reviewers.
- Content of notification:
“A new trade has been created with the following data:
Sell Currency: {sell ccy}
Sell Amount: {sell amount}
Buy Currency: {buy ccy}
Buy Amount: {buy amount}
Rate: {rate}
Booked Date: {date}
Link to the trade: {trade link}"
- I created a Classic Email Template named New Trade and add the Template Content provided in the test.
- I created a Queue named Trade Reviewers
- I created a Custom Settings named Ebury Trading Settings to store the main app settings.
- Create a connection with a External Service(API) to get Latest Rate
- Use fixer.io(API) to get Latest Rate.
- Use the class NewTradeController provided in the test to make the connection to API Fixer.io
- I created add the link fixer.io to CSP Trusted Sites in Salesforce
- I created a Named Credentials named GetLatestExchangeRate to add the fixer.io endpoint that I use to make the callouts to get the latest rates.
- I added the ApiKey provided by fixer.io in the Ebury Trade Settings (Custom Setting)
- I created a standard class of response named ActionResponse
- I used the endpoint /latest of the API (returns real-time exchange rate data for all available or a specific set of currencies).
- Create a connection with a External Service(API) to get Latest Rate
- Use fixer.io(API) to get Latest Rate.
- Use the class NewTradeController provided in the test to make the connection to API Fixer.io
- I created a mock class named NewTradeControllerMock to simulate the callouts to fixer.io
- I created a test class named NewTradeControllerTest.
- I covered 100% of the classes used in this test.
- This application will be deployed using Salesforce CLI and Salesforce DX
- Update the build.sh script to create the scratch org if needed and leave it ready for testing.
- I worked with the SFDX and CLI developement to push, retrieve, run test and so on.
- I updated the buil.sh with the command needed to:
- create scratch org
- set the scratch org as default
- push the changes
- execute tests
Do you want to deploy a set of changes, or create a self-contained application? Choose a development model.
The sfdx-project.json
file contains useful configuration information for your project. See Salesforce DX Project Configuration in the Salesforce DX Developer Guide for details about this file.