Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Client/Transfers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ export class Transfers extends List<model.TransferResponseV2> {
else
return await this.connection.get<model.DownloadableResponse>(`v2/${this.folder}/${transferId}/download`)
}
async getFxQuote(request: model.FxQuoteRequest) {
return await this.connection.post<model.FxQuoteResponse>(`v2/${this.folder}/fx/quote`, request)
}
async getFxQuoteById(id: string) {
return await this.connection.get<model.FxQuoteResponse>(`v2/${this.folder}/fx/quote/${id}`)
}
}
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ import {
FundingLimitRequest,
FundingLimitResponse,
FutureTransactionPrognosisAmountPair,
FxQuoteRequest,
FxQuoteResponse,
GenericPaymentOperation,
HotelBookingInfoRequest,
HotelBookingInfoResponse,
Expand Down Expand Up @@ -375,6 +377,8 @@ export {
FundingLimitRequest,
FundingLimitResponse,
FutureTransactionPrognosisAmountPair,
FxQuoteRequest,
FxQuoteResponse,
GenericPaymentOperation,
HotelBookingInfoRequest,
HotelBookingInfoResponse,
Expand Down
21 changes: 21 additions & 0 deletions model/FxQuoteRequest.ts
Original file line number Diff line number Diff line change
@@ -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<FxQuoteRequest>({
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
}
29 changes: 29 additions & 0 deletions model/FxQuoteResponse.ts
Original file line number Diff line number Diff line change
@@ -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<FxQuoteResponse>({
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
}
5 changes: 4 additions & 1 deletion model/TransferRequest.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as isoly from "isoly"
import { MetadataRequest } from "./MetadataRequest"
import { PaymentDeliveryRequest } from "./PaymentDeliveryRequest"
import { ProviderCode } from "./ProviderCode"
Expand All @@ -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
}
1 change: 1 addition & 0 deletions model/TransferResponseV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe("TransferResponseV2 is", () => {
const json = {
providerCode: "modulr",
providerTransferId: "P12005RMB0",
externalId: "EXT12345",
amount: 1,
currency: "GBP",
status: "SETTLED",
Expand Down
6 changes: 6 additions & 0 deletions model/TransferResponseV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,8 +35,11 @@ export namespace TransferResponseV2 {
export const type = isly.object<TransferResponseV2>({
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),
Expand Down
4 changes: 4 additions & 0 deletions model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -375,6 +377,8 @@ export {
FundingLimitRequest,
FundingLimitResponse,
FutureTransactionPrognosisAmountPair,
FxQuoteRequest,
FxQuoteResponse,
GenericPaymentOperation,
HotelBookingInfoRequest,
HotelBookingInfoResponse,
Expand Down