[FEATURE]: [Bambora] Currency Unit Conversion
:memo: Feature Description
- Each currency can be described in terms of base or minor units.
- For instance, when dealing with USD currency, the Cent is considered as the minor unit, while the Dollar is considered the base unit.
- In Hyperswitch, the amount value is expected to be always provided in minor units.
- For example: In USD, If the amount is 1 in base unit (Dollar), then it will be equivalent to 100 in minor units (Cent)
- Some of the connectors integrated require the amount to be converted to a desirable unit before being passed to them.
- We have functions
to_currency_base_unitandto_currency_lower_unitin place to convert the minor unit amount to its decimal equivalent and vice versa. These conversions are handled explicitly based on the connector.
:hammer: Possible Implementation
- ConnectorCommon trait have been implemented for the connector.
- This trait contains
get_currency_unitmethod. This method needs to be implemented. - It will define what type of conversion needs to be done during
connector_router_datacreation. Concurrently handle the creation ofconnector_router_datato be passed for the connector request body creation. - You can check this PR for further reference https://github.com/juspay/hyperswitch/pull/2196
:bookmark: Note: All the changes needed should be contained within hyperswitch/crates/router/src/connector/
:package: Have you spent some time checking if this feature request has been raised before?
- [X] I checked and didn't find a similar issue
:package: Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
:sparkles: Are you willing to submit a PR?
😊 "I'd be delighted to work on this issue! Could you please assign it to me?"
Hey @TechWizard9999 , I see that you're already assigned to #2352. For now, we'll leave this issue open to any other interested contributors. You may pick this up once your work on #2352 is completed, and if no other contributors have expressed interest on this. I hope that's fine by you
Can I work on this one if @TechWizard9999 is not currently work on this?
Sure @speedhs , I have assigned this issue to you
Hey! Using the other prs as a reference I have made some changes to the code. Can you guide me as to how I can check if its working fine? Possibly by calling some API?
Hey @speedhs Create a payment via hyperswitch, and match the amount you are passing in your request with amount you are getting in connector response. Both should be same.
Hey @speedhs , Are you still working on this issue? Let us know if you need any help.