@vertracloud/api-types 0.2.5 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,9 +23,10 @@ declare const OrderType: {
23
23
  /**
24
24
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order
25
25
  */
26
- type OrderProvider = "pix" | "redeem_code";
26
+ type OrderProvider = "pix" | "card" | "redeem_code";
27
27
  declare const OrderProvider: {
28
28
  readonly PIX: "pix";
29
+ readonly CARD: "card";
29
30
  readonly REDEEM_CODE: "redeem_code";
30
31
  };
31
32
  /**
@@ -43,6 +44,28 @@ interface APIOrderCreateResponse {
43
44
  /** Final price, after the discount. */
44
45
  price: number;
45
46
  expires_at: ISODateString | null;
47
+ /**
48
+ * Payment methods the order accepts. The Economy plan and a coupon restricted to one method narrow
49
+ * the list; otherwise `["pix", "card"]` when card payments are available, `["pix"]` when not.
50
+ * Starting a payment with a method outside the list returns 400 `COUPON_PAYMENT_METHOD` (coupon) or
51
+ * 400 `CARD_NOT_ALLOWED_FOR_PLAN` (Economy).
52
+ */
53
+ allowed_payment_methods: OrderProvider[];
54
+ }
55
+ /**
56
+ * Price an order would have with a coupon, without creating the order or using the coupon.
57
+ * Prices already include the billing-period discount (3 months −5%, 12 −15%).
58
+ */
59
+ interface APIOrderCouponPreview {
60
+ /** The coupon code as registered. */
61
+ coupon: string;
62
+ /** Price for the plan and period before the coupon. */
63
+ price_before_discount: number;
64
+ discount_amount: number;
65
+ /** Final price with the coupon. */
66
+ price: number;
67
+ /** Payment methods the coupon allows, same rule as `APIOrderCreateResponse.allowed_payment_methods`. */
68
+ allowed_payment_methods: OrderProvider[];
46
69
  }
47
70
  /**
48
71
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order
@@ -67,6 +90,8 @@ interface APIOrderStatus {
67
90
  months: number;
68
91
  };
69
92
  };
93
+ /** Same semantics as in {@link APIOrderCreateResponse.allowed_payment_methods}. */
94
+ allowed_payment_methods: OrderProvider[];
70
95
  }
71
96
  /**
72
97
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders
@@ -86,6 +111,15 @@ interface APIOrderListItem {
86
111
  };
87
112
  created_at: ISODateString;
88
113
  paid_at: ISODateString | null;
114
+ /** A payment receipt exists for this order (`GET /v1/orders/:orderId/receipt`). */
115
+ has_receipt: boolean;
116
+ }
117
+ /**
118
+ * Payment receipt of a paid order (`GET /v1/orders/:orderId/receipt`). Dashboard session only.
119
+ */
120
+ interface APIOrderReceipt {
121
+ /** Public page of the receipt, hosted by the payment processor. */
122
+ url: string;
89
123
  }
90
124
  /**
91
125
  * PIX charge of an order (`POST /v1/orders/:orderId/initiate/pix`).
@@ -101,5 +135,21 @@ interface APIOrderPixPayment {
101
135
  base64: string | null;
102
136
  };
103
137
  }
138
+ /**
139
+ * Card charge of an order (`POST /v1/orders/:orderId/pay/card`). Dashboard session only.
140
+ * - `succeeded`: paid; the plan is delivered in a few seconds.
141
+ * - `requires_action`: the bank asks the customer to confirm (3-D Secure) in the browser with `client_secret`.
142
+ * - `processing`: the bank is still confirming; poll the order status.
143
+ */
144
+ interface APIOrderCardPayment {
145
+ client_secret: string;
146
+ status: OrderCardPaymentStatus;
147
+ }
148
+ type OrderCardPaymentStatus = "succeeded" | "requires_action" | "processing";
149
+ declare const OrderCardPaymentStatus: {
150
+ readonly SUCCEEDED: "succeeded";
151
+ readonly REQUIRES_ACTION: "requires_action";
152
+ readonly PROCESSING: "processing";
153
+ };
104
154
 
105
- export { type APIOrderCreateResponse, type APIOrderDiscount, type APIOrderListItem, type APIOrderPixPayment, type APIOrderStatus, OrderProvider, OrderStatus, OrderType };
155
+ export { type APIOrderCardPayment, type APIOrderCouponPreview, type APIOrderCreateResponse, type APIOrderDiscount, type APIOrderListItem, type APIOrderPixPayment, type APIOrderReceipt, type APIOrderStatus, OrderCardPaymentStatus, OrderProvider, OrderStatus, OrderType };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // payloads/v1/orders.ts
21
21
  var orders_exports = {};
22
22
  __export(orders_exports, {
23
+ OrderCardPaymentStatus: () => OrderCardPaymentStatus,
23
24
  OrderProvider: () => OrderProvider,
24
25
  OrderStatus: () => OrderStatus,
25
26
  OrderType: () => OrderType
@@ -38,10 +39,17 @@ var OrderType = {
38
39
  };
39
40
  var OrderProvider = {
40
41
  PIX: "pix",
42
+ CARD: "card",
41
43
  REDEEM_CODE: "redeem_code"
42
44
  };
45
+ var OrderCardPaymentStatus = {
46
+ SUCCEEDED: "succeeded",
47
+ REQUIRES_ACTION: "requires_action",
48
+ PROCESSING: "processing"
49
+ };
43
50
  // Annotate the CommonJS export names for ESM import in node:
44
51
  0 && (module.exports = {
52
+ OrderCardPaymentStatus,
45
53
  OrderProvider,
46
54
  OrderStatus,
47
55
  OrderType
@@ -1 +1 @@
1
- {"version":3,"sources":["orders.ts"],"sourcesContent":["import type { ISODateString } from \"../../v1\";\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderStatus = \"unpaid\" | \"paid\" | \"cancelled\" | \"expired\";\nexport const OrderStatus = {\n\tUNPAID: \"unpaid\",\n\tPAID: \"paid\",\n\tCANCELLED: \"cancelled\",\n\tEXPIRED: \"expired\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderType = \"purchase\" | \"renew\" | \"upgrade\";\nexport const OrderType = {\n\tPURCHASE: \"purchase\",\n\tRENEW: \"renew\",\n\tUPGRADE: \"upgrade\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderProvider = \"pix\" | \"redeem_code\";\nexport const OrderProvider = {\n\tPIX: \"pix\",\n\tREDEEM_CODE: \"redeem_code\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface APIOrderCreateResponse {\n\tid: string;\n\tcode: string | null;\n\t/** Usually `\"unpaid\"`; `\"paid\"` right away when a coupon brings the price to zero. */\n\tstatus: OrderStatus;\n\tplan: string;\n\t/** Duration in days. */\n\tduration: number;\n\tdiscount: APIOrderDiscount;\n\t/** Final price, after the discount. */\n\tprice: number;\n\texpires_at: ISODateString | null;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface APIOrderDiscount {\n\t/** `null` when no coupon was applied. */\n\tpercent: number | null;\n\tcoupon: string | null;\n\t/** Price before the discount. */\n\tprice: number;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/order-status\n */\nexport interface APIOrderStatus {\n\tid: string;\n\tstatus: OrderStatus;\n\tprice: number;\n\trelated_to: { plan: { name: string; months: number } };\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport interface APIOrderListItem {\n\tid: string;\n\tstatus: OrderStatus;\n\tprice: number;\n\tprovider: OrderProvider;\n\ttype: OrderType;\n\trelated_to: { plan: { name: string; duration: number; months: number } };\n\tcreated_at: ISODateString;\n\tpaid_at: ISODateString | null;\n}\n\n/**\n * PIX charge of an order (`POST /v1/orders/:orderId/initiate/pix`).\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/initiate-pix\n */\nexport interface APIOrderPixPayment {\n\t/** Amount charged, in BRL. */\n\ttransaction_amount: number;\n\texternal_reference: string | null;\n\ttxid: string;\n\tqrcode: { copy: string | null; base64: string | null };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,cAAc;AAAA,EAC1B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AACV;AAMO,IAAM,YAAY;AAAA,EACxB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AACV;AAMO,IAAM,gBAAgB;AAAA,EAC5B,KAAK;AAAA,EACL,aAAa;AACd;","names":[]}
1
+ {"version":3,"sources":["orders.ts"],"sourcesContent":["import type { ISODateString } from \"../../v1\";\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderStatus = \"unpaid\" | \"paid\" | \"cancelled\" | \"expired\";\nexport const OrderStatus = {\n\tUNPAID: \"unpaid\",\n\tPAID: \"paid\",\n\tCANCELLED: \"cancelled\",\n\tEXPIRED: \"expired\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderType = \"purchase\" | \"renew\" | \"upgrade\";\nexport const OrderType = {\n\tPURCHASE: \"purchase\",\n\tRENEW: \"renew\",\n\tUPGRADE: \"upgrade\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type OrderProvider = \"pix\" | \"card\" | \"redeem_code\";\nexport const OrderProvider = {\n\tPIX: \"pix\",\n\tCARD: \"card\",\n\tREDEEM_CODE: \"redeem_code\",\n} as const;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface APIOrderCreateResponse {\n\tid: string;\n\tcode: string | null;\n\t/** Usually `\"unpaid\"`; `\"paid\"` right away when a coupon brings the price to zero. */\n\tstatus: OrderStatus;\n\tplan: string;\n\t/** Duration in days. */\n\tduration: number;\n\tdiscount: APIOrderDiscount;\n\t/** Final price, after the discount. */\n\tprice: number;\n\texpires_at: ISODateString | null;\n\t/**\n\t * Payment methods the order accepts. The Economy plan and a coupon restricted to one method narrow\n\t * the list; otherwise `[\"pix\", \"card\"]` when card payments are available, `[\"pix\"]` when not.\n\t * Starting a payment with a method outside the list returns 400 `COUPON_PAYMENT_METHOD` (coupon) or\n\t * 400 `CARD_NOT_ALLOWED_FOR_PLAN` (Economy).\n\t */\n\tallowed_payment_methods: OrderProvider[];\n}\n\n/**\n * Price an order would have with a coupon, without creating the order or using the coupon.\n * Prices already include the billing-period discount (3 months −5%, 12 −15%).\n */\nexport interface APIOrderCouponPreview {\n\t/** The coupon code as registered. */\n\tcoupon: string;\n\t/** Price for the plan and period before the coupon. */\n\tprice_before_discount: number;\n\tdiscount_amount: number;\n\t/** Final price with the coupon. */\n\tprice: number;\n\t/** Payment methods the coupon allows, same rule as `APIOrderCreateResponse.allowed_payment_methods`. */\n\tallowed_payment_methods: OrderProvider[];\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface APIOrderDiscount {\n\t/** `null` when no coupon was applied. */\n\tpercent: number | null;\n\tcoupon: string | null;\n\t/** Price before the discount. */\n\tprice: number;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/order-status\n */\nexport interface APIOrderStatus {\n\tid: string;\n\tstatus: OrderStatus;\n\tprice: number;\n\trelated_to: { plan: { name: string; months: number } };\n\t/** Same semantics as in {@link APIOrderCreateResponse.allowed_payment_methods}. */\n\tallowed_payment_methods: OrderProvider[];\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport interface APIOrderListItem {\n\tid: string;\n\tstatus: OrderStatus;\n\tprice: number;\n\tprovider: OrderProvider;\n\ttype: OrderType;\n\trelated_to: { plan: { name: string; duration: number; months: number } };\n\tcreated_at: ISODateString;\n\tpaid_at: ISODateString | null;\n\t/** A payment receipt exists for this order (`GET /v1/orders/:orderId/receipt`). */\n\thas_receipt: boolean;\n}\n\n/**\n * Payment receipt of a paid order (`GET /v1/orders/:orderId/receipt`). Dashboard session only.\n */\nexport interface APIOrderReceipt {\n\t/** Public page of the receipt, hosted by the payment processor. */\n\turl: string;\n}\n\n/**\n * PIX charge of an order (`POST /v1/orders/:orderId/initiate/pix`).\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/initiate-pix\n */\nexport interface APIOrderPixPayment {\n\t/** Amount charged, in BRL. */\n\ttransaction_amount: number;\n\texternal_reference: string | null;\n\ttxid: string;\n\tqrcode: { copy: string | null; base64: string | null };\n}\n\n/**\n * Card charge of an order (`POST /v1/orders/:orderId/pay/card`). Dashboard session only.\n * - `succeeded`: paid; the plan is delivered in a few seconds.\n * - `requires_action`: the bank asks the customer to confirm (3-D Secure) in the browser with `client_secret`.\n * - `processing`: the bank is still confirming; poll the order status.\n */\nexport interface APIOrderCardPayment {\n\tclient_secret: string;\n\tstatus: OrderCardPaymentStatus;\n}\n\nexport type OrderCardPaymentStatus = \"succeeded\" | \"requires_action\" | \"processing\";\nexport const OrderCardPaymentStatus = {\n\tSUCCEEDED: \"succeeded\",\n\tREQUIRES_ACTION: \"requires_action\",\n\tPROCESSING: \"processing\",\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,cAAc;AAAA,EAC1B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AACV;AAMO,IAAM,YAAY;AAAA,EACxB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AACV;AAMO,IAAM,gBAAgB;AAAA,EAC5B,KAAK;AAAA,EACL,MAAM;AAAA,EACN,aAAa;AACd;AAiHO,IAAM,yBAAyB;AAAA,EACrC,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,YAAY;AACb;","names":[]}
@@ -12,9 +12,16 @@ var OrderType = {
12
12
  };
13
13
  var OrderProvider = {
14
14
  PIX: "pix",
15
+ CARD: "card",
15
16
  REDEEM_CODE: "redeem_code"
16
17
  };
18
+ var OrderCardPaymentStatus = {
19
+ SUCCEEDED: "succeeded",
20
+ REQUIRES_ACTION: "requires_action",
21
+ PROCESSING: "processing"
22
+ };
17
23
  export {
24
+ OrderCardPaymentStatus,
18
25
  OrderProvider,
19
26
  OrderStatus,
20
27
  OrderType
@@ -0,0 +1,53 @@
1
+ import { APIPayload } from '../../common/v1.js';
2
+ import { APIBillingCard, APIBillingDetails, APIBillingRenewal, APIBillingAddress, BillingTaxIdType } from '../../payloads/v1/billing.js';
3
+ import '../../payloads/v1/api-error.js';
4
+
5
+ /** `GET /v1/users/me/billing` — Dashboard session only. `response` is `null` until details are saved. */
6
+ type RESTGetAPIBillingDetailsResponse = APIPayload<APIBillingDetails | null>;
7
+ /**
8
+ * `PUT /v1/users/me/billing` — Dashboard session only. Replaces the billing details.
9
+ * Fails with 400 `BILLING_DETAILS_INVALID` (the field in `details.path`), 400 `TAX_ID_INVALID` and
10
+ * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.
11
+ */
12
+ interface RESTPutAPIBillingDetailsBody {
13
+ name: string;
14
+ address: APIBillingAddress;
15
+ phone: string;
16
+ /** Optional. `null` removes the saved document; omitting it keeps the saved one. */
17
+ tax_id?: {
18
+ type: BillingTaxIdType;
19
+ value: string;
20
+ } | null;
21
+ }
22
+ /** `PUT /v1/users/me/billing` — Dashboard session only. */
23
+ type RESTPutAPIBillingDetailsResponse = APIPayload<APIBillingDetails>;
24
+ /** `GET /v1/users/me/cards` — Dashboard session only. Default card first. */
25
+ type RESTGetAPIBillingCardsResponse = APIPayload<APIBillingCard[]>;
26
+ /**
27
+ * `POST /v1/users/me/cards/setup` — Dashboard session only. Secret that saves a new card in the
28
+ * browser. The card shows up in `GET /v1/users/me/cards` once confirmed; the first card becomes the default.
29
+ * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.
30
+ */
31
+ type RESTPostAPIBillingCardSetupResponse = APIPayload<{
32
+ client_secret: string;
33
+ }>;
34
+ /** `POST /v1/users/me/cards/:cardId/default` — Dashboard session only. 404 `CARD_NOT_FOUND`. */
35
+ type RESTPostAPIBillingCardDefaultResponse = APIPayload<APIBillingCard[]>;
36
+ /**
37
+ * `DELETE /v1/users/me/cards/:cardId` — Dashboard session only. 404 `CARD_NOT_FOUND`.
38
+ * Removing the default card makes the most recent remaining card the default; without cards,
39
+ * the plan no longer renews automatically. 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are
40
+ * not available.
41
+ */
42
+ type RESTDeleteAPIBillingCardResponse = APIPayload<null>;
43
+ /** `GET /v1/users/me/billing/renewal` — Dashboard session only. */
44
+ type RESTGetAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;
45
+ /** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. 400 `INVALID_PAYLOAD` for a malformed body. */
46
+ interface RESTPatchAPIBillingRenewalBody {
47
+ /** `false` cancels the automatic renewal (no charge is made later); `true` turns it back on. */
48
+ auto_renew: boolean;
49
+ }
50
+ /** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. */
51
+ type RESTPatchAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;
52
+
53
+ export type { RESTDeleteAPIBillingCardResponse, RESTGetAPIBillingCardsResponse, RESTGetAPIBillingDetailsResponse, RESTGetAPIBillingRenewalResponse, RESTPatchAPIBillingRenewalBody, RESTPatchAPIBillingRenewalResponse, RESTPostAPIBillingCardDefaultResponse, RESTPostAPIBillingCardSetupResponse, RESTPutAPIBillingDetailsBody, RESTPutAPIBillingDetailsResponse };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // rest/v1/billing.ts
17
+ var billing_exports = {};
18
+ module.exports = __toCommonJS(billing_exports);
19
+ //# sourceMappingURL=billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["billing.ts"],"sourcesContent":["import type { APIBillingAddress, APIBillingCard, APIBillingDetails, APIBillingRenewal, APIPayload, BillingTaxIdType } from \"../../v1\";\n\n/** `GET /v1/users/me/billing` — Dashboard session only. `response` is `null` until details are saved. */\nexport type RESTGetAPIBillingDetailsResponse = APIPayload<APIBillingDetails | null>;\n\n/**\n * `PUT /v1/users/me/billing` — Dashboard session only. Replaces the billing details.\n * Fails with 400 `BILLING_DETAILS_INVALID` (the field in `details.path`), 400 `TAX_ID_INVALID` and\n * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.\n */\nexport interface RESTPutAPIBillingDetailsBody {\n\tname: string;\n\taddress: APIBillingAddress;\n\tphone: string;\n\t/** Optional. `null` removes the saved document; omitting it keeps the saved one. */\n\ttax_id?: { type: BillingTaxIdType; value: string } | null;\n}\n\n/** `PUT /v1/users/me/billing` — Dashboard session only. */\nexport type RESTPutAPIBillingDetailsResponse = APIPayload<APIBillingDetails>;\n\n/** `GET /v1/users/me/cards` — Dashboard session only. Default card first. */\nexport type RESTGetAPIBillingCardsResponse = APIPayload<APIBillingCard[]>;\n\n/**\n * `POST /v1/users/me/cards/setup` — Dashboard session only. Secret that saves a new card in the\n * browser. The card shows up in `GET /v1/users/me/cards` once confirmed; the first card becomes the default.\n * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.\n */\nexport type RESTPostAPIBillingCardSetupResponse = APIPayload<{ client_secret: string }>;\n\n/** `POST /v1/users/me/cards/:cardId/default` — Dashboard session only. 404 `CARD_NOT_FOUND`. */\nexport type RESTPostAPIBillingCardDefaultResponse = APIPayload<APIBillingCard[]>;\n\n/**\n * `DELETE /v1/users/me/cards/:cardId` — Dashboard session only. 404 `CARD_NOT_FOUND`.\n * Removing the default card makes the most recent remaining card the default; without cards,\n * the plan no longer renews automatically. 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are\n * not available.\n */\nexport type RESTDeleteAPIBillingCardResponse = APIPayload<null>;\n\n/** `GET /v1/users/me/billing/renewal` — Dashboard session only. */\nexport type RESTGetAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;\n\n/** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. 400 `INVALID_PAYLOAD` for a malformed body. */\nexport interface RESTPatchAPIBillingRenewalBody {\n\t/** `false` cancels the automatic renewal (no charge is made later); `true` turns it back on. */\n\tauto_renew: boolean;\n}\n\n/** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. */\nexport type RESTPatchAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=billing.mjs.map
@@ -1,11 +1,12 @@
1
1
  export { RESTGetAPIActivitiesQuery, RESTGetAPIActivitiesResponse } from './activity.js';
2
2
  export { RESTDeleteAPIUserApiKeyResponse, RESTGetAPIUserApiKeysResponse, RESTPatchAPIUserApiKeyBody, RESTPatchAPIUserApiKeyResponse, RESTPostAPIUserApiKeyCreateBody, RESTPostAPIUserApiKeyCreateResponse, RESTPostAPIUserApiKeyRotateResponse } from './api-key.js';
3
3
  export { RESTDeleteAPIApplicationCustomDomainResponse, RESTDeleteAPIApplicationEnvironmentResponse, RESTDeleteAPIApplicationFileBody, RESTDeleteAPIApplicationFileResponse, RESTDeleteAPIApplicationResponse, RESTDeleteAPIApplicationWebPublishResponse, RESTDeleteAPIApplicationWebhookResponse, RESTGetAPIApplicationCustomDomainResponse, RESTGetAPIApplicationDeploymentsResponse, RESTGetAPIApplicationDnsRecordsResponse, RESTGetAPIApplicationDownloadResponse, RESTGetAPIApplicationEnvironmentResponse, RESTGetAPIApplicationFileContentQuery, RESTGetAPIApplicationFileContentResponse, RESTGetAPIApplicationFileTreeResponse, RESTGetAPIApplicationFilesQuery, RESTGetAPIApplicationFilesResponse, RESTGetAPIApplicationLogsResponse, RESTGetAPIApplicationMetricsQuery, RESTGetAPIApplicationMetricsResponse, RESTGetAPIApplicationRealtimeQuery, RESTGetAPIApplicationRealtimeResponse, RESTGetAPIApplicationResponse, RESTGetAPIApplicationRuntimesResponse, RESTGetAPIApplicationStatusResponse, RESTGetAPIApplicationStatusShortResponse, RESTGetAPIApplicationWebhookUrlResponse, RESTPatchAPIApplicationFileMoveBody, RESTPatchAPIApplicationFileMoveResponse, RESTPatchAPIApplicationSubdomainBody, RESTPatchAPIApplicationSubdomainResponse, RESTPatchAPIApplicationUpdateConfigBody, RESTPatchAPIApplicationUpdateConfigResponse, RESTPostAPIApplicationCreateBody, RESTPostAPIApplicationCreateResponse, RESTPostAPIApplicationCustomDomainBody, RESTPostAPIApplicationCustomDomainResponse, RESTPostAPIApplicationEnvironmentBody, RESTPostAPIApplicationEnvironmentResponse, RESTPostAPIApplicationEnvironmentVariableBody, RESTPostAPIApplicationFileUploadQuery, RESTPostAPIApplicationFileUploadResponse, RESTPostAPIApplicationPurgeCacheBody, RESTPostAPIApplicationPurgeCacheResponse, RESTPostAPIApplicationRestartBody, RESTPostAPIApplicationRestartResponse, RESTPostAPIApplicationScanBody, RESTPostAPIApplicationScanResponse, RESTPostAPIApplicationStartResponse, RESTPostAPIApplicationStopResponse, RESTPostAPIApplicationWebPublishBody, RESTPostAPIApplicationWebPublishResponse, RESTPostAPIApplicationWebhookCreateBody, RESTPostAPIApplicationWebhookCreateResponse, RESTPutAPIApplicationFileBody, RESTPutAPIApplicationFileResponse } from './application.js';
4
+ export { RESTDeleteAPIBillingCardResponse, RESTGetAPIBillingCardsResponse, RESTGetAPIBillingDetailsResponse, RESTGetAPIBillingRenewalResponse, RESTPatchAPIBillingRenewalBody, RESTPatchAPIBillingRenewalResponse, RESTPostAPIBillingCardDefaultResponse, RESTPostAPIBillingCardSetupResponse, RESTPutAPIBillingDetailsBody, RESTPutAPIBillingDetailsResponse } from './billing.js';
4
5
  export { RESTDeleteAPIDatabaseResponse, RESTGetAPIDatabaseCertificateResponse, RESTGetAPIDatabaseMetricsResponse, RESTGetAPIDatabaseResponse, RESTGetAPIDatabaseStatusResponse, RESTGetAPIDatabaseStatusShortResponse, RESTPostAPIDatabaseCreateBody, RESTPostAPIDatabaseCreateResponse, RESTPostAPIDatabaseResetCertificateResponse, RESTPostAPIDatabaseResetPasswordResponse, RESTPostAPIDatabaseResetResponse, RESTPostAPIDatabaseStartResponse, RESTPostAPIDatabaseStopResponse, RESTPutAPIDatabaseUpdateBody, RESTPutAPIDatabaseUpdateResponse } from './database.js';
5
6
  export { RESTDeleteAPIDatabaseDocumentsBody, RESTDeleteAPIDatabaseRedisKeysBody, RESTDeleteAPIDatabaseRowsBody, RESTGetAPIDatabaseCollectionIndexesResult, RESTGetAPIDatabaseCollectionsResult, RESTGetAPIDatabaseDataOverviewResult, RESTGetAPIDatabaseDocumentsResult, RESTGetAPIDatabaseRedisInfoResult, RESTGetAPIDatabaseRedisKeyValueResult, RESTGetAPIDatabaseRedisKeysResult, RESTGetAPIDatabaseSchemasResult, RESTGetAPIDatabaseTableColumnsResult, RESTGetAPIDatabaseTableRowsResult, RESTGetAPIDatabaseTablesResult, RESTMutateAPIDatabaseDocumentsResult, RESTMutateAPIDatabaseRedisKeysResult, RESTMutateAPIDatabaseRowsResult, RESTPostAPIDatabaseDocumentCreateBody, RESTPostAPIDatabaseQueryBody, RESTPostAPIDatabaseQueryResult, RESTPostAPIDatabaseRowCreateBody, RESTPutAPIDatabaseDocumentUpdateBody, RESTPutAPIDatabaseRedisKeyBody, RESTPutAPIDatabaseRedisKeyExpireBody, RESTPutAPIDatabaseRowUpdateBody } from './database-data.js';
6
7
  export { RESTGetAPINotificationsResponse } from './notification.js';
7
8
  export { RESTGetAPIOAuthClientResponse, RESTPostAPIOAuthConsentBody, RESTPostAPIOAuthConsentResponse, RESTPostAPIOAuthRegisterBody, RESTPostAPIOAuthRegisterResponse, RESTPostAPIOAuthTokenBody, RESTPostAPIOAuthTokenResponse } from './oauth.js';
8
- export { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse } from './orders.js';
9
+ export { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderReceiptResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCardPaymentBody, RESTPostAPIOrderCardPaymentResponse, RESTPostAPIOrderCouponPreviewBody, RESTPostAPIOrderCouponPreviewResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse } from './orders.js';
9
10
  export { RESTPostAPIRedeemResponse } from './redeem.js';
10
11
  export { RESTGetAPIGroupedSnapshotsQuery, RESTGetAPIGroupedSnapshotsResponse, RESTGetAPISnapshotDownloadQuery, RESTGetAPISnapshotDownloadResponse, RESTGetAPISnapshotsQuery, RESTGetAPISnapshotsResponse, RESTPostAPISnapshotCreateQuery, RESTPostAPISnapshotCreateResponse, RESTPostAPISnapshotRestoreBody, RESTPostAPISnapshotRestoreQuery, RESTPostAPISnapshotRestoreResponse } from './snapshot.js';
11
12
  export { RESTGetAPIStatusResponse } from './status.js';
@@ -17,6 +18,7 @@ import '../../payloads/v1/activity.js';
17
18
  import '../../payloads/v1/notification.js';
18
19
  import '../../payloads/v1/api-key.js';
19
20
  import '../../payloads/v1/application.js';
21
+ import '../../payloads/v1/billing.js';
20
22
  import '../../payloads/v1/database.js';
21
23
  import '../../payloads/v1/database-data.js';
22
24
  import '../../payloads/v1/oauth.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from \"./activity\";\nexport * from \"./api-key\";\nexport * from \"./application\";\nexport * from \"./database\";\nexport * from \"./database-data\";\nexport * from \"./notification\";\nexport * from \"./oauth\";\nexport * from \"./orders\";\nexport * from \"./redeem\";\nexport * from \"./snapshot\";\nexport * from \"./status\";\nexport * from \"./user\";\nexport * from \"./workspace\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from \"./activity\";\nexport * from \"./api-key\";\nexport * from \"./application\";\nexport * from \"./billing\";\nexport * from \"./database\";\nexport * from \"./database-data\";\nexport * from \"./notification\";\nexport * from \"./oauth\";\nexport * from \"./orders\";\nexport * from \"./redeem\";\nexport * from \"./snapshot\";\nexport * from \"./status\";\nexport * from \"./user\";\nexport * from \"./workspace\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { APIPayload } from '../../common/v1.js';
2
- import { OrderProvider, APIOrderListItem, APIOrderStatus, OrderType, APIOrderCreateResponse, APIOrderPixPayment } from '../../payloads/v1/orders.js';
2
+ import { OrderProvider, APIOrderListItem, APIOrderReceipt, APIOrderStatus, APIOrderCardPayment, APIOrderCouponPreview, OrderType, APIOrderCreateResponse, APIOrderPixPayment } from '../../payloads/v1/orders.js';
3
3
  import '../../payloads/v1/api-error.js';
4
4
 
5
5
  /**
@@ -8,7 +8,7 @@ import '../../payloads/v1/api-error.js';
8
8
  */
9
9
  interface RESTPostAPIOrderCreateBody {
10
10
  plan: string;
11
- /** 1, 3, 6 or 12. */
11
+ /** 1, 3 or 12. The Economy plan only accepts 1. Anything else returns 400 `INVALID_MONTHS`. */
12
12
  months: number;
13
13
  coupon?: string;
14
14
  /** Defaults to `"purchase"`. */
@@ -19,6 +19,19 @@ interface RESTPostAPIOrderCreateBody {
19
19
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order
20
20
  */
21
21
  type RESTPostAPIOrderCreateResponse = APIPayload<APIOrderCreateResponse>;
22
+ /**
23
+ * `POST /v1/orders/coupon-preview` — Dashboard session only. Checks a coupon against a plan and
24
+ * period for the signed-in account without creating an order or using the coupon. Fails with 400
25
+ * `INVALID_PAYLOAD`, 400 `INVALID_PLAN`, 400 `INVALID_MONTHS` and the `COUPON_*` codes that
26
+ * `POST /v1/orders` returns for the same coupon.
27
+ */
28
+ interface RESTPostAPIOrderCouponPreviewBody {
29
+ coupon: string;
30
+ plan: string;
31
+ /** 1, 3 or 12. */
32
+ months: number;
33
+ }
34
+ type RESTPostAPIOrderCouponPreviewResponse = APIPayload<APIOrderCouponPreview>;
22
35
  /**
23
36
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/order-status
24
37
  */
@@ -34,9 +47,40 @@ interface RESTGetAPIOrderListQuery {
34
47
  */
35
48
  type RESTGetAPIOrderListResponse = APIPayload<APIOrderListItem[]>;
36
49
  /**
37
- * `POST /v1/orders/:orderId/initiate/pix`.
50
+ * `GET /v1/orders/:orderId/receipt`. Dashboard session only. `ORDER_RECEIPT_UNAVAILABLE` when the
51
+ * order has no receipt (`has_receipt: false`).
52
+ */
53
+ type RESTGetAPIOrderReceiptResponse = APIPayload<APIOrderReceipt>;
54
+ /**
55
+ * `POST /v1/orders/:orderId/initiate/pix`. Calling it again returns the same QR code while it is valid;
56
+ * it expires with the order (`expires_at`).
57
+ * Fails with 404 `ORDER_NOT_FOUND`, 403 `FORBIDDEN` when the order belongs to another account,
58
+ * 400 `ORDER_NOT_PAYABLE` when the order is paid, cancelled or expired, 400 `COUPON_PAYMENT_METHOD`
59
+ * when the order's coupon excludes PIX, 409 `ORDER_NOT_PAYABLE` while a card payment of the order is
60
+ * being confirmed, 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available, 400
61
+ * `INVALID_PARAMS` for a malformed `orderId`, and 429 `RATE_LIMIT_EXCEEDED` while another payment of the
62
+ * account is being started.
63
+ * Starting a PIX cancels a card payment of the same order that was not completed.
38
64
  * @see https://docs.vertracloud.app/api-reference/endpoint/billing/initiate-pix
39
65
  */
40
66
  type RESTPostAPIOrderPixPaymentResponse = APIPayload<APIOrderPixPayment>;
67
+ /** `POST /v1/orders/:orderId/pay/card` — Dashboard session only. */
68
+ interface RESTPostAPIOrderCardPaymentBody {
69
+ /** Saved card (`GET /v1/users/me/cards`). */
70
+ card_id: string;
71
+ }
72
+ /**
73
+ * `POST /v1/orders/:orderId/pay/card` — Dashboard session only. Charges a saved card. Paying by card
74
+ * keeps the plan renewing automatically on the default card.
75
+ * Fails with 403 `WEBSITE_ONLY` for API keys, 400 `INVALID_PARAMS` for a malformed `orderId`, 400
76
+ * `INVALID_PAYLOAD` without a `card_id`, 404 `ORDER_NOT_FOUND`, 403 `FORBIDDEN` when the order belongs to
77
+ * another account, 404 `CARD_NOT_FOUND`, 400 `ORDER_NOT_PAYABLE` when the order is paid, cancelled or expired,
78
+ * 400 `CARD_NOT_ALLOWED_FOR_PLAN` for the Economy plan, 400 `COUPON_PAYMENT_METHOD` when the order's
79
+ * coupon excludes card, 400 `PAYMENT_METHOD_UNAVAILABLE` when card payments are not available,
80
+ * 402 `CARD_DECLINED` when the bank refuses the charge, 409 `ORDER_NOT_PAYABLE` while a PIX payment of
81
+ * the order is being confirmed, and 429 `RATE_LIMIT_EXCEEDED` while another payment of the account is
82
+ * being started.
83
+ */
84
+ type RESTPostAPIOrderCardPaymentResponse = APIPayload<APIOrderCardPayment>;
41
85
 
42
- export type { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse };
86
+ export type { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderReceiptResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCardPaymentBody, RESTPostAPIOrderCardPaymentResponse, RESTPostAPIOrderCouponPreviewBody, RESTPostAPIOrderCouponPreviewResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse };
@@ -1 +1 @@
1
- {"version":3,"sources":["orders.ts"],"sourcesContent":["import type { APIOrderCreateResponse, APIOrderListItem, APIOrderPixPayment, APIOrderStatus, APIPayload, OrderProvider, OrderType } from \"../../v1\";\n\n/**\n * A missing `plan` or `months` returns 400 `MISSING_PLAN_OR_MONTHS`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface RESTPostAPIOrderCreateBody {\n\tplan: string;\n\t/** 1, 3, 6 or 12. */\n\tmonths: number;\n\tcoupon?: string;\n\t/** Defaults to `\"purchase\"`. */\n\ttype?: OrderType;\n\tsource?: string;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type RESTPostAPIOrderCreateResponse = APIPayload<APIOrderCreateResponse>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/order-status\n */\nexport type RESTGetAPIOrderStatusResponse = APIPayload<APIOrderStatus>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport interface RESTGetAPIOrderListQuery {\n\tprovider?: OrderProvider;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport type RESTGetAPIOrderListResponse = APIPayload<APIOrderListItem[]>;\n\n/**\n * `POST /v1/orders/:orderId/initiate/pix`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/initiate-pix\n */\nexport type RESTPostAPIOrderPixPaymentResponse = APIPayload<APIOrderPixPayment>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["orders.ts"],"sourcesContent":["import type { APIOrderCardPayment, APIOrderCouponPreview, APIOrderCreateResponse, APIOrderListItem, APIOrderPixPayment, APIOrderReceipt, APIOrderStatus, APIPayload, OrderProvider, OrderType } from \"../../v1\";\n\n/**\n * A missing `plan` or `months` returns 400 `MISSING_PLAN_OR_MONTHS`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport interface RESTPostAPIOrderCreateBody {\n\tplan: string;\n\t/** 1, 3 or 12. The Economy plan only accepts 1. Anything else returns 400 `INVALID_MONTHS`. */\n\tmonths: number;\n\tcoupon?: string;\n\t/** Defaults to `\"purchase\"`. */\n\ttype?: OrderType;\n\tsource?: string;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/create-order\n */\nexport type RESTPostAPIOrderCreateResponse = APIPayload<APIOrderCreateResponse>;\n\n/**\n * `POST /v1/orders/coupon-preview` — Dashboard session only. Checks a coupon against a plan and\n * period for the signed-in account without creating an order or using the coupon. Fails with 400\n * `INVALID_PAYLOAD`, 400 `INVALID_PLAN`, 400 `INVALID_MONTHS` and the `COUPON_*` codes that\n * `POST /v1/orders` returns for the same coupon.\n */\nexport interface RESTPostAPIOrderCouponPreviewBody {\n\tcoupon: string;\n\tplan: string;\n\t/** 1, 3 or 12. */\n\tmonths: number;\n}\n\nexport type RESTPostAPIOrderCouponPreviewResponse = APIPayload<APIOrderCouponPreview>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/order-status\n */\nexport type RESTGetAPIOrderStatusResponse = APIPayload<APIOrderStatus>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport interface RESTGetAPIOrderListQuery {\n\tprovider?: OrderProvider;\n}\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders\n */\nexport type RESTGetAPIOrderListResponse = APIPayload<APIOrderListItem[]>;\n\n/**\n * `GET /v1/orders/:orderId/receipt`. Dashboard session only. `ORDER_RECEIPT_UNAVAILABLE` when the\n * order has no receipt (`has_receipt: false`).\n */\nexport type RESTGetAPIOrderReceiptResponse = APIPayload<APIOrderReceipt>;\n\n/**\n * `POST /v1/orders/:orderId/initiate/pix`. Calling it again returns the same QR code while it is valid;\n * it expires with the order (`expires_at`).\n * Fails with 404 `ORDER_NOT_FOUND`, 403 `FORBIDDEN` when the order belongs to another account,\n * 400 `ORDER_NOT_PAYABLE` when the order is paid, cancelled or expired, 400 `COUPON_PAYMENT_METHOD`\n * when the order's coupon excludes PIX, 409 `ORDER_NOT_PAYABLE` while a card payment of the order is\n * being confirmed, 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available, 400\n * `INVALID_PARAMS` for a malformed `orderId`, and 429 `RATE_LIMIT_EXCEEDED` while another payment of the\n * account is being started.\n * Starting a PIX cancels a card payment of the same order that was not completed.\n * @see https://docs.vertracloud.app/api-reference/endpoint/billing/initiate-pix\n */\nexport type RESTPostAPIOrderPixPaymentResponse = APIPayload<APIOrderPixPayment>;\n\n/** `POST /v1/orders/:orderId/pay/card` — Dashboard session only. */\nexport interface RESTPostAPIOrderCardPaymentBody {\n\t/** Saved card (`GET /v1/users/me/cards`). */\n\tcard_id: string;\n}\n\n/**\n * `POST /v1/orders/:orderId/pay/card` — Dashboard session only. Charges a saved card. Paying by card\n * keeps the plan renewing automatically on the default card.\n * Fails with 403 `WEBSITE_ONLY` for API keys, 400 `INVALID_PARAMS` for a malformed `orderId`, 400\n * `INVALID_PAYLOAD` without a `card_id`, 404 `ORDER_NOT_FOUND`, 403 `FORBIDDEN` when the order belongs to\n * another account, 404 `CARD_NOT_FOUND`, 400 `ORDER_NOT_PAYABLE` when the order is paid, cancelled or expired,\n * 400 `CARD_NOT_ALLOWED_FOR_PLAN` for the Economy plan, 400 `COUPON_PAYMENT_METHOD` when the order's\n * coupon excludes card, 400 `PAYMENT_METHOD_UNAVAILABLE` when card payments are not available,\n * 402 `CARD_DECLINED` when the bank refuses the charge, 409 `ORDER_NOT_PAYABLE` while a PIX payment of\n * the order is being confirmed, and 429 `RATE_LIMIT_EXCEEDED` while another payment of the account is\n * being started.\n */\nexport type RESTPostAPIOrderCardPaymentResponse = APIPayload<APIOrderCardPayment>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/v1.d.ts CHANGED
@@ -3,11 +3,12 @@ export { APIActivity, ActivityOrigin, ActivityStatus, ActivityTargetType } from
3
3
  export { APIApiKey, APIApiKeyCreated, APIApiKeyPreset, APIApiKeyRoute, APIApiKeyRouteMethod, APIApiKeyScope, APIApiKeyScopeEntry, API_KEY_MAX_ALLOWED_IPS, API_KEY_MAX_PER_USER, API_KEY_NAME_MAX_LENGTH, API_KEY_SCOPES, API_KEY_SCOPE_LIST, apiKeyPresetScopes } from './payloads/v1/api-key.js';
4
4
  export { APIErrorCode, API_ERROR_CODES } from './payloads/v1/api-error.js';
5
5
  export { APIApplication, APIApplicationConfig, APIApplicationCustomDomain, APIApplicationDeployment, APIApplicationDnsRecord, APIApplicationEnvironment, APIApplicationFile, APIApplicationFileContent, APIApplicationFileTree, APIApplicationFileUpload, APIApplicationGithub, APIApplicationMetric, APIApplicationNetwork, APIApplicationOperationResponse, APIApplicationRealtimeEvent, APIApplicationRuntime, APIApplicationRuntimes, APIApplicationScanSuggestions, APIApplicationShieldCooldown, APIApplicationStatus, APIApplicationStatusShort, APIApplicationSubdomain, APIApplicationWebPublish, APIApplicationWebhook, APIApplicationWebhookUrl, ApplicationCluster, ApplicationDnsRecordStatus, ApplicationDnsRecordType, ApplicationFileContentType, ApplicationFileType, ApplicationLanguage, ApplicationRealtimeEventType, ApplicationStatus, ApplicationType, ApplicationVersion, ShieldIncidentDirection, ShieldIncidentReason } from './payloads/v1/application.js';
6
+ export { APIBillingAddress, APIBillingCard, APIBillingDetails, APIBillingRenewal, APIBillingTaxId, BillingTaxIdType } from './payloads/v1/billing.js';
6
7
  export { APIDatabase, APIDatabaseCertificate, APIDatabaseMetrics, APIDatabaseNetwork, APIDatabaseOperationResponse, APIDatabasePasswordReset, APIDatabaseStatus, APIDatabaseStatusShort, DatabaseCluster, DatabaseStatus, DatabaseType } from './payloads/v1/database.js';
7
8
  export { APIDatabaseCollection, APIDatabaseColumn, APIDatabaseColumnReference, APIDatabaseDataError, APIDatabaseDataOverview, APIDatabaseDocumentListParams, APIDatabaseDocumentsPage, APIDatabaseIndex, APIDatabaseListParams, APIDatabaseMongoIndex, APIDatabaseQueryResult, APIDatabaseRedisInfo, APIDatabaseRedisKey, APIDatabaseRedisKeyValue, APIDatabaseRedisKeysPage, APIDatabaseRedisScanParams, APIDatabaseRedisZSetMember, APIDatabaseRowFilter, APIDatabaseRowsPage, APIDatabaseSchema, APIDatabaseTable, DatabaseFilterOperator, DatabaseRedisKeyType, DatabaseSortDirection, DatabaseTableKind } from './payloads/v1/database-data.js';
8
9
  export { APINotification, LocalizedContent, NotificationImportance, NotificationType } from './payloads/v1/notification.js';
9
10
  export { APIOAuthClient, APIOAuthCodeChallengeMethod, APIOAuthConsentDecision } from './payloads/v1/oauth.js';
10
- export { APIOrderCreateResponse, APIOrderDiscount, APIOrderListItem, APIOrderPixPayment, APIOrderStatus, OrderProvider, OrderStatus, OrderType } from './payloads/v1/orders.js';
11
+ export { APIOrderCardPayment, APIOrderCouponPreview, APIOrderCreateResponse, APIOrderDiscount, APIOrderListItem, APIOrderPixPayment, APIOrderReceipt, APIOrderStatus, OrderCardPaymentStatus, OrderProvider, OrderStatus, OrderType } from './payloads/v1/orders.js';
11
12
  export { APIRedeemResponse } from './payloads/v1/redeem.js';
12
13
  export { APIGroupedResourceSnapshots, APIResourceSnapshot, APISnapshotRestoreResponse, ResourceType, SnapshotResourceType, SnapshotScope } from './payloads/v1/snapshot.js';
13
14
  export { APIStatus, StatusType } from './payloads/v1/status.js';
@@ -16,11 +17,12 @@ export { APIWorkspace, APIWorkspaceActionRequest, APIWorkspaceFavorite, APIWorks
16
17
  export { RESTGetAPIActivitiesQuery, RESTGetAPIActivitiesResponse } from './rest/v1/activity.js';
17
18
  export { RESTDeleteAPIUserApiKeyResponse, RESTGetAPIUserApiKeysResponse, RESTPatchAPIUserApiKeyBody, RESTPatchAPIUserApiKeyResponse, RESTPostAPIUserApiKeyCreateBody, RESTPostAPIUserApiKeyCreateResponse, RESTPostAPIUserApiKeyRotateResponse } from './rest/v1/api-key.js';
18
19
  export { RESTDeleteAPIApplicationCustomDomainResponse, RESTDeleteAPIApplicationEnvironmentResponse, RESTDeleteAPIApplicationFileBody, RESTDeleteAPIApplicationFileResponse, RESTDeleteAPIApplicationResponse, RESTDeleteAPIApplicationWebPublishResponse, RESTDeleteAPIApplicationWebhookResponse, RESTGetAPIApplicationCustomDomainResponse, RESTGetAPIApplicationDeploymentsResponse, RESTGetAPIApplicationDnsRecordsResponse, RESTGetAPIApplicationDownloadResponse, RESTGetAPIApplicationEnvironmentResponse, RESTGetAPIApplicationFileContentQuery, RESTGetAPIApplicationFileContentResponse, RESTGetAPIApplicationFileTreeResponse, RESTGetAPIApplicationFilesQuery, RESTGetAPIApplicationFilesResponse, RESTGetAPIApplicationLogsResponse, RESTGetAPIApplicationMetricsQuery, RESTGetAPIApplicationMetricsResponse, RESTGetAPIApplicationRealtimeQuery, RESTGetAPIApplicationRealtimeResponse, RESTGetAPIApplicationResponse, RESTGetAPIApplicationRuntimesResponse, RESTGetAPIApplicationStatusResponse, RESTGetAPIApplicationStatusShortResponse, RESTGetAPIApplicationWebhookUrlResponse, RESTPatchAPIApplicationFileMoveBody, RESTPatchAPIApplicationFileMoveResponse, RESTPatchAPIApplicationSubdomainBody, RESTPatchAPIApplicationSubdomainResponse, RESTPatchAPIApplicationUpdateConfigBody, RESTPatchAPIApplicationUpdateConfigResponse, RESTPostAPIApplicationCreateBody, RESTPostAPIApplicationCreateResponse, RESTPostAPIApplicationCustomDomainBody, RESTPostAPIApplicationCustomDomainResponse, RESTPostAPIApplicationEnvironmentBody, RESTPostAPIApplicationEnvironmentResponse, RESTPostAPIApplicationEnvironmentVariableBody, RESTPostAPIApplicationFileUploadQuery, RESTPostAPIApplicationFileUploadResponse, RESTPostAPIApplicationPurgeCacheBody, RESTPostAPIApplicationPurgeCacheResponse, RESTPostAPIApplicationRestartBody, RESTPostAPIApplicationRestartResponse, RESTPostAPIApplicationScanBody, RESTPostAPIApplicationScanResponse, RESTPostAPIApplicationStartResponse, RESTPostAPIApplicationStopResponse, RESTPostAPIApplicationWebPublishBody, RESTPostAPIApplicationWebPublishResponse, RESTPostAPIApplicationWebhookCreateBody, RESTPostAPIApplicationWebhookCreateResponse, RESTPutAPIApplicationFileBody, RESTPutAPIApplicationFileResponse } from './rest/v1/application.js';
20
+ export { RESTDeleteAPIBillingCardResponse, RESTGetAPIBillingCardsResponse, RESTGetAPIBillingDetailsResponse, RESTGetAPIBillingRenewalResponse, RESTPatchAPIBillingRenewalBody, RESTPatchAPIBillingRenewalResponse, RESTPostAPIBillingCardDefaultResponse, RESTPostAPIBillingCardSetupResponse, RESTPutAPIBillingDetailsBody, RESTPutAPIBillingDetailsResponse } from './rest/v1/billing.js';
19
21
  export { RESTDeleteAPIDatabaseResponse, RESTGetAPIDatabaseCertificateResponse, RESTGetAPIDatabaseMetricsResponse, RESTGetAPIDatabaseResponse, RESTGetAPIDatabaseStatusResponse, RESTGetAPIDatabaseStatusShortResponse, RESTPostAPIDatabaseCreateBody, RESTPostAPIDatabaseCreateResponse, RESTPostAPIDatabaseResetCertificateResponse, RESTPostAPIDatabaseResetPasswordResponse, RESTPostAPIDatabaseResetResponse, RESTPostAPIDatabaseStartResponse, RESTPostAPIDatabaseStopResponse, RESTPutAPIDatabaseUpdateBody, RESTPutAPIDatabaseUpdateResponse } from './rest/v1/database.js';
20
22
  export { RESTDeleteAPIDatabaseDocumentsBody, RESTDeleteAPIDatabaseRedisKeysBody, RESTDeleteAPIDatabaseRowsBody, RESTGetAPIDatabaseCollectionIndexesResult, RESTGetAPIDatabaseCollectionsResult, RESTGetAPIDatabaseDataOverviewResult, RESTGetAPIDatabaseDocumentsResult, RESTGetAPIDatabaseRedisInfoResult, RESTGetAPIDatabaseRedisKeyValueResult, RESTGetAPIDatabaseRedisKeysResult, RESTGetAPIDatabaseSchemasResult, RESTGetAPIDatabaseTableColumnsResult, RESTGetAPIDatabaseTableRowsResult, RESTGetAPIDatabaseTablesResult, RESTMutateAPIDatabaseDocumentsResult, RESTMutateAPIDatabaseRedisKeysResult, RESTMutateAPIDatabaseRowsResult, RESTPostAPIDatabaseDocumentCreateBody, RESTPostAPIDatabaseQueryBody, RESTPostAPIDatabaseQueryResult, RESTPostAPIDatabaseRowCreateBody, RESTPutAPIDatabaseDocumentUpdateBody, RESTPutAPIDatabaseRedisKeyBody, RESTPutAPIDatabaseRedisKeyExpireBody, RESTPutAPIDatabaseRowUpdateBody } from './rest/v1/database-data.js';
21
23
  export { RESTGetAPINotificationsResponse } from './rest/v1/notification.js';
22
24
  export { RESTGetAPIOAuthClientResponse, RESTPostAPIOAuthConsentBody, RESTPostAPIOAuthConsentResponse, RESTPostAPIOAuthRegisterBody, RESTPostAPIOAuthRegisterResponse, RESTPostAPIOAuthTokenBody, RESTPostAPIOAuthTokenResponse } from './rest/v1/oauth.js';
23
- export { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse } from './rest/v1/orders.js';
25
+ export { RESTGetAPIOrderListQuery, RESTGetAPIOrderListResponse, RESTGetAPIOrderReceiptResponse, RESTGetAPIOrderStatusResponse, RESTPostAPIOrderCardPaymentBody, RESTPostAPIOrderCardPaymentResponse, RESTPostAPIOrderCouponPreviewBody, RESTPostAPIOrderCouponPreviewResponse, RESTPostAPIOrderCreateBody, RESTPostAPIOrderCreateResponse, RESTPostAPIOrderPixPaymentResponse } from './rest/v1/orders.js';
24
26
  export { RESTPostAPIRedeemResponse } from './rest/v1/redeem.js';
25
27
  export { RESTGetAPIGroupedSnapshotsQuery, RESTGetAPIGroupedSnapshotsResponse, RESTGetAPISnapshotDownloadQuery, RESTGetAPISnapshotDownloadResponse, RESTGetAPISnapshotsQuery, RESTGetAPISnapshotsResponse, RESTPostAPISnapshotCreateQuery, RESTPostAPISnapshotCreateResponse, RESTPostAPISnapshotRestoreBody, RESTPostAPISnapshotRestoreQuery, RESTPostAPISnapshotRestoreResponse } from './rest/v1/snapshot.js';
26
28
  export { RESTGetAPIStatusResponse } from './rest/v1/status.js';
package/v1.js CHANGED
@@ -44,6 +44,7 @@ __export(v1_exports, {
44
44
  ApplicationStatus: () => ApplicationStatus,
45
45
  ApplicationType: () => ApplicationType,
46
46
  ApplicationVersion: () => ApplicationVersion,
47
+ BillingTaxIdType: () => BillingTaxIdType,
47
48
  DatabaseCluster: () => DatabaseCluster,
48
49
  DatabaseFilterOperator: () => DatabaseFilterOperator,
49
50
  DatabaseRedisKeyType: () => DatabaseRedisKeyType,
@@ -53,6 +54,7 @@ __export(v1_exports, {
53
54
  DatabaseType: () => DatabaseType,
54
55
  NotificationImportance: () => NotificationImportance,
55
56
  NotificationType: () => NotificationType,
57
+ OrderCardPaymentStatus: () => OrderCardPaymentStatus,
56
58
  OrderProvider: () => OrderProvider,
57
59
  OrderStatus: () => OrderStatus,
58
60
  OrderType: () => OrderType,
@@ -487,9 +489,32 @@ var API_ERROR_CODES = {
487
489
  APP_NOT_FOUND_IN_WORKSPACE: "APP_NOT_FOUND_IN_WORKSPACE",
488
490
  BUILD_FAILED: "BUILD_FAILED",
489
491
  BUILD_TIMEOUT: "BUILD_TIMEOUT",
492
+ /** 400 — billing details failed validation; the field is in `details.path`. */
493
+ BILLING_DETAILS_INVALID: "BILLING_DETAILS_INVALID",
494
+ /** 402 — the bank refused the card charge. */
495
+ CARD_DECLINED: "CARD_DECLINED",
496
+ /** 400 — the plan can only be paid by PIX. */
497
+ CARD_NOT_ALLOWED_FOR_PLAN: "CARD_NOT_ALLOWED_FOR_PLAN",
498
+ CARD_NOT_FOUND: "CARD_NOT_FOUND",
490
499
  CERTIFICATE_NOT_FOUND: "CERTIFICATE_NOT_FOUND",
491
500
  CLEANUP_LANGUAGE_SAME_AS_CURRENT: "CLEANUP_LANGUAGE_SAME_AS_CURRENT",
492
501
  CONTAINER_ALREADY_RUNNING: "CONTAINER_ALREADY_RUNNING",
502
+ /** 400 — no active coupon with this code. */
503
+ COUPON_INVALID: "COUPON_INVALID",
504
+ COUPON_INACTIVE: "COUPON_INACTIVE",
505
+ COUPON_NOT_STARTED: "COUPON_NOT_STARTED",
506
+ COUPON_EXPIRED: "COUPON_EXPIRED",
507
+ /** 400 — the coupon reached its total number of uses. */
508
+ COUPON_EXHAUSTED: "COUPON_EXHAUSTED",
509
+ /** 400 — the account already used this coupon as many times as allowed. */
510
+ COUPON_USER_LIMIT: "COUPON_USER_LIMIT",
511
+ /** 400 — the coupon is not available to this account. */
512
+ COUPON_AUDIENCE: "COUPON_AUDIENCE",
513
+ /** 400 — the coupon does not apply to this plan. */
514
+ COUPON_PLAN: "COUPON_PLAN",
515
+ /** 400 — the coupon does not apply to this billing period. */
516
+ COUPON_DURATION: "COUPON_DURATION",
517
+ COUPON_PAYMENT_METHOD: "COUPON_PAYMENT_METHOD",
493
518
  CUSTOM_DOMAIN_RECORD_NOT_FOUND: "CUSTOM_DOMAIN_RECORD_NOT_FOUND",
494
519
  CUSTOM_DOMAIN_REGISTRATION_FAILED: "CUSTOM_DOMAIN_REGISTRATION_FAILED",
495
520
  DAILY_QUOTA_EXCEEDED: "DAILY_QUOTA_EXCEEDED",
@@ -565,9 +590,14 @@ var API_ERROR_CODES = {
565
590
  ORDER_NOT_PAID: "ORDER_NOT_PAID",
566
591
  ORDER_NOT_PAYABLE: "ORDER_NOT_PAYABLE",
567
592
  ORDER_NOT_REFUNDED: "ORDER_NOT_REFUNDED",
593
+ /** 404 — the order has no payment receipt (unpaid, redeemed code or paid before receipts existed). */
594
+ ORDER_RECEIPT_UNAVAILABLE: "ORDER_RECEIPT_UNAVAILABLE",
568
595
  OWNER_APP_WITHOUT_LIMITS: "OWNER_APP_WITHOUT_LIMITS",
569
596
  PAYLOAD_TOO_LARGE: "PAYLOAD_TOO_LARGE",
597
+ /** 409 — a folder in the path is an existing file (writing `app/x.js` when `app` is a file). */
598
+ PATH_IS_FILE: "PATH_IS_FILE",
570
599
  PENDING_ORDER_LIMIT_REACHED: "PENDING_ORDER_LIMIT_REACHED",
600
+ PAYMENT_METHOD_UNAVAILABLE: "PAYMENT_METHOD_UNAVAILABLE",
571
601
  PLAN_DOES_NOT_SUPPORT_CUSTOM_DOMAIN: "PLAN_DOES_NOT_SUPPORT_CUSTOM_DOMAIN",
572
602
  PLAN_DOES_NOT_SUPPORT_CUSTOM_SUBDOMAIN: "PLAN_DOES_NOT_SUPPORT_CUSTOM_SUBDOMAIN",
573
603
  PLAN_DOES_NOT_SUPPORT_WEB_PUBLISH: "PLAN_DOES_NOT_SUPPORT_WEB_PUBLISH",
@@ -590,6 +620,8 @@ var API_ERROR_CODES = {
590
620
  SUBDOMAIN_CHANGE_RATE_LIMITED: "SUBDOMAIN_CHANGE_RATE_LIMITED",
591
621
  SUBDOMAIN_FORBIDDEN: "SUBDOMAIN_FORBIDDEN",
592
622
  SUBDOMAIN_TAKEN: "SUBDOMAIN_TAKEN",
623
+ /** 400 — the CPF or CNPJ is not valid. */
624
+ TAX_ID_INVALID: "TAX_ID_INVALID",
593
625
  TYPE_MISMATCH: "TYPE_MISMATCH",
594
626
  USER_LIMITS_NOT_FOUND: "USER_LIMITS_NOT_FOUND",
595
627
  USER_NOT_FOUND: "USER_NOT_FOUND",
@@ -664,6 +696,12 @@ var ApplicationRealtimeEventType = {
664
696
  HEARTBEAT: "heartbeat"
665
697
  };
666
698
 
699
+ // payloads/v1/billing.ts
700
+ var BillingTaxIdType = {
701
+ CPF: "cpf",
702
+ CNPJ: "cnpj"
703
+ };
704
+
667
705
  // payloads/v1/database.ts
668
706
  var DatabaseType = {
669
707
  POSTGRESQL: 1,
@@ -740,8 +778,14 @@ var OrderType = {
740
778
  };
741
779
  var OrderProvider = {
742
780
  PIX: "pix",
781
+ CARD: "card",
743
782
  REDEEM_CODE: "redeem_code"
744
783
  };
784
+ var OrderCardPaymentStatus = {
785
+ SUCCEEDED: "succeeded",
786
+ REQUIRES_ACTION: "requires_action",
787
+ PROCESSING: "processing"
788
+ };
745
789
 
746
790
  // payloads/v1/snapshot.ts
747
791
  var ResourceType = {
@@ -792,6 +836,7 @@ var UserLanguage = {
792
836
  ApplicationStatus,
793
837
  ApplicationType,
794
838
  ApplicationVersion,
839
+ BillingTaxIdType,
795
840
  DatabaseCluster,
796
841
  DatabaseFilterOperator,
797
842
  DatabaseRedisKeyType,
@@ -801,6 +846,7 @@ var UserLanguage = {
801
846
  DatabaseType,
802
847
  NotificationImportance,
803
848
  NotificationType,
849
+ OrderCardPaymentStatus,
804
850
  OrderProvider,
805
851
  OrderStatus,
806
852
  OrderType,