@@ -7,7 +7,7 @@ import { StringEnum } from '../../utils';
77export const PaymentStatus = StringEnum (
88 [ 'PENDING' , 'EXPIRED' , 'CANCELLED' , 'PAID' , 'REFUNDED' ] ,
99 'Billing status. Can be `PENDING`, `EXPIRED`, `CANCELLED`, `PAID`, `REFUNDED`.' ,
10- ) ;
10+ ) . meta ( { example : 'PENDING' } ) ;
1111
1212/**
1313 * https://docs.abacatepay.com/pages/payment/reference#atributos
@@ -17,7 +17,10 @@ export type PaymentStatus = z.infer<typeof PaymentStatus>;
1717/**
1818 * https://docs.abacatepay.com/pages/payment/create#body-methods
1919 */
20- export const PaymentMethod = StringEnum ( [ 'PIX' , 'CARD' ] , 'Payment method.' ) ;
20+ export const PaymentMethod = StringEnum (
21+ [ 'PIX' , 'CARD' ] ,
22+ 'Payment method.' ,
23+ ) . meta ( { example : 'PIX' } ) ;
2124
2225/**
2326 * https://docs.abacatepay.com/pages/payment/create#body-methods
@@ -28,56 +31,91 @@ export type PaymentMethod = z.infer<typeof PaymentMethod>;
2831 * https://docs.abacatepay.com/pages/checkouts/reference#estrutura
2932 */
3033export const APICheckout = z . object ( {
31- id : z . string ( ) . describe ( 'Unique billing identifier.' ) ,
32- amount : z . int ( ) . min ( 100 ) . describe ( 'Total amount to be paid in cents.' ) ,
34+ id : z
35+ . string ( )
36+ . describe ( 'Unique billing identifier.' )
37+ . meta ( { example : 'bill_123' } ) ,
38+ amount : z
39+ . int ( )
40+ . min ( 100 )
41+ . describe ( 'Total amount to be paid in cents.' )
42+ . meta ( { example : 4000 } ) ,
3343 paidAmount : z
3444 . union ( [ z . null ( ) , z . int ( ) . min ( 100 ) ] )
3545 . describe (
3646 'Amount already paid in cents.`null` if it has not yet been paid.' ,
37- ) ,
47+ )
48+ . meta ( { example : null } ) ,
3849 externalId : z
3950 . union ( [ z . null ( ) , z . string ( ) ] )
51+ . meta ( { example : null } )
4052 . describe ( 'Bill ID in your system.' ) ,
41- url : z . url ( ) . describe ( 'URL where the user can complete the payment.' ) ,
53+ url : z
54+ . url ( )
55+ . describe ( 'URL where the user can complete the payment.' )
56+ . meta ( { example : 'https://myshop.com/premium' } ) ,
4257 items : z
4358 . array (
4459 z . object ( {
4560 id : z . string ( ) . describe ( 'Product ID.' ) ,
4661 quantity : z . int ( ) . min ( 1 ) . describe ( 'Item quantity.' ) ,
4762 } ) ,
4863 )
64+ . meta ( {
65+ example : [
66+ {
67+ id : 'prod_123' ,
68+ quantity : 1 ,
69+ } ,
70+ ] ,
71+ } )
4972 . min ( 1 )
5073 . describe ( 'List of items in billing.' ) ,
5174 status : PaymentStatus ,
5275 devMode : z
5376 . boolean ( )
77+ . meta ( { example : true } )
5478 . describe (
5579 'Indicates whether the charge was created in a development (true) or production (false) environment.' ,
5680 ) ,
5781 metadata : z
5882 . record ( z . string ( ) , z . any ( ) )
83+ . meta ( { example : { } } )
5984 . describe ( 'Additial metadata for the charge.' ) ,
6085 returnUrl : z
6186 . url ( )
87+ . meta ( { example : 'https://myshop.com/premium' } )
6288 . describe (
6389 'URL that the customer will be redirected to when clicking the "back" button.' ,
6490 ) ,
6591 completionUrl : z
6692 . url ( )
93+ . meta ( { example : 'https://myshop.com/thanks' } )
6794 . describe (
6895 'URL that the customer will be redirected to when making payment.' ,
6996 ) ,
70- receiptUrl : z . union ( [ z . null ( ) , z . url ( ) ] ) . describe ( 'Payment receipt URL.' ) ,
97+ receiptUrl : z
98+ . union ( [ z . null ( ) , z . url ( ) ] )
99+ . meta ( { example : null } )
100+ . describe ( 'Payment receipt URL.' ) ,
71101 coupons : z
72102 . array ( z . string ( ) )
73103 . max ( 50 )
74104 . default ( [ ] )
105+ . meta ( { example : [ 'SUMMER' ] } )
75106 . describe ( 'Coupons allowed in billing.' ) ,
76107 customerId : z
77108 . union ( [ z . null ( ) , z . string ( ) ] )
109+ . meta ( { example : null } )
78110 . describe ( 'Customer ID associated with the charge.' ) ,
79- createdAt : z . coerce . date ( ) . describe ( 'Charge creation date and time.' ) ,
80- updatedAt : z . coerce . date ( ) . describe ( 'Charge last updated date and time.' ) ,
111+ createdAt : z . coerce
112+ . date ( )
113+ . describe ( 'Charge creation date and time.' )
114+ . meta ( { example : new Date ( ) } ) ,
115+ updatedAt : z . coerce
116+ . date ( )
117+ . describe ( 'Charge last updated date and time.' )
118+ . meta ( { example : new Date ( ) } ) ,
81119} ) ;
82120
83121/**
0 commit comments