moraki-finance / revolut-connect

Revolut non-official API connector
MIT License
0 stars 3 forks source link

[Business Api] add ForeignExchange resource #27

Closed leobz closed 3 months ago

leobz commented 3 months ago

Description

Related Issue: https://github.com/moraki-finance/revolut-connect/issues/26

Add the ForeignExchange resource, to retrieve information on exchange rates between currencies and exchange currencies.

Implementation

Revolut::ForeignExchange.rate(
  from: "EUR",
  to: "USD",
  amount: 100
)

Revolut::ForeignExchange.exchange(
  request_id: "49c6a48b-6b58-40a0-b974-0b8c4888c8a7", # The ID of the request, provided by you. It helps you identify the transaction in your system.
  from: {
    account_id: "8fe12333-5b27-4ad5-896c-38a25673fcc8",
    currency: "USD"
  },
  to: {
    account_id: "b4a3bcd2-c1dd-47cc-ac50-40cdb5856d42",
    currency: "GBP",
    amount: 10
  },
 reference: "exchange"
)

Screenshots

Revolut::ForeignExchange.exchange() call: Screenshot from 2024-07-25 19-18-22

Revolut::ForeignExchange.rate() call: Screenshot from 2024-07-25 19-19-22

Testing check: image

Checks

mochetts commented 3 months ago

Nice! Thank you! There's only one lint failing.