diff --git a/.github/workflows/stainless-action.yml b/.github/workflows/stainless-action.yml index 0de4a72..895b84b 100644 --- a/.github/workflows/stainless-action.yml +++ b/.github/workflows/stainless-action.yml @@ -37,6 +37,7 @@ jobs: org: ${{ env.STAINLESS_ORG }} project: ${{ env.STAINLESS_PROJECT }} oas_path: ${{ env.OAS_PATH }} + guess_config: true merge: if: github.event.action == 'closed' && github.event.pull_request.merged == true diff --git a/mintlify/openapi.yaml b/mintlify/openapi.yaml index 5a660fe..aa65c8b 100644 --- a/mintlify/openapi.yaml +++ b/mintlify/openapi.yaml @@ -38,6 +38,8 @@ tags: description: Endpoints to trigger test cases in sandbox - name: API Tokens description: Endpoints to programmatically manage API tokens + - name: Exchange Rates + description: Endpoints for retrieving cached foreign exchange rates. Rates are cached for approximately 5 minutes and include platform-specific fees. paths: /config: get: @@ -140,6 +142,126 @@ paths: application/json: schema: $ref: '#/components/schemas/Error501' + /exchange-rates: + get: + summary: Get exchange rates + description: | + Retrieve cached exchange rates for currency corridors. Returns FX rates that are cached + for approximately 5 minutes. Rates include fees specific to your platform for authenticated requests. + + **Filtering Options:** + - Filter by source currency to get all available destination corridors + - Filter by specific destination currency or currencies + - Provide a sending amount to get calculated receiving amounts + operationId: getExchangeRates + tags: + - Exchange Rates + security: + - BasicAuth: [] + parameters: + - name: sourceCurrency + in: query + description: Filter by source currency code (e.g., USD) + required: false + schema: + type: string + example: USD + - name: destinationCurrency + in: query + description: Filter by destination currency code(s). Can be repeated for multiple currencies (e.g., &destinationCurrency=INR&destinationCurrency=GBP) + required: false + style: form + explode: true + schema: + type: array + items: + type: string + example: + - INR + - name: sendingAmount + in: query + description: Sending amount in the smallest unit of the source currency (e.g., cents for USD). If no amount is provided, the default is 10000 in the sending currency smallest unit. + required: false + schema: + type: integer + format: int64 + minimum: 0 + default: 10000 + example: 10000 + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + description: List of exchange rates matching the filter criteria + items: + $ref: '#/components/schemas/ExchangeRate' + examples: + allRatesFromUSD: + summary: All exchange rates from USD + value: + data: + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: $ + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: INR + decimals: 2 + name: Indian Rupee + symbol: ₹ + destinationPaymentRail: UPI + receivingAmount: 1650000 + exchangeRate: 82.5 + fees: + fixed: 100 + updatedAt: '2025-02-05T12:00:00Z' + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: $ + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: EUR + decimals: 2 + name: Euro + symbol: € + destinationPaymentRail: SEPA_INSTANT + receivingAmount: 18500 + exchangeRate: 0.925 + fees: + fixed: 10 + updatedAt: '2025-02-05T12:00:00Z' + '400': + description: Bad request - Invalid parameters + content: + application/json: + schema: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error401' + '500': + description: Internal service error + content: + application/json: + schema: + $ref: '#/components/schemas/Error500' /customers: post: summary: Add a new customer @@ -4113,6 +4235,84 @@ components: type: object description: Additional error details additionalProperties: true + Currency: + type: object + properties: + code: + type: string + description: Three-letter currency code (ISO 4217) for fiat currencies. Some cryptocurrencies may use their own ticker symbols (e.g. "BTC" for Bitcoin, "USDC" for USDC, etc.) + example: USD + name: + type: string + description: Full name of the currency + example: United States Dollar + symbol: + type: string + description: Symbol of the currency + example: $ + decimals: + type: integer + description: Number of decimal places for the currency + minimum: 0 + example: 2 + ExchangeRateFees: + type: object + description: Fees associated with an exchange rate + properties: + fixed: + type: integer + format: int64 + description: Fixed fee in the smallest unit of the sending currency (e.g., cents for USD) + minimum: 0 + example: 100 + ExchangeRate: + type: object + description: Exchange rate information for a currency corridor + required: + - sourceCurrency + - destinationCurrency + - destinationPaymentRail + - receivingAmount + - exchangeRate + - fees + - updatedAt + properties: + sourceCurrency: + $ref: '#/components/schemas/Currency' + sourcePaymentRail: + type: string + description: The payment rail used for the source (e.g., ACCOUNT, RTP) + example: ACCOUNT + sendingAmount: + type: integer + format: int64 + description: The sending amount in the smallest unit of the source currency (e.g., cents for USD). Echoed back from the request if provided. + minimum: 0 + example: 10000 + destinationCurrency: + $ref: '#/components/schemas/Currency' + destinationPaymentRail: + type: string + description: The payment rail used for the destination (e.g., UPI, SEPA_INSTANT, MOBILE_MONEY, FASTER_PAYMENTS) + example: UPI + receivingAmount: + type: integer + format: int64 + description: The receiving amount in the smallest unit of the destination currency + minimum: 0 + example: 1650000 + exchangeRate: + type: number + description: Number of destination currency units per sending currency unit + exclusiveMinimum: 0 + example: 82.5 + fees: + $ref: '#/components/schemas/ExchangeRateFees' + updatedAt: + type: string + format: date-time + description: Timestamp when this exchange rate was last refreshed + example: '2025-02-05T12:00:00Z' CustomerType: type: string enum: @@ -4277,9 +4477,7 @@ components: - customerType properties: customerType: - type: string - enum: - - BUSINESS + $ref: '#/components/schemas/CustomerType' address: $ref: '#/components/schemas/Address' businessInfo: @@ -4332,9 +4530,7 @@ components: - customerType properties: customerType: - type: string - enum: - - INDIVIDUAL + $ref: '#/components/schemas/CustomerType' fullName: type: string description: Individual's full name @@ -4537,26 +4733,6 @@ components: mapping: INDIVIDUAL: '#/components/schemas/IndividualCustomerUpdateRequest' BUSINESS: '#/components/schemas/BusinessCustomerUpdateRequest' - Currency: - type: object - properties: - code: - type: string - description: Three-letter currency code (ISO 4217) for fiat currencies. Some cryptocurrencies may use their own ticker symbols (e.g. "BTC" for Bitcoin, "USDC" for USDC, etc.) - example: USD - name: - type: string - description: Full name of the currency - example: United States Dollar - symbol: - type: string - description: Symbol of the currency - example: $ - decimals: - type: integer - description: Number of decimal places for the currency - minimum: 0 - example: 2 CurrencyAmount: type: object required: diff --git a/openapi.yaml b/openapi.yaml index 5a660fe..aa65c8b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -38,6 +38,8 @@ tags: description: Endpoints to trigger test cases in sandbox - name: API Tokens description: Endpoints to programmatically manage API tokens + - name: Exchange Rates + description: Endpoints for retrieving cached foreign exchange rates. Rates are cached for approximately 5 minutes and include platform-specific fees. paths: /config: get: @@ -140,6 +142,126 @@ paths: application/json: schema: $ref: '#/components/schemas/Error501' + /exchange-rates: + get: + summary: Get exchange rates + description: | + Retrieve cached exchange rates for currency corridors. Returns FX rates that are cached + for approximately 5 minutes. Rates include fees specific to your platform for authenticated requests. + + **Filtering Options:** + - Filter by source currency to get all available destination corridors + - Filter by specific destination currency or currencies + - Provide a sending amount to get calculated receiving amounts + operationId: getExchangeRates + tags: + - Exchange Rates + security: + - BasicAuth: [] + parameters: + - name: sourceCurrency + in: query + description: Filter by source currency code (e.g., USD) + required: false + schema: + type: string + example: USD + - name: destinationCurrency + in: query + description: Filter by destination currency code(s). Can be repeated for multiple currencies (e.g., &destinationCurrency=INR&destinationCurrency=GBP) + required: false + style: form + explode: true + schema: + type: array + items: + type: string + example: + - INR + - name: sendingAmount + in: query + description: Sending amount in the smallest unit of the source currency (e.g., cents for USD). If no amount is provided, the default is 10000 in the sending currency smallest unit. + required: false + schema: + type: integer + format: int64 + minimum: 0 + default: 10000 + example: 10000 + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + description: List of exchange rates matching the filter criteria + items: + $ref: '#/components/schemas/ExchangeRate' + examples: + allRatesFromUSD: + summary: All exchange rates from USD + value: + data: + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: $ + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: INR + decimals: 2 + name: Indian Rupee + symbol: ₹ + destinationPaymentRail: UPI + receivingAmount: 1650000 + exchangeRate: 82.5 + fees: + fixed: 100 + updatedAt: '2025-02-05T12:00:00Z' + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: $ + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: EUR + decimals: 2 + name: Euro + symbol: € + destinationPaymentRail: SEPA_INSTANT + receivingAmount: 18500 + exchangeRate: 0.925 + fees: + fixed: 10 + updatedAt: '2025-02-05T12:00:00Z' + '400': + description: Bad request - Invalid parameters + content: + application/json: + schema: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error401' + '500': + description: Internal service error + content: + application/json: + schema: + $ref: '#/components/schemas/Error500' /customers: post: summary: Add a new customer @@ -4113,6 +4235,84 @@ components: type: object description: Additional error details additionalProperties: true + Currency: + type: object + properties: + code: + type: string + description: Three-letter currency code (ISO 4217) for fiat currencies. Some cryptocurrencies may use their own ticker symbols (e.g. "BTC" for Bitcoin, "USDC" for USDC, etc.) + example: USD + name: + type: string + description: Full name of the currency + example: United States Dollar + symbol: + type: string + description: Symbol of the currency + example: $ + decimals: + type: integer + description: Number of decimal places for the currency + minimum: 0 + example: 2 + ExchangeRateFees: + type: object + description: Fees associated with an exchange rate + properties: + fixed: + type: integer + format: int64 + description: Fixed fee in the smallest unit of the sending currency (e.g., cents for USD) + minimum: 0 + example: 100 + ExchangeRate: + type: object + description: Exchange rate information for a currency corridor + required: + - sourceCurrency + - destinationCurrency + - destinationPaymentRail + - receivingAmount + - exchangeRate + - fees + - updatedAt + properties: + sourceCurrency: + $ref: '#/components/schemas/Currency' + sourcePaymentRail: + type: string + description: The payment rail used for the source (e.g., ACCOUNT, RTP) + example: ACCOUNT + sendingAmount: + type: integer + format: int64 + description: The sending amount in the smallest unit of the source currency (e.g., cents for USD). Echoed back from the request if provided. + minimum: 0 + example: 10000 + destinationCurrency: + $ref: '#/components/schemas/Currency' + destinationPaymentRail: + type: string + description: The payment rail used for the destination (e.g., UPI, SEPA_INSTANT, MOBILE_MONEY, FASTER_PAYMENTS) + example: UPI + receivingAmount: + type: integer + format: int64 + description: The receiving amount in the smallest unit of the destination currency + minimum: 0 + example: 1650000 + exchangeRate: + type: number + description: Number of destination currency units per sending currency unit + exclusiveMinimum: 0 + example: 82.5 + fees: + $ref: '#/components/schemas/ExchangeRateFees' + updatedAt: + type: string + format: date-time + description: Timestamp when this exchange rate was last refreshed + example: '2025-02-05T12:00:00Z' CustomerType: type: string enum: @@ -4277,9 +4477,7 @@ components: - customerType properties: customerType: - type: string - enum: - - BUSINESS + $ref: '#/components/schemas/CustomerType' address: $ref: '#/components/schemas/Address' businessInfo: @@ -4332,9 +4530,7 @@ components: - customerType properties: customerType: - type: string - enum: - - INDIVIDUAL + $ref: '#/components/schemas/CustomerType' fullName: type: string description: Individual's full name @@ -4537,26 +4733,6 @@ components: mapping: INDIVIDUAL: '#/components/schemas/IndividualCustomerUpdateRequest' BUSINESS: '#/components/schemas/BusinessCustomerUpdateRequest' - Currency: - type: object - properties: - code: - type: string - description: Three-letter currency code (ISO 4217) for fiat currencies. Some cryptocurrencies may use their own ticker symbols (e.g. "BTC" for Bitcoin, "USDC" for USDC, etc.) - example: USD - name: - type: string - description: Full name of the currency - example: United States Dollar - symbol: - type: string - description: Symbol of the currency - example: $ - decimals: - type: integer - description: Number of decimal places for the currency - minimum: 0 - example: 2 CurrencyAmount: type: object required: diff --git a/openapi/components/schemas/customers/BusinessCustomerFields.yaml b/openapi/components/schemas/customers/BusinessCustomerFields.yaml index 998bf83..093bdd8 100644 --- a/openapi/components/schemas/customers/BusinessCustomerFields.yaml +++ b/openapi/components/schemas/customers/BusinessCustomerFields.yaml @@ -3,9 +3,7 @@ required: - customerType properties: customerType: - type: string - enum: - - BUSINESS + $ref: ./CustomerType.yaml address: $ref: ../common/Address.yaml businessInfo: diff --git a/openapi/components/schemas/customers/IndividualCustomerFields.yaml b/openapi/components/schemas/customers/IndividualCustomerFields.yaml index 95616fe..aff1fa2 100644 --- a/openapi/components/schemas/customers/IndividualCustomerFields.yaml +++ b/openapi/components/schemas/customers/IndividualCustomerFields.yaml @@ -3,9 +3,7 @@ required: - customerType properties: customerType: - type: string - enum: - - INDIVIDUAL + $ref: ./CustomerType.yaml fullName: type: string description: Individual's full name diff --git a/openapi/components/schemas/exchange_rates/ExchangeRate.yaml b/openapi/components/schemas/exchange_rates/ExchangeRate.yaml new file mode 100644 index 0000000..1f20276 --- /dev/null +++ b/openapi/components/schemas/exchange_rates/ExchangeRate.yaml @@ -0,0 +1,47 @@ +type: object +description: Exchange rate information for a currency corridor +required: + - sourceCurrency + - destinationCurrency + - destinationPaymentRail + - receivingAmount + - exchangeRate + - fees + - updatedAt +properties: + sourceCurrency: + $ref: ../common/Currency.yaml + sourcePaymentRail: + type: string + description: The payment rail used for the source (e.g., ACCOUNT, RTP) + example: ACCOUNT + sendingAmount: + type: integer + format: int64 + description: The sending amount in the smallest unit of the source currency (e.g., cents for USD). Echoed back from the request if provided. + minimum: 0 + example: 10000 + destinationCurrency: + $ref: ../common/Currency.yaml + destinationPaymentRail: + type: string + description: The payment rail used for the destination (e.g., UPI, SEPA_INSTANT, MOBILE_MONEY, FASTER_PAYMENTS) + example: UPI + receivingAmount: + type: integer + format: int64 + description: The receiving amount in the smallest unit of the destination currency + minimum: 0 + example: 1650000 + exchangeRate: + type: number + description: Number of destination currency units per sending currency unit + exclusiveMinimum: 0 + example: 82.50 + fees: + $ref: ./ExchangeRateFees.yaml + updatedAt: + type: string + format: date-time + description: Timestamp when this exchange rate was last refreshed + example: "2025-02-05T12:00:00Z" diff --git a/openapi/components/schemas/exchange_rates/ExchangeRateFees.yaml b/openapi/components/schemas/exchange_rates/ExchangeRateFees.yaml new file mode 100644 index 0000000..3c58d7c --- /dev/null +++ b/openapi/components/schemas/exchange_rates/ExchangeRateFees.yaml @@ -0,0 +1,9 @@ +type: object +description: Fees associated with an exchange rate +properties: + fixed: + type: integer + format: int64 + description: Fixed fee in the smallest unit of the sending currency (e.g., cents for USD) + minimum: 0 + example: 100 diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 822bbce..45d66a1 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -35,6 +35,10 @@ tags: description: Endpoints to trigger test cases in sandbox - name: API Tokens description: Endpoints to programmatically manage API tokens + - name: Exchange Rates + description: >- + Endpoints for retrieving cached foreign exchange rates. Rates are cached + for approximately 5 minutes and include platform-specific fees. servers: - url: https://api.lightspark.com/grid/2025-10-13 description: Production server @@ -84,6 +88,8 @@ components: paths: /config: $ref: paths/platform/config.yaml + /exchange-rates: + $ref: paths/exchange-rates/exchange_rates.yaml /customers: $ref: paths/customers/customers.yaml /customers/{customerId}: diff --git a/openapi/paths/exchange-rates/exchange_rates.yaml b/openapi/paths/exchange-rates/exchange_rates.yaml new file mode 100644 index 0000000..8fdb97f --- /dev/null +++ b/openapi/paths/exchange-rates/exchange_rates.yaml @@ -0,0 +1,122 @@ +get: + summary: Get exchange rates + description: | + Retrieve cached exchange rates for currency corridors. Returns FX rates that are cached + for approximately 5 minutes. Rates include fees specific to your platform for authenticated requests. + + **Filtering Options:** + - Filter by source currency to get all available destination corridors + - Filter by specific destination currency or currencies + - Provide a sending amount to get calculated receiving amounts + + operationId: getExchangeRates + tags: + - Exchange Rates + security: + - BasicAuth: [] + parameters: + - name: sourceCurrency + in: query + description: Filter by source currency code (e.g., USD) + required: false + schema: + type: string + example: USD + - name: destinationCurrency + in: query + description: >- + Filter by destination currency code(s). Can be repeated for multiple currencies + (e.g., &destinationCurrency=INR&destinationCurrency=GBP) + required: false + style: form + explode: true + schema: + type: array + items: + type: string + example: + - INR + - name: sendingAmount + in: query + description: Sending amount in the smallest unit of the source currency (e.g., cents for USD). If no amount is provided, the default is 10000 in the sending currency smallest unit. + required: false + schema: + type: integer + format: int64 + minimum: 0 + default: 10000 + example: 10000 + responses: + "200": + description: Successful operation + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + description: List of exchange rates matching the filter criteria + items: + $ref: ../../components/schemas/exchange_rates/ExchangeRate.yaml + examples: + allRatesFromUSD: + summary: All exchange rates from USD + value: + data: + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: "$" + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: INR + decimals: 2 + name: Indian Rupee + symbol: "₹" + destinationPaymentRail: UPI + receivingAmount: 1650000 + exchangeRate: 82.50 + fees: + fixed: 100 + updatedAt: "2025-02-05T12:00:00Z" + - sourceCurrency: + code: USD + decimals: 2 + name: US Dollar + symbol: "$" + sourcePaymentRail: RTP + sendingAmount: 10000 + destinationCurrency: + code: EUR + decimals: 2 + name: Euro + symbol: "€" + destinationPaymentRail: SEPA_INSTANT + receivingAmount: 18500 + exchangeRate: 0.925 + fees: + fixed: 10 + updatedAt: "2025-02-05T12:00:00Z" + "400": + description: Bad request - Invalid parameters + content: + application/json: + schema: + $ref: ../../components/schemas/errors/Error400.yaml + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: ../../components/schemas/errors/Error401.yaml + "500": + description: Internal service error + content: + application/json: + schema: + $ref: ../../components/schemas/errors/Error500.yaml