@vertracloud/api-types 0.3.5 → 0.3.6
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.
package/payloads/v1/orders.d.ts
CHANGED
|
@@ -92,6 +92,8 @@ interface APIOrderStatus {
|
|
|
92
92
|
};
|
|
93
93
|
/** Same semantics as in {@link APIOrderCreateResponse.allowed_payment_methods}. */
|
|
94
94
|
allowed_payment_methods: OrderProvider[];
|
|
95
|
+
/** When the order (invoice) expires if unpaid (ISO 8601). */
|
|
96
|
+
expires_at: ISODateString | null;
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* @see https://docs.vertracloud.app/api-reference/endpoint/billing/list-orders
|
|
@@ -134,6 +136,8 @@ interface APIOrderPixPayment {
|
|
|
134
136
|
copy: string | null;
|
|
135
137
|
base64: string | null;
|
|
136
138
|
};
|
|
139
|
+
/** When this Pix QR code stops being payable (ISO 8601). A new QR can be requested for the same order while the order itself is still open. */
|
|
140
|
+
expires_at: ISODateString | null;
|
|
137
141
|
}
|
|
138
142
|
/**
|
|
139
143
|
* Card charge of an order (`POST /v1/orders/:orderId/pay/card`). Dashboard session only.
|
|
@@ -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\" | \"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;
|
|
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\t/** When the order (invoice) expires if unpaid (ISO 8601). */\n\texpires_at: ISODateString | null;\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\t/** When this Pix QR code stops being payable (ISO 8601). A new QR can be requested for the same order while the order itself is still open. */\n\texpires_at: ISODateString | 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;AAqHO,IAAM,yBAAyB;AAAA,EACrC,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,YAAY;AACb;","names":[]}
|