Skip to content

Commit

Permalink
fix(commerce): update Charge type
Browse files Browse the repository at this point in the history
  • Loading branch information
roushou committed Jun 29, 2024
1 parent 9cea654 commit 826fde3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-shirts-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@coinbasejs/commerce": patch
---

fix(commerce): update `Charge` type
24 changes: 8 additions & 16 deletions packages/commerce/src/charge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ export async function getCharges(apiKey: string): Promise<GetChargesResponse> {
});
}

export type ChargePricing = {
amount: string;
currency: string;
};

export type CreateChargeParameters = {
name: string;
description: string;
pricing_type: ChargePricingType;
local_price: {
amount: string;
currency: string;
};
local_price: ChargePricing;
};

export type CreateChargeResponse = {
Expand All @@ -63,12 +65,8 @@ export type Charge = {
brand_color: string;
brand_logo_url: string;
charge_kind: "WEB3";
checkout: {
id: string;
};
code: string;
collected_email: boolean;
confirmed_at: string;
created_at: string;
description: string;
expires_at: string;
Expand All @@ -81,14 +79,8 @@ export type Charge = {
// TODO: check type
payments: string[];
pricing: {
local: {
amount: string;
currency: string;
};
settlement: {
amount: string;
currency: string;
};
local: ChargePricing;
settlement: ChargePricing;
};
pricing_type: ChargePricingType;
pwcb_only: boolean;
Expand Down
1 change: 1 addition & 0 deletions packages/commerce/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type { Client, ClientConfig } from "./client";
export { createCharge, getCharge, getCharges } from "./charge";
export type {
Charge,
ChargePricing,
ChargePricingType,
CreateChargeParameters,
CreateChargeResponse,
Expand Down

0 comments on commit 826fde3

Please sign in to comment.