5

[FEATURE]: [Worldline] Currency Unit Conversion · Issue #2249 · juspay/hyperswit...

 11 months ago
source link: https://github.com/juspay/hyperswitch/issues/2249
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

📝 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_unit and to_currency_lower_unit in place to convert the minor unit amount to its decimal equivalent and vice versa. These conversions are handled explicitly based on the connector.

🔨 Possible Implementation

  • ConnectorCommon trait have been implemented for the connector.
  • This trait contains get_currency_unit method. This method needs to be implemented.
  • It will define what type of conversion needs to be done during connector_router_data creation. Concurrently handle the creation of connector_router_data to be passed for the connector request body creation.
  • You can check this PR for further reference refactor(connector): [Zen] Enhance currency Mapping with ConnectorCurrencyCommon Trait #2196

🔖 Note: All the changes needed should be contained within hyperswitch/crates/router/src/connector/

📦 Have you spent some time checking if this feature request has been raised before?

  • I checked and didn't find a similar issue

📦 Have you read the Contributing Guidelines?

✨ Are you willing to submit a PR?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK