Closed neil-marcellini closed 8 months ago
Job added to Upwork: https://www.upwork.com/jobs/~01d3a854c49b843768
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External
)
Define Default P2P Rates in App
New Feature
We will define a new CONST in src/CONST.ts
file here, according to the json
CURRENCY_TO_DEFAULT_MILEAGE_RATE: {
"USD": { unit: "mile", rate: 0.5 },
"EUR": { unit: "kilometer", rate: 0.8 },
"GBP": { unit: "mile", rate: 0.45 },
// Add more currencies as needed
};
Define Default P2P Rates in App following this plan.
This is a new feature
Define Default P2P Rates Define a map of currency codes to default P2P rate objects, with unit and rate, in src/CONST.ts under a new key CURRENCY_TO_DEFAULT_MILEAGE_RATE Define the value as a JSON string and use JSON.parse to turn it into an object This will make it easy to copy and paste the JSON between the frontend and backend when it needs to be updated each year We’ll include the JSON to use in the GH issue created for this section
In here, we need to define a new CURRENCY_TO_DEFAULT_MILEAGE_RATE
as per the plan, this value must be a JSON string as per the requirement of copiability in the doc.
CURRENCY_TO_DEFAULT_MILEAGE_RATE: '{"EUR":{"unit":"kilometer","rate":1},"USD":{"unit":"mile","rate":2}}'
Further currency can be added similarly, also we can format the string nicely if we want to, for readability
CURRENCY_TO_DEFAULT_MILEAGE_RATE: `{
"EUR": {
"unit": "kilometer",
"rate": 1
},
"USD": {
"unit": "mile",
"rate": 2
}
}`
Instead of defining it as a JSON string, we can use JSON.parse
right in the definition to turn it into an object, this will make it easier to work with in other parts of the app while still maintaining the copiability requirement.
CURRENCY_TO_DEFAULT_MILEAGE_RATE: JSON.parse(`{
"EUR": {
"unit": "kilometer",
"rate": 1
},
"USD": {
"unit": "mile",
"rate": 2
}
}`),
Since JSON.parse
will result in an any
type by default, we should also define a type for CURRENCY_TO_DEFAULT_MILEAGE_RATE
and cast it there so we can use it safely in other places in the app.
Commenting to help with the review.
The proposal from @dukenv0307 looks good. The alternate solution is what I had in mind and prefer. Good idea to provide a type for it too. Assigning you now to get this moving. However keep in mind that we still need to research the best rates and generate the JSON on the backend. You can get started on a PR with dummy data.
📣 @abdulrahuman5196 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Ok @dukenv0307 I got the JSON generated, so I'm taking this off hold and please get the PR updated. I don't want to merge the App PR until the backend PR is merged, in case mistakes are found in the JSON, but I expect it's fine and it will be merged soon. Anyways, we can get it ready. I don't think we need a C+ review.
Bump @dukenv0307! The JSON is ready, waiting for the PR to be updated.
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.48-0 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-03-14. :confetti_ball:
For reference, here are some details about the assignees on this issue:
Issue is ready for payment but no BZ is assigned. @MitchExpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
Payment summary:
$500 @abdulrahuman5196 requires payment automatic offer (Reviewer) (Upwork) $500 @dukenv0307 requires payment automatic offer (Contributor) (Upwork)
Paid @dukenv0307
Offer sent to @abdulrahuman5196
Hi, @MitchExpensify I didn't review this PR. No payment for me here.
Offer withdrawn, thanks @abdulrahuman5196!
@abdulrahuman5196 do we need BZ steps here?
@MitchExpensify I doubt. Its still pending backend implementation I think
cc: @neil-marcellini
Define Default P2P Rates in App following this plan.
~I will include the JSON of the rates here when the backend issue is done.~ ✅
Here is the JSON mapping
```json { "AED": { "rate": 396, "unit": "km" }, "AFN": { "rate": 8369, "unit": "km" }, "ALL": { "rate": 11104, "unit": "km" }, "AMD": { "rate": 56842, "unit": "km" }, "ANG": { "rate": 193, "unit": "km" }, "AOA": { "rate": 67518, "unit": "km" }, "ARS": { "rate": 9873, "unit": "km" }, "AUD": { "rate": 85, "unit": "km" }, "AWG": { "rate": 195, "unit": "km" }, "AZN": { "rate": 183, "unit": "km" }, "BAM": { "rate": 177, "unit": "km" }, "BBD": { "rate": 216, "unit": "km" }, "BDT": { "rate": 9130, "unit": "km" }, "BGN": { "rate": 177, "unit": "km" }, "BHD": { "rate": 40, "unit": "km" }, "BIF": { "rate": 210824, "unit": "km" }, "BMD": { "rate": 108, "unit": "km" }, "BND": { "rate": 145, "unit": "km" }, "BOB": { "rate": 745, "unit": "km" }, "BRL": { "rate": 594, "unit": "km" }, "BSD": { "rate": 108, "unit": "km" }, "BTN": { "rate": 7796, "unit": "km" }, "BWP": { "rate": 1180, "unit": "km" }, "BYN": { "rate": 280, "unit": "km" }, "BYR": { "rate": 2159418, "unit": "km" }, "BZD": { "rate": 217, "unit": "km" }, "CAD": { "rate": 70, "unit": "km" }, "CDF": { "rate": 213674, "unit": "km" }, "CHF": { "rate": 100, "unit": "km" }, "CLP": { "rate": 77249, "unit": "km" }, "CNY": { "rate": 702, "unit": "km" }, "COP": { "rate": 383668, "unit": "km" }, "CRC": { "rate": 65899, "unit": "km" }, "CUC": { "rate": 108, "unit": "km" }, "CUP": { "rate": 2776, "unit": "km" }, "CVE": { "rate": 6112, "unit": "km" }, "CZK": { "rate": 2356, "unit": "km" }, "DJF": { "rate": 19151, "unit": "km" }, "DKK": { "rate": 673, "unit": "km" }, "DOP": { "rate": 6144, "unit": "km" }, "DZD": { "rate": 14375, "unit": "km" }, "EEK": { "rate": 1576, "unit": "km" }, "EGP": { "rate": 1696, "unit": "km" }, "ERN": { "rate": 1617, "unit": "km" }, "ETB": { "rate": 4382, "unit": "km" }, "EUR": { "rate": 3, "unit": "km" }, "FJD": { "rate": 220, "unit": "km" }, "FKP": { "rate": 77, "unit": "km" }, "GBP": { "rate": 45, "unit": "mi" }, "GEL": { "rate": 359, "unit": "km" }, "GHS": { "rate": 620, "unit": "km" }, "GIP": { "rate": 77, "unit": "km" }, "GMD": { "rate": 5526, "unit": "km" }, "GNF": { "rate": 1081319, "unit": "km" }, "GTQ": { "rate": 832, "unit": "km" }, "GYD": { "rate": 22537, "unit": "km" }, "HKD": { "rate": 837, "unit": "km" }, "HNL": { "rate": 2606, "unit": "km" }, "HRK": { "rate": 684, "unit": "km" }, "HTG": { "rate": 8563, "unit": "km" }, "HUF": { "rate": 33091, "unit": "km" }, "IDR": { "rate": 1555279, "unit": "km" }, "ILS": { "rate": 356, "unit": "km" }, "INR": { "rate": 7805, "unit": "km" }, "IQD": { "rate": 157394, "unit": "km" }, "IRR": { "rate": 4539961, "unit": "km" }, "ISK": { "rate": 13518, "unit": "km" }, "JMD": { "rate": 15794, "unit": "km" }, "JOD": { "rate": 77, "unit": "km" }, "JPY": { "rate": 11748, "unit": "km" }, "KES": { "rate": 11845, "unit": "km" }, "KGS": { "rate": 9144, "unit": "km" }, "KHR": { "rate": 437658, "unit": "km" }, "KMF": { "rate": 44418, "unit": "km" }, "KPW": { "rate": 97043, "unit": "km" }, "KRW": { "rate": 121345, "unit": "km" }, "KWD": { "rate": 32, "unit": "km" }, "KYD": { "rate": 90, "unit": "km" }, "KZT": { "rate": 45396, "unit": "km" }, "LAK": { "rate": 1010829, "unit": "km" }, "LBP": { "rate": 164153, "unit": "km" }, "LKR": { "rate": 21377, "unit": "km" }, "LRD": { "rate": 18709, "unit": "km" }, "LSL": { "rate": 1587, "unit": "km" }, "LTL": { "rate": 348, "unit": "km" }, "LVL": { "rate": 71, "unit": "km" }, "LYD": { "rate": 486, "unit": "km" }, "MAD": { "rate": 967, "unit": "km" }, "MDL": { "rate": 1910, "unit": "km" }, "MGA": { "rate": 406520, "unit": "km" }, "MKD": { "rate": 5570, "unit": "km" }, "MMK": { "rate": 152083, "unit": "km" }, "MNT": { "rate": 306788, "unit": "km" }, "MOP": { "rate": 863, "unit": "km" }, "MRO": { "rate": 38463, "unit": "km" }, "MRU": { "rate": 3862, "unit": "km" }, "MUR": { "rate": 4340, "unit": "km" }, "MVR": { "rate": 1667, "unit": "km" }, "MWK": { "rate": 84643, "unit": "km" }, "MXN": { "rate": 2219, "unit": "km" }, "MYR": { "rate": 444, "unit": "km" }, "MZN": { "rate": 7772, "unit": "km" }, "NAD": { "rate": 1587, "unit": "km" }, "NGN": { "rate": 42688, "unit": "km" }, "NIO": { "rate": 3772, "unit": "km" }, "NOK": { "rate": 917, "unit": "km" }, "NPR": { "rate": 12474, "unit": "km" }, "NZD": { "rate": 151, "unit": "km" }, "OMR": { "rate": 42, "unit": "km" }, "PAB": { "rate": 108, "unit": "km" }, "PEN": { "rate": 401, "unit": "km" }, "PGK": { "rate": 380, "unit": "km" }, "PHP": { "rate": 5234, "unit": "km" }, "PKR": { "rate": 16785, "unit": "km" }, "PLN": { "rate": 415, "unit": "km" }, "PYG": { "rate": 704732, "unit": "km" }, "QAR": { "rate": 393, "unit": "km" }, "RON": { "rate": 443, "unit": "km" }, "RSD": { "rate": 10630, "unit": "km" }, "RUB": { "rate": 8074, "unit": "km" }, "RWF": { "rate": 107182, "unit": "km" }, "SAR": { "rate": 404, "unit": "km" }, "SBD": { "rate": 859, "unit": "km" }, "SCR": { "rate": 2287, "unit": "km" }, "SDG": { "rate": 41029, "unit": "km" }, "SEK": { "rate": 917, "unit": "km" }, "SGD": { "rate": 145, "unit": "km" }, "SHP": { "rate": 77, "unit": "km" }, "SLL": { "rate": 1102723, "unit": "km" }, "SOS": { "rate": 62604, "unit": "km" }, "SRD": { "rate": 1526, "unit": "km" }, "STD": { "rate": 2223309, "unit": "km" }, "STN": { "rate": 2232, "unit": "km" }, "SVC": { "rate": 943, "unit": "km" }, "SYP": { "rate": 82077, "unit": "km" }, "SZL": { "rate": 1585, "unit": "km" }, "THB": { "rate": 3328, "unit": "km" }, "TJS": { "rate": 1230, "unit": "km" }, "TMT": { "rate": 378, "unit": "km" }, "TND": { "rate": 295, "unit": "km" }, "TOP": { "rate": 245, "unit": "km" }, "TRY": { "rate": 845, "unit": "km" }, "TTD": { "rate": 732, "unit": "km" }, "TWD": { "rate": 3055, "unit": "km" }, "TZS": { "rate": 250116, "unit": "km" }, "UAH": { "rate": 2985, "unit": "km" }, "UGX": { "rate": 395255, "unit": "km" }, "USD": { "rate": 67, "unit": "mi" }, "UYU": { "rate": 4777, "unit": "km" }, "UZS": { "rate": 1131331, "unit": "km" }, "VEB": { "rate": 679346, "unit": "km" }, "VEF": { "rate": 26793449, "unit": "km" }, "VES": { "rate": 194381905, "unit": "km" }, "VND": { "rate": 2487242, "unit": "km" }, "VUV": { "rate": 11748, "unit": "km" }, "WST": { "rate": 272, "unit": "km" }, "XAF": { "rate": 59224, "unit": "km" }, "XCD": { "rate": 291, "unit": "km" }, "XOF": { "rate": 59224, "unit": "km" }, "XPF": { "rate": 10783, "unit": "km" }, "YER": { "rate": 27037, "unit": "km" }, "ZAR": { "rate": 1588, "unit": "km" }, "ZMK": { "rate": 566489, "unit": "km" }, "ZMW": { "rate": 2377, "unit": "km" } } ```Upwork Automation - Do Not Edit