Skip to content
Open
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
8 changes: 0 additions & 8 deletions .api-sync/unmodeled.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,14 +803,6 @@
"reason": "Already tracked in .api-sync/contract-check-allowlist.json (superseded by billing_fee_amount); mirrored here for the same reason as the partner-fee entries above.",
"owner": "eric@blindpay.com"
},
{
"kind": "enum",
"schema": "PayinOut",
"enumProperty": "currency",
"reason": "Spec's fiat currency enum added EUR; this SDK's Currency union (which also carries the 3 crypto settlement tokens as a deliberate broader union) is missing it.",
"owner": "eric@blindpay.com",
"member": "EUR"
},
{
"kind": "property",
"schema": "PayinOut",
Expand Down
5 changes: 5 additions & 0 deletions .changeset/calm-euros-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blindpay/node": minor
---

Add EUR support to the shared currency type and payout and payin FX inputs.
2 changes: 1 addition & 1 deletion src/resources/payins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export type Payin = {
total_fee_amount?: number | null;
commercial_quotation: number;
blindpay_quotation: number;
currency: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS">;
currency: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS" | "EUR">;
billing_fee?: number | null;
billing_fee_amount?: number | null;
is_otc?: boolean | null;
Expand Down
22 changes: 22 additions & 0 deletions src/resources/payins/payins-quotes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,27 @@ describe("Payin quotes", () => {
expect(error).toBeNull();
expect(data).toEqual(mockedFxRate);
});

it("should request a EUR to USDC FX rate", async () => {
fetchMock.mockResponseOnce(
JSON.stringify({
commercial_quotation: 1.18,
blindpay_quotation: 1.17,
result_amount: 1170,
instance_flat_fee: 50,
instance_percentage_fee: 0,
}),
{ headers: { "Content-Type": "application/json" } }
);

const { error } = await blindpay.payins.quotes.getFxRate({
currency_type: "sender",
from: "EUR",
to: "USDC",
request_amount: 1000,
});

expect(error).toBeNull();
});
});
});
7 changes: 7 additions & 0 deletions src/resources/payins/payins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ import type {
GetPayinResponse,
GetPayinTrackResponse,
ListPayinsResponse,
Payin,
} from ".";

describe("Payins", () => {
afterEach(() => fetchMock.resetMocks());

const blindpay = new BlindPay({ apiKey: "test-key", instanceId: "in_000000000000" });

it("should type EUR payin responses", () => {
const currency: Payin["currency"] = "EUR";

expect(currency).toBe("EUR");
});

describe("List payins", () => {
it("should list payins", async () => {
const mockedPayins: ListPayinsResponse = {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/payins/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type CreatePayinQuoteResponse = {

export type GetPayinFxRateInput = {
currency_type: CurrencyType;
from: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS">;
from: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS" | "EUR">;
to: Extract<Currency, "USDC" | "USDT" | "USDB">;
request_amount: number;
};
Expand Down
2 changes: 1 addition & 1 deletion src/resources/quotes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type CreateQuoteResponse = {
export type GetFxRateInput = {
currency_type: CurrencyType;
from: StablecoinToken;
to: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS">;
to: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS" | "EUR">;
request_amount: number;
};

Expand Down
22 changes: 22 additions & 0 deletions src/resources/quotes/quotes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,27 @@ describe("Quotes", () => {
expect(error).toBeNull();
expect(data).toEqual(mockedFxRate);
});

it("should request a USDC to EUR FX rate", async () => {
fetchMock.mockResponseOnce(
JSON.stringify({
commercial_quotation: 0.86,
blindpay_quotation: 0.85,
result_amount: 850,
instance_flat_fee: 50,
instance_percentage_fee: 0,
}),
{ headers: { "Content-Type": "application/json" } }
);

const { error } = await blindpay.quotes.getFxRate({
currency_type: "sender",
from: "USDC",
to: "EUR",
request_amount: 1000,
});

expect(error).toBeNull();
});
});
});
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type TransactionDocumentType = "invoice" | "purchase_order" | "delivery_s

export type BankAccountType = "checking" | "saving";

export type Currency = "USDC" | "USDT" | "USDB" | "BRL" | "USD" | "MXN" | "COP" | "ARS";
export type Currency = "USDC" | "USDT" | "USDB" | "BRL" | "USD" | "MXN" | "COP" | "ARS" | "EUR";

export type Rail = "wire" | "ach" | "pix" | "pix_safe" | "spei_bitso" | "transfers_bitso" | "ach_cop_bitso" | "international_swift" | "rtp" | "ted" | "sepa";

Expand Down Expand Up @@ -657,4 +657,4 @@ export type PayoutTrackingPartnerFee = {
completed_at: string | null;
}

export type KycStatus = "awaiting_contract" | "compliance_request" | "verifying" | "approved" | "rejected" | "deprecated" | "pending_review";
export type KycStatus = "awaiting_contract" | "compliance_request" | "verifying" | "approved" | "rejected" | "deprecated" | "pending_review";