diff --git a/Client/Transfers/index.ts b/Client/Transfers/index.ts index b8db8c55..c1c4cff2 100644 --- a/Client/Transfers/index.ts +++ b/Client/Transfers/index.ts @@ -65,4 +65,10 @@ export class Transfers extends List { else return await this.connection.get(`v2/${this.folder}/${transferId}/download`) } + async getFxQuote(request: model.FxQuoteRequest) { + return await this.connection.post(`v2/${this.folder}/fx/quote`, request) + } + async getFxQuoteById(id: string) { + return await this.connection.get(`v2/${this.folder}/fx/quote/${id}`) + } } diff --git a/index.ts b/index.ts index e8077935..1b6320a1 100644 --- a/index.ts +++ b/index.ts @@ -114,6 +114,8 @@ import { FundingLimitRequest, FundingLimitResponse, FutureTransactionPrognosisAmountPair, + FxQuoteRequest, + FxQuoteResponse, GenericPaymentOperation, HotelBookingInfoRequest, HotelBookingInfoResponse, @@ -375,6 +377,8 @@ export { FundingLimitRequest, FundingLimitResponse, FutureTransactionPrognosisAmountPair, + FxQuoteRequest, + FxQuoteResponse, GenericPaymentOperation, HotelBookingInfoRequest, HotelBookingInfoResponse, diff --git a/model/FxQuoteRequest.ts b/model/FxQuoteRequest.ts new file mode 100644 index 00000000..4ff6d42b --- /dev/null +++ b/model/FxQuoteRequest.ts @@ -0,0 +1,21 @@ +import * as isoly from "isoly" +import { isly } from "isly" + +export interface FxQuoteRequest { + from: isoly.Currency + to: isoly.Currency + amountSent?: number + amountReceived?: number + sourceAccount: string +} + +export namespace FxQuoteRequest { + export const type = isly.object({ + from: isly.fromIs("isoly.Currency", isoly.Currency.is), + to: isly.fromIs("isoly.Currency", isoly.Currency.is), + amountSent: isly.number().optional(), + amountReceived: isly.number().optional(), + sourceAccount: isly.string(), + }) + export const is = type.is +} diff --git a/model/FxQuoteResponse.ts b/model/FxQuoteResponse.ts new file mode 100644 index 00000000..77250167 --- /dev/null +++ b/model/FxQuoteResponse.ts @@ -0,0 +1,29 @@ +import * as isoly from "isoly" +import { isly } from "isly" + +export interface FxQuoteResponse { + quoteId: string + validUntil: isoly.DateTime + sourceAccount: string + from: isoly.Currency + to: isoly.Currency + amountSent: number + amountReceived: number + fee: number + fxRate: number +} + +export namespace FxQuoteResponse { + export const type = isly.object({ + quoteId: isly.string(), + validUntil: isly.fromIs("isoly.DateTime", isoly.DateTime.is), + sourceAccount: isly.string(), + from: isly.fromIs("isoly.Currency", isoly.Currency.is), + to: isly.fromIs("isoly.Currency", isoly.Currency.is), + amountSent: isly.number(), + amountReceived: isly.number(), + fee: isly.number(), + fxRate: isly.number(), + }) + export const is = type.is +} diff --git a/model/TransferRequest.ts b/model/TransferRequest.ts index 13fbbce7..d1f55d59 100644 --- a/model/TransferRequest.ts +++ b/model/TransferRequest.ts @@ -1,3 +1,4 @@ +import * as isoly from "isoly" import { MetadataRequest } from "./MetadataRequest" import { PaymentDeliveryRequest } from "./PaymentDeliveryRequest" import { ProviderCode } from "./ProviderCode" @@ -11,11 +12,13 @@ export interface TransferRequest { destinationProviderCode?: ProviderCode destinationProviderAccountId?: string amount: number - currency?: string + currency?: isoly.Currency + currencyReceived?: isoly.Currency reference?: string paymentDate?: string metadata?: MetadataRequest delivery?: PaymentDeliveryRequest batchId?: string verificationOfPayeeId?: string + fxQuoteId?: string } diff --git a/model/TransferResponseV2.spec.ts b/model/TransferResponseV2.spec.ts index afcaa033..765ccb0d 100644 --- a/model/TransferResponseV2.spec.ts +++ b/model/TransferResponseV2.spec.ts @@ -4,6 +4,7 @@ describe("TransferResponseV2 is", () => { const json = { providerCode: "modulr", providerTransferId: "P12005RMB0", + externalId: "EXT12345", amount: 1, currency: "GBP", status: "SETTLED", diff --git a/model/TransferResponseV2.ts b/model/TransferResponseV2.ts index 1a840a3d..172ba0e2 100644 --- a/model/TransferResponseV2.ts +++ b/model/TransferResponseV2.ts @@ -11,8 +11,11 @@ import { TransferStatus } from "./TransferStatus" export interface TransferResponseV2 { providerCode: ProviderCode providerTransferId: string + externalId: string amount: number + amountReceived?: number currency: Currency + currencyReceived?: Currency status: TransferStatus errorMessage?: string createdDate: Date @@ -32,8 +35,11 @@ export namespace TransferResponseV2 { export const type = isly.object({ providerCode: ProviderCode.type, providerTransferId: isly.string(), + externalId: isly.string(), amount: isly.number(), + amountReceived: isly.number().optional(), currency: isly.fromIs("Currency", Currency.is), + currencyReceived: isly.fromIs("Currency", Currency.is).optional(), status: TransferStatus.type, errorMessage: isly.string().optional(), createdDate: isly.fromIs("Date", Date.is), diff --git a/model/index.ts b/model/index.ts index 1bcfcb16..3fe52510 100644 --- a/model/index.ts +++ b/model/index.ts @@ -113,6 +113,8 @@ import { FundingAccountTransferDestinationResponse } from "./FundingAccountTrans import { FundingLimitRequest } from "./FundingLimitRequest" import { FundingLimitResponse } from "./FundingLimitResponse" import { FutureTransactionPrognosisAmountPair } from "./FutureTransactionPrognosisAmountPair" +import { FxQuoteRequest } from "./FxQuoteRequest" +import { FxQuoteResponse } from "./FxQuoteResponse" import { GenericPaymentOperation } from "./GenericPaymentOperation" import { HotelBookingInfoRequest } from "./HotelBookingInfoRequest" import { HotelBookingInfoResponse } from "./HotelBookingInfoResponse" @@ -375,6 +377,8 @@ export { FundingLimitRequest, FundingLimitResponse, FutureTransactionPrognosisAmountPair, + FxQuoteRequest, + FxQuoteResponse, GenericPaymentOperation, HotelBookingInfoRequest, HotelBookingInfoResponse,