@bloque/sdk-swap 0.0.28 → 0.0.29
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/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/wire-types.d.ts +119 -0
- package/dist/pse/pse-client.d.ts +66 -1
- package/dist/pse/types.d.ts +216 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var a in t)__webpack_require__.o(t,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{SwapClient:()=>SwapClient,PseClient:()=>PseClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class PseClient extends sdk_core_namespaceObject.BaseClient{async banks(){return{banks:(await this.httpClient.request({method:"GET",path:"/api/utils/pse/banks"})).banks.map(e=>this._mapBankResponse(e))}}_mapBankResponse(e){return{code:e.financial_institution_code,name:e.financial_institution_name}}}class SwapClient extends sdk_core_namespaceObject.BaseClient{pse;constructor(e){super(e),this.pse=new PseClient(this.httpClient)}async findRates(e){let t=new URLSearchParams,a=JSON.stringify([e.fromAsset,e.toAsset]);t.append("edge",a),t.append("from_medium",JSON.stringify(e.fromMediums)),t.append("to_medium",JSON.stringify(e.toMediums)),void 0!==e.amountSrc&&t.append("amount_src",e.amountSrc),void 0!==e.amountDst&&t.append("amount_dst",e.amountDst),e.sort&&t.append("sort",e.sort),e.sortBy&&t.append("sort_by",e.sortBy);let r=t.toString(),
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var a in t)__webpack_require__.o(t,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{SwapClient:()=>SwapClient,PseClient:()=>PseClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class PseClient extends sdk_core_namespaceObject.BaseClient{async banks(){return{banks:(await this.httpClient.request({method:"GET",path:"/api/utils/pse/banks"})).banks.map(e=>this._mapBankResponse(e))}}async createTopUp(e){let t={name:"PSE Top-up",description:"PSE Top-up",currency:e.currency,payment_type:"shopping_cart",items:[{name:"PSE Top-up",amount:e.amount,quantity:1}],success_url:e.successUrl,webhook_url:e.webhookUrl},a=await this.httpClient.request({method:"POST",path:"/api/payments",body:t});return{payment:this._mapPaymentResponse(a.payment)}}async initiatePayment(e){let t={payment_urn:e.paymentUrn,payee:{name:e.payee.name,email:e.payee.email,id_type:e.payee.idType,id_number:e.payee.idNumber},person_type:e.personType,bank_code:e.bankCode},a=await this.httpClient.request({method:"POST",path:"/api/payments/pse",body:t});return{paymentId:a.payment_id,status:a.status,message:a.message,amount:a.amount,currency:a.currency,checkoutUrl:a.checkout_url,orderId:a.order_id,orderStatus:a.order_status,createdAt:a.created_at}}_mapBankResponse(e){return{code:e.financial_institution_code,name:e.financial_institution_name}}_mapPaymentResponse(e){return{urn:e.urn,ownerUrn:e.owner_urn,name:e.name,description:e.description,currency:e.currency,amount:e.amount,url:e.url,successUrl:e.success_url,cancelUrl:e.cancel_url,imageUrl:e.image_url,metadata:e.metadata,tax:e.tax,discountCode:e.discount_code,webhookUrl:e.webhook_url,payoutRoute:e.payout_route,summary:{status:e.summary.status},expiresAt:e.expires_at,createdAt:e.created_at,updatedAt:e.updated_at,paymentType:e.payment_type,items:e.items.map(e=>this._mapPaymentItemResponse(e))}}_mapPaymentItemResponse(e){return{name:e.name,amount:e.amount,sku:e.sku,description:e.description,quantity:e.quantity,imageUrl:e.image_url}}}class SwapClient extends sdk_core_namespaceObject.BaseClient{pse;constructor(e){super(e),this.pse=new PseClient(this.httpClient)}async findRates(e){let t=new URLSearchParams,a=JSON.stringify([e.fromAsset,e.toAsset]);t.append("edge",a),t.append("from_medium",JSON.stringify(e.fromMediums)),t.append("to_medium",JSON.stringify(e.toMediums)),void 0!==e.amountSrc&&t.append("amount_src",e.amountSrc),void 0!==e.amountDst&&t.append("amount_dst",e.amountDst),e.sort&&t.append("sort",e.sort),e.sortBy&&t.append("sort_by",e.sortBy);let r=t.toString(),n=`/api/rates?${r}`;return{rates:(await this.httpClient.request({method:"GET",path:n})).rates.map(e=>this._mapRateResponse(e))}}_mapRateResponse(e){return{id:e.id,sig:e.sig,swapSig:e.swap_sig,maker:e.maker,edge:e.edge,fee:{at:e.fee.at,value:e.fee.value,formula:e.fee.formula,components:e.fee.components.map(e=>({at:e.at,name:e.name,type:e.type,value:e.value,percentage:e.percentage,pair:e.pair,amount:e.amount}))},at:e.at,until:e.until,fromMediums:e.from_medium,toMediums:e.to_medium,rate:e.rate,ratio:e.ratio,fromLimits:e.from_limits,toLimits:e.to_limits,createdAt:e.created_at,updatedAt:e.updated_at}}}for(var __rspack_i in exports.PseClient=__webpack_exports__.PseClient,exports.SwapClient=__webpack_exports__.SwapClient,__webpack_exports__)-1===["PseClient","SwapClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseClient as
|
|
1
|
+
import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async banks(){return{banks:(await this.httpClient.request({method:"GET",path:"/api/utils/pse/banks"})).banks.map(e=>this._mapBankResponse(e))}}async createTopUp(e){let t={name:"PSE Top-up",description:"PSE Top-up",currency:e.currency,payment_type:"shopping_cart",items:[{name:"PSE Top-up",amount:e.amount,quantity:1}],success_url:e.successUrl,webhook_url:e.webhookUrl},a=await this.httpClient.request({method:"POST",path:"/api/payments",body:t});return{payment:this._mapPaymentResponse(a.payment)}}async initiatePayment(e){let t={payment_urn:e.paymentUrn,payee:{name:e.payee.name,email:e.payee.email,id_type:e.payee.idType,id_number:e.payee.idNumber},person_type:e.personType,bank_code:e.bankCode},a=await this.httpClient.request({method:"POST",path:"/api/payments/pse",body:t});return{paymentId:a.payment_id,status:a.status,message:a.message,amount:a.amount,currency:a.currency,checkoutUrl:a.checkout_url,orderId:a.order_id,orderStatus:a.order_status,createdAt:a.created_at}}_mapBankResponse(e){return{code:e.financial_institution_code,name:e.financial_institution_name}}_mapPaymentResponse(e){return{urn:e.urn,ownerUrn:e.owner_urn,name:e.name,description:e.description,currency:e.currency,amount:e.amount,url:e.url,successUrl:e.success_url,cancelUrl:e.cancel_url,imageUrl:e.image_url,metadata:e.metadata,tax:e.tax,discountCode:e.discount_code,webhookUrl:e.webhook_url,payoutRoute:e.payout_route,summary:{status:e.summary.status},expiresAt:e.expires_at,createdAt:e.created_at,updatedAt:e.updated_at,paymentType:e.payment_type,items:e.items.map(e=>this._mapPaymentItemResponse(e))}}_mapPaymentItemResponse(e){return{name:e.name,amount:e.amount,sku:e.sku,description:e.description,quantity:e.quantity,imageUrl:e.image_url}}}class a extends e{pse;constructor(e){super(e),this.pse=new t(this.httpClient)}async findRates(e){let t=new URLSearchParams,a=JSON.stringify([e.fromAsset,e.toAsset]);t.append("edge",a),t.append("from_medium",JSON.stringify(e.fromMediums)),t.append("to_medium",JSON.stringify(e.toMediums)),void 0!==e.amountSrc&&t.append("amount_src",e.amountSrc),void 0!==e.amountDst&&t.append("amount_dst",e.amountDst),e.sort&&t.append("sort",e.sort),e.sortBy&&t.append("sort_by",e.sortBy);let n=t.toString(),s=`/api/rates?${n}`;return{rates:(await this.httpClient.request({method:"GET",path:s})).rates.map(e=>this._mapRateResponse(e))}}_mapRateResponse(e){return{id:e.id,sig:e.sig,swapSig:e.swap_sig,maker:e.maker,edge:e.edge,fee:{at:e.fee.at,value:e.fee.value,formula:e.fee.formula,components:e.fee.components.map(e=>({at:e.at,name:e.name,type:e.type,value:e.value,percentage:e.percentage,pair:e.pair,amount:e.amount}))},at:e.at,until:e.until,fromMediums:e.from_medium,toMediums:e.to_medium,rate:e.rate,ratio:e.ratio,fromLimits:e.from_limits,toLimits:e.to_limits,createdAt:e.created_at,updatedAt:e.updated_at}}}export{t as PseClient,a as SwapClient};
|
|
@@ -68,3 +68,122 @@ export interface PseBank {
|
|
|
68
68
|
export interface ListPseBanksResponse {
|
|
69
69
|
banks: PseBank[];
|
|
70
70
|
}
|
|
71
|
+
type Currency = 'DUSD/6' | 'COP/2' | 'KSM/12';
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
* Payment item in request (snake_case)
|
|
75
|
+
*/
|
|
76
|
+
export interface CreatePaymentItemInput {
|
|
77
|
+
name: string;
|
|
78
|
+
amount: string;
|
|
79
|
+
sku?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
quantity: number;
|
|
82
|
+
image_url?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
* Create payment request body
|
|
87
|
+
*/
|
|
88
|
+
export interface CreatePaymentInput {
|
|
89
|
+
name: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
currency: Currency;
|
|
92
|
+
payment_type: string;
|
|
93
|
+
image_url?: string;
|
|
94
|
+
items: CreatePaymentItemInput[];
|
|
95
|
+
success_url?: string;
|
|
96
|
+
cancel_url?: string;
|
|
97
|
+
metadata?: Record<string, unknown>;
|
|
98
|
+
expires_at?: string;
|
|
99
|
+
webhook_url?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
* Payment item in response
|
|
104
|
+
*/
|
|
105
|
+
export interface PaymentItemResponse {
|
|
106
|
+
name: string;
|
|
107
|
+
amount: number;
|
|
108
|
+
sku?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
quantity: number;
|
|
111
|
+
image_url?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
* Payment summary from API
|
|
116
|
+
*/
|
|
117
|
+
export interface PaymentSummaryResponse {
|
|
118
|
+
status: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* @internal
|
|
122
|
+
* Payment response from API
|
|
123
|
+
*/
|
|
124
|
+
export interface PaymentResponse {
|
|
125
|
+
urn: string;
|
|
126
|
+
owner_urn: string;
|
|
127
|
+
name: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
currency: Currency;
|
|
130
|
+
amount: number;
|
|
131
|
+
url: string;
|
|
132
|
+
success_url?: string;
|
|
133
|
+
cancel_url?: string;
|
|
134
|
+
image_url?: string;
|
|
135
|
+
metadata?: Record<string, unknown>;
|
|
136
|
+
tax?: number;
|
|
137
|
+
discount_code?: string;
|
|
138
|
+
webhook_url?: string;
|
|
139
|
+
payout_route: unknown[];
|
|
140
|
+
summary: PaymentSummaryResponse;
|
|
141
|
+
expires_at?: string;
|
|
142
|
+
created_at: string;
|
|
143
|
+
updated_at: string;
|
|
144
|
+
payment_type: string;
|
|
145
|
+
items: PaymentItemResponse[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @internal
|
|
149
|
+
* Create payment API response wrapper
|
|
150
|
+
*/
|
|
151
|
+
export interface CreatePaymentResponse {
|
|
152
|
+
payment: PaymentResponse;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @internal
|
|
156
|
+
* Payee info for PSE payment
|
|
157
|
+
*/
|
|
158
|
+
export interface PsePayeeInput {
|
|
159
|
+
name: string;
|
|
160
|
+
email: string;
|
|
161
|
+
id_type: string;
|
|
162
|
+
id_number: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @internal
|
|
166
|
+
* Initiate PSE payment request body
|
|
167
|
+
*/
|
|
168
|
+
export interface InitiatePsePaymentInput {
|
|
169
|
+
payment_urn: string;
|
|
170
|
+
payee: PsePayeeInput;
|
|
171
|
+
person_type: string;
|
|
172
|
+
bank_code: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @internal
|
|
176
|
+
* Initiate PSE payment response
|
|
177
|
+
*/
|
|
178
|
+
export interface InitiatePsePaymentResponse {
|
|
179
|
+
payment_id: string;
|
|
180
|
+
status: string;
|
|
181
|
+
message: string;
|
|
182
|
+
amount: string;
|
|
183
|
+
currency: Currency;
|
|
184
|
+
checkout_url: string;
|
|
185
|
+
order_id: string;
|
|
186
|
+
order_status: string;
|
|
187
|
+
created_at: string;
|
|
188
|
+
}
|
|
189
|
+
export {};
|
package/dist/pse/pse-client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '@bloque/sdk-core';
|
|
2
|
-
import type { ListBanksResult } from './types';
|
|
2
|
+
import type { CreateTopUpParams, CreateTopUpResult, InitiatePsePaymentParams, InitiatePsePaymentResult, ListBanksResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* PSE client for PSE-related utilities
|
|
5
5
|
*
|
|
@@ -23,9 +23,74 @@ export declare class PseClient extends BaseClient {
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
banks(): Promise<ListBanksResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a PSE top-up
|
|
28
|
+
*
|
|
29
|
+
* Creates a payment intent for a PSE top-up/recharge.
|
|
30
|
+
* Use the returned payment URN with initiatePayment() to start the PSE flow.
|
|
31
|
+
*
|
|
32
|
+
* @param params - Top-up creation parameters
|
|
33
|
+
* @returns Promise resolving to the created payment
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const result = await bloque.swap.pse.createTopUp({
|
|
38
|
+
* amount: '50000000',
|
|
39
|
+
* currency: 'DUSD/6',
|
|
40
|
+
* successUrl: 'https://example.com/payment/success',
|
|
41
|
+
* webhookUrl: 'https://myapp.com/webhooks/payment',
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Use the URN to initiate PSE payment
|
|
45
|
+
* console.log(result.payment.urn);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
createTopUp(params: CreateTopUpParams): Promise<CreateTopUpResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Initiate a PSE payment
|
|
51
|
+
*
|
|
52
|
+
* Initiates the PSE payment flow for a previously created top-up.
|
|
53
|
+
* Returns a checkout URL where the user should be redirected to complete the payment.
|
|
54
|
+
*
|
|
55
|
+
* @param params - PSE payment parameters
|
|
56
|
+
* @returns Promise resolving to PSE payment result with checkout URL
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // First create a top-up
|
|
61
|
+
* const topUp = await bloque.swap.pse.createTopUp({...});
|
|
62
|
+
*
|
|
63
|
+
* // Then initiate PSE payment with user details
|
|
64
|
+
* const result = await bloque.swap.pse.initiatePayment({
|
|
65
|
+
* paymentUrn: topUp.payment.urn,
|
|
66
|
+
* payee: {
|
|
67
|
+
* name: 'Juan Pérez García',
|
|
68
|
+
* email: 'juan.perez@example.com',
|
|
69
|
+
* idType: 'CC',
|
|
70
|
+
* idNumber: '1055228746',
|
|
71
|
+
* },
|
|
72
|
+
* personType: 'natural',
|
|
73
|
+
* bankCode: '1',
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Redirect user to PSE
|
|
77
|
+
* window.location.href = result.checkoutUrl;
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
initiatePayment(params: InitiatePsePaymentParams): Promise<InitiatePsePaymentResult>;
|
|
26
81
|
/**
|
|
27
82
|
* Maps API bank response to SDK format
|
|
28
83
|
* @internal
|
|
29
84
|
*/
|
|
30
85
|
private _mapBankResponse;
|
|
86
|
+
/**
|
|
87
|
+
* Maps API payment response to SDK format
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
private _mapPaymentResponse;
|
|
91
|
+
/**
|
|
92
|
+
* Maps API payment item response to SDK format
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
private _mapPaymentItemResponse;
|
|
31
96
|
}
|
package/dist/pse/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type Currency = 'DUSD/6' | 'COP/2' | 'KSM/12';
|
|
1
2
|
export interface Bank {
|
|
2
3
|
/**
|
|
3
4
|
* Financial institution code
|
|
@@ -11,3 +12,218 @@ export interface Bank {
|
|
|
11
12
|
export interface ListBanksResult {
|
|
12
13
|
banks: Bank[];
|
|
13
14
|
}
|
|
15
|
+
export interface CreateTopUpParams {
|
|
16
|
+
/**
|
|
17
|
+
* Top-up amount as string (scaled by currency precision)
|
|
18
|
+
*/
|
|
19
|
+
amount: string;
|
|
20
|
+
/**
|
|
21
|
+
* Currency with precision (e.g., "DUSD/6")
|
|
22
|
+
*/
|
|
23
|
+
currency: Currency;
|
|
24
|
+
/**
|
|
25
|
+
* URL to redirect on successful payment
|
|
26
|
+
*/
|
|
27
|
+
successUrl?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Webhook URL for payment notifications
|
|
30
|
+
*/
|
|
31
|
+
webhookUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PaymentItemResult {
|
|
34
|
+
/**
|
|
35
|
+
* Item name
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Item amount (as number)
|
|
40
|
+
*/
|
|
41
|
+
amount: number;
|
|
42
|
+
/**
|
|
43
|
+
* Stock keeping unit identifier
|
|
44
|
+
*/
|
|
45
|
+
sku?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Item description
|
|
48
|
+
*/
|
|
49
|
+
description?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Item quantity
|
|
52
|
+
*/
|
|
53
|
+
quantity: number;
|
|
54
|
+
/**
|
|
55
|
+
* URL to item image
|
|
56
|
+
*/
|
|
57
|
+
imageUrl?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface PaymentSummary {
|
|
60
|
+
/**
|
|
61
|
+
* Payment status
|
|
62
|
+
*/
|
|
63
|
+
status: string;
|
|
64
|
+
}
|
|
65
|
+
export interface Payment {
|
|
66
|
+
/**
|
|
67
|
+
* Payment URN identifier
|
|
68
|
+
*/
|
|
69
|
+
urn: string;
|
|
70
|
+
/**
|
|
71
|
+
* Owner URN
|
|
72
|
+
*/
|
|
73
|
+
ownerUrn: string;
|
|
74
|
+
/**
|
|
75
|
+
* Payment name/title
|
|
76
|
+
*/
|
|
77
|
+
name: string;
|
|
78
|
+
/**
|
|
79
|
+
* Payment description
|
|
80
|
+
*/
|
|
81
|
+
description?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Currency with precision
|
|
84
|
+
*/
|
|
85
|
+
currency: Currency;
|
|
86
|
+
/**
|
|
87
|
+
* Total amount
|
|
88
|
+
*/
|
|
89
|
+
amount: number;
|
|
90
|
+
/**
|
|
91
|
+
* Hosted payment URL
|
|
92
|
+
*/
|
|
93
|
+
url: string;
|
|
94
|
+
/**
|
|
95
|
+
* Success redirect URL
|
|
96
|
+
*/
|
|
97
|
+
successUrl?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Cancel redirect URL
|
|
100
|
+
*/
|
|
101
|
+
cancelUrl?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Payment image URL
|
|
104
|
+
*/
|
|
105
|
+
imageUrl?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Additional metadata
|
|
108
|
+
*/
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Tax amount
|
|
112
|
+
*/
|
|
113
|
+
tax?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Applied discount code
|
|
116
|
+
*/
|
|
117
|
+
discountCode?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Webhook URL
|
|
120
|
+
*/
|
|
121
|
+
webhookUrl?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Payout route configuration
|
|
124
|
+
*/
|
|
125
|
+
payoutRoute: unknown[];
|
|
126
|
+
/**
|
|
127
|
+
* Payment summary
|
|
128
|
+
*/
|
|
129
|
+
summary: PaymentSummary;
|
|
130
|
+
/**
|
|
131
|
+
* Expiration date
|
|
132
|
+
*/
|
|
133
|
+
expiresAt?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Creation timestamp
|
|
136
|
+
*/
|
|
137
|
+
createdAt: string;
|
|
138
|
+
/**
|
|
139
|
+
* Last update timestamp
|
|
140
|
+
*/
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
/**
|
|
143
|
+
* Payment type
|
|
144
|
+
*/
|
|
145
|
+
paymentType: string;
|
|
146
|
+
/**
|
|
147
|
+
* Payment items
|
|
148
|
+
*/
|
|
149
|
+
items: PaymentItemResult[];
|
|
150
|
+
}
|
|
151
|
+
export interface CreateTopUpResult {
|
|
152
|
+
payment: Payment;
|
|
153
|
+
}
|
|
154
|
+
export interface PsePayee {
|
|
155
|
+
/**
|
|
156
|
+
* Full name of the payee
|
|
157
|
+
*/
|
|
158
|
+
name: string;
|
|
159
|
+
/**
|
|
160
|
+
* Email address
|
|
161
|
+
*/
|
|
162
|
+
email: string;
|
|
163
|
+
/**
|
|
164
|
+
* ID document type (e.g., "CC" for Cédula de Ciudadanía)
|
|
165
|
+
*/
|
|
166
|
+
idType: string;
|
|
167
|
+
/**
|
|
168
|
+
* ID document number
|
|
169
|
+
*/
|
|
170
|
+
idNumber: string;
|
|
171
|
+
}
|
|
172
|
+
export type PersonType = 'natural' | 'juridica';
|
|
173
|
+
export interface InitiatePsePaymentParams {
|
|
174
|
+
/**
|
|
175
|
+
* Payment URN from createTopUp
|
|
176
|
+
*/
|
|
177
|
+
paymentUrn: string;
|
|
178
|
+
/**
|
|
179
|
+
* Payee information
|
|
180
|
+
*/
|
|
181
|
+
payee: PsePayee;
|
|
182
|
+
/**
|
|
183
|
+
* Person type (natural or juridica)
|
|
184
|
+
*/
|
|
185
|
+
personType: PersonType;
|
|
186
|
+
/**
|
|
187
|
+
* Bank code from banks list
|
|
188
|
+
*/
|
|
189
|
+
bankCode: string;
|
|
190
|
+
}
|
|
191
|
+
export interface InitiatePsePaymentResult {
|
|
192
|
+
/**
|
|
193
|
+
* Payment ID
|
|
194
|
+
*/
|
|
195
|
+
paymentId: string;
|
|
196
|
+
/**
|
|
197
|
+
* Payment status
|
|
198
|
+
*/
|
|
199
|
+
status: string;
|
|
200
|
+
/**
|
|
201
|
+
* Status message
|
|
202
|
+
*/
|
|
203
|
+
message: string;
|
|
204
|
+
/**
|
|
205
|
+
* Payment amount
|
|
206
|
+
*/
|
|
207
|
+
amount: string;
|
|
208
|
+
/**
|
|
209
|
+
* Currency
|
|
210
|
+
*/
|
|
211
|
+
currency: Currency;
|
|
212
|
+
/**
|
|
213
|
+
* PSE checkout URL to redirect the user
|
|
214
|
+
*/
|
|
215
|
+
checkoutUrl: string;
|
|
216
|
+
/**
|
|
217
|
+
* Order ID
|
|
218
|
+
*/
|
|
219
|
+
orderId: string;
|
|
220
|
+
/**
|
|
221
|
+
* Order status
|
|
222
|
+
*/
|
|
223
|
+
orderStatus: string;
|
|
224
|
+
/**
|
|
225
|
+
* Creation timestamp
|
|
226
|
+
*/
|
|
227
|
+
createdAt: string;
|
|
228
|
+
}
|
|
229
|
+
export {};
|