@paykit-sdk/comgate 1.0.0
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/README.md +199 -0
- package/dist/comgate-provider.d.mts +50 -0
- package/dist/comgate-provider.d.ts +50 -0
- package/dist/comgate-provider.js +4473 -0
- package/dist/comgate-provider.mjs +4471 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4490 -0
- package/dist/index.mjs +4487 -0
- package/dist/schema.d.mts +265 -0
- package/dist/schema.d.ts +265 -0
- package/dist/schema.js +2 -0
- package/dist/schema.mjs +1 -0
- package/dist/utils/mapper.d.mts +7 -0
- package/dist/utils/mapper.d.ts +7 -0
- package/dist/utils/mapper.js +39 -0
- package/dist/utils/mapper.mjs +36 -0
- package/package.json +37 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
interface ComgateWebhookResponse {
|
|
2
|
+
/**
|
|
3
|
+
* The transaction ID
|
|
4
|
+
*/
|
|
5
|
+
transId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The merchant ID
|
|
8
|
+
*/
|
|
9
|
+
merchant: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the transaction is in test mode
|
|
12
|
+
*/
|
|
13
|
+
test: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The price
|
|
16
|
+
*/
|
|
17
|
+
price: number;
|
|
18
|
+
/**
|
|
19
|
+
* The currency of the payment
|
|
20
|
+
*/
|
|
21
|
+
curr: string;
|
|
22
|
+
/**
|
|
23
|
+
* The label of the payment
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
/**
|
|
27
|
+
* The reference ID
|
|
28
|
+
*/
|
|
29
|
+
refId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The payer ID
|
|
32
|
+
*/
|
|
33
|
+
payerId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The payer name
|
|
36
|
+
*/
|
|
37
|
+
payerName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The payer account of the payment
|
|
40
|
+
*/
|
|
41
|
+
payerAcc?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The method of the payment
|
|
44
|
+
*/
|
|
45
|
+
method?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The account of the payment
|
|
48
|
+
*/
|
|
49
|
+
account?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The email of the payment
|
|
52
|
+
*/
|
|
53
|
+
email: string;
|
|
54
|
+
/**
|
|
55
|
+
* The phone of the payment
|
|
56
|
+
*/
|
|
57
|
+
phone?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The name of the payment
|
|
60
|
+
*/
|
|
61
|
+
name?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The secret of the payment
|
|
64
|
+
*/
|
|
65
|
+
secret: string;
|
|
66
|
+
/**
|
|
67
|
+
* The status of the payment
|
|
68
|
+
*/
|
|
69
|
+
status: 'PAID' | 'CANCELLED' | 'AUTHORIZED';
|
|
70
|
+
/**
|
|
71
|
+
* The fee of the payment
|
|
72
|
+
*/
|
|
73
|
+
fee?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The full name of the payment
|
|
76
|
+
*/
|
|
77
|
+
fullName: string;
|
|
78
|
+
/**
|
|
79
|
+
* The billing address city of the payment
|
|
80
|
+
*/
|
|
81
|
+
billingAddrCity?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The billing address street of the payment
|
|
84
|
+
*/
|
|
85
|
+
billingAddrStreet?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The billing address postal code of the payment
|
|
88
|
+
*/
|
|
89
|
+
billingAddrPostalCode?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The billing address country of the payment
|
|
92
|
+
*/
|
|
93
|
+
billingAddrCountry?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The delivery of the payment
|
|
96
|
+
*/
|
|
97
|
+
delivery?: 'HOME_DELIVERY' | 'PICKUP' | 'ELECTRONIC_DELIVERY';
|
|
98
|
+
/**
|
|
99
|
+
* The home delivery city of the payment
|
|
100
|
+
*/
|
|
101
|
+
homeDeliveryCity?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The home delivery street of the payment
|
|
104
|
+
*/
|
|
105
|
+
homeDeliveryStreet?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The home delivery postal code of the payment
|
|
108
|
+
*/
|
|
109
|
+
homeDeliveryPostalCode?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The home delivery country of the payment
|
|
112
|
+
*/
|
|
113
|
+
homeDeliveryCountry?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The category of the payment
|
|
116
|
+
*/
|
|
117
|
+
category?: 'PHYSICAL_GOODS_ONLY' | 'OTHER';
|
|
118
|
+
/**
|
|
119
|
+
* The applied fee of the payment
|
|
120
|
+
*/
|
|
121
|
+
appliedFee?: number;
|
|
122
|
+
/**
|
|
123
|
+
* The applied fee type of the payment
|
|
124
|
+
*/
|
|
125
|
+
appliedFeeType?: 'EU_UNREGULATED' | 'NON_EU_BUSINESS' | 'NON_EU_CONSUMER' | 'EU_CONSUMER';
|
|
126
|
+
}
|
|
127
|
+
interface ComgateWebhookStatusResponseBase {
|
|
128
|
+
/**
|
|
129
|
+
* The code of the response
|
|
130
|
+
*/
|
|
131
|
+
code: 0 | 1100 | 1200 | 1400 | 1500;
|
|
132
|
+
message: string;
|
|
133
|
+
}
|
|
134
|
+
interface ComgateWebhookStatusSuccessResponse extends ComgateWebhookStatusResponseBase {
|
|
135
|
+
/**
|
|
136
|
+
* The code of the response
|
|
137
|
+
*/
|
|
138
|
+
code: 0;
|
|
139
|
+
/**
|
|
140
|
+
* The merchant of the response
|
|
141
|
+
*/
|
|
142
|
+
merchant: string;
|
|
143
|
+
/**
|
|
144
|
+
* String value of `true` or `false`
|
|
145
|
+
*/
|
|
146
|
+
test: string;
|
|
147
|
+
/**
|
|
148
|
+
* Price of the product in cents or pennies
|
|
149
|
+
*/
|
|
150
|
+
price: number;
|
|
151
|
+
/**
|
|
152
|
+
* Currency code according to ISO 4217
|
|
153
|
+
*/
|
|
154
|
+
curr: string;
|
|
155
|
+
/**
|
|
156
|
+
* The label of the product
|
|
157
|
+
*/
|
|
158
|
+
label: string;
|
|
159
|
+
/**
|
|
160
|
+
* The reference ID of the product
|
|
161
|
+
*/
|
|
162
|
+
refId: string;
|
|
163
|
+
/**
|
|
164
|
+
* The payer ID of the product
|
|
165
|
+
*/
|
|
166
|
+
payerId?: string;
|
|
167
|
+
/**
|
|
168
|
+
* The method of the product
|
|
169
|
+
*/
|
|
170
|
+
method?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The account of the product
|
|
173
|
+
*/
|
|
174
|
+
account?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Payer's contact e-mail
|
|
177
|
+
*/
|
|
178
|
+
email: string;
|
|
179
|
+
/**
|
|
180
|
+
* The name of the product
|
|
181
|
+
*/
|
|
182
|
+
name?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The phone of the product
|
|
185
|
+
*/
|
|
186
|
+
phone?: string;
|
|
187
|
+
/**
|
|
188
|
+
* The transaction ID of the product
|
|
189
|
+
*/
|
|
190
|
+
transId: string;
|
|
191
|
+
/**
|
|
192
|
+
* The secret of the product
|
|
193
|
+
*/
|
|
194
|
+
secret: string;
|
|
195
|
+
/**
|
|
196
|
+
* The status of the product
|
|
197
|
+
*/
|
|
198
|
+
status: 'PAID' | 'CANCELLED' | 'AUTHORIZED' | 'PENDING';
|
|
199
|
+
/**
|
|
200
|
+
* The payer name of the product
|
|
201
|
+
*/
|
|
202
|
+
payerName?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The payer account of the product
|
|
205
|
+
*/
|
|
206
|
+
payerAcc?: string;
|
|
207
|
+
/**
|
|
208
|
+
* The fee of the product
|
|
209
|
+
*/
|
|
210
|
+
fee?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The vs of the product
|
|
213
|
+
*/
|
|
214
|
+
vs?: string;
|
|
215
|
+
/**
|
|
216
|
+
* The card valid of the product
|
|
217
|
+
*/
|
|
218
|
+
cardValid?: string;
|
|
219
|
+
/**
|
|
220
|
+
* The card number of the product
|
|
221
|
+
*/
|
|
222
|
+
cardNumber?: string;
|
|
223
|
+
/**
|
|
224
|
+
* The applied fee of the product
|
|
225
|
+
*/
|
|
226
|
+
appliedFee?: number;
|
|
227
|
+
/**
|
|
228
|
+
* The applied fee type of the product
|
|
229
|
+
*/
|
|
230
|
+
appliedFeeType?: 'EU_UNREGULATED' | 'NON_EU_BUSINESS' | 'NON_EU_CONSUMER' | 'EU_CONSUMER';
|
|
231
|
+
/**
|
|
232
|
+
* The payment error reason of the product
|
|
233
|
+
*/
|
|
234
|
+
paymentErrorReason?: string;
|
|
235
|
+
}
|
|
236
|
+
interface ComgateRefundResponse {
|
|
237
|
+
/**
|
|
238
|
+
* The code of the response
|
|
239
|
+
*/
|
|
240
|
+
code: 0;
|
|
241
|
+
/**
|
|
242
|
+
* The message of the response
|
|
243
|
+
*/
|
|
244
|
+
message: string;
|
|
245
|
+
}
|
|
246
|
+
interface ComgatePaymentOperationResponse {
|
|
247
|
+
/**
|
|
248
|
+
* The code of the response
|
|
249
|
+
*/
|
|
250
|
+
code: number;
|
|
251
|
+
/**
|
|
252
|
+
* The message of the response
|
|
253
|
+
*/
|
|
254
|
+
message: string;
|
|
255
|
+
/**
|
|
256
|
+
* The transaction ID of the response
|
|
257
|
+
*/
|
|
258
|
+
transId?: string;
|
|
259
|
+
/**
|
|
260
|
+
* The redirect of the response
|
|
261
|
+
*/
|
|
262
|
+
redirect?: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export type { ComgatePaymentOperationResponse, ComgateRefundResponse, ComgateWebhookResponse, ComgateWebhookStatusResponseBase, ComgateWebhookStatusSuccessResponse };
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
interface ComgateWebhookResponse {
|
|
2
|
+
/**
|
|
3
|
+
* The transaction ID
|
|
4
|
+
*/
|
|
5
|
+
transId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The merchant ID
|
|
8
|
+
*/
|
|
9
|
+
merchant: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the transaction is in test mode
|
|
12
|
+
*/
|
|
13
|
+
test: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The price
|
|
16
|
+
*/
|
|
17
|
+
price: number;
|
|
18
|
+
/**
|
|
19
|
+
* The currency of the payment
|
|
20
|
+
*/
|
|
21
|
+
curr: string;
|
|
22
|
+
/**
|
|
23
|
+
* The label of the payment
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
/**
|
|
27
|
+
* The reference ID
|
|
28
|
+
*/
|
|
29
|
+
refId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The payer ID
|
|
32
|
+
*/
|
|
33
|
+
payerId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The payer name
|
|
36
|
+
*/
|
|
37
|
+
payerName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The payer account of the payment
|
|
40
|
+
*/
|
|
41
|
+
payerAcc?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The method of the payment
|
|
44
|
+
*/
|
|
45
|
+
method?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The account of the payment
|
|
48
|
+
*/
|
|
49
|
+
account?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The email of the payment
|
|
52
|
+
*/
|
|
53
|
+
email: string;
|
|
54
|
+
/**
|
|
55
|
+
* The phone of the payment
|
|
56
|
+
*/
|
|
57
|
+
phone?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The name of the payment
|
|
60
|
+
*/
|
|
61
|
+
name?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The secret of the payment
|
|
64
|
+
*/
|
|
65
|
+
secret: string;
|
|
66
|
+
/**
|
|
67
|
+
* The status of the payment
|
|
68
|
+
*/
|
|
69
|
+
status: 'PAID' | 'CANCELLED' | 'AUTHORIZED';
|
|
70
|
+
/**
|
|
71
|
+
* The fee of the payment
|
|
72
|
+
*/
|
|
73
|
+
fee?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The full name of the payment
|
|
76
|
+
*/
|
|
77
|
+
fullName: string;
|
|
78
|
+
/**
|
|
79
|
+
* The billing address city of the payment
|
|
80
|
+
*/
|
|
81
|
+
billingAddrCity?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The billing address street of the payment
|
|
84
|
+
*/
|
|
85
|
+
billingAddrStreet?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The billing address postal code of the payment
|
|
88
|
+
*/
|
|
89
|
+
billingAddrPostalCode?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The billing address country of the payment
|
|
92
|
+
*/
|
|
93
|
+
billingAddrCountry?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The delivery of the payment
|
|
96
|
+
*/
|
|
97
|
+
delivery?: 'HOME_DELIVERY' | 'PICKUP' | 'ELECTRONIC_DELIVERY';
|
|
98
|
+
/**
|
|
99
|
+
* The home delivery city of the payment
|
|
100
|
+
*/
|
|
101
|
+
homeDeliveryCity?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The home delivery street of the payment
|
|
104
|
+
*/
|
|
105
|
+
homeDeliveryStreet?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The home delivery postal code of the payment
|
|
108
|
+
*/
|
|
109
|
+
homeDeliveryPostalCode?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The home delivery country of the payment
|
|
112
|
+
*/
|
|
113
|
+
homeDeliveryCountry?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The category of the payment
|
|
116
|
+
*/
|
|
117
|
+
category?: 'PHYSICAL_GOODS_ONLY' | 'OTHER';
|
|
118
|
+
/**
|
|
119
|
+
* The applied fee of the payment
|
|
120
|
+
*/
|
|
121
|
+
appliedFee?: number;
|
|
122
|
+
/**
|
|
123
|
+
* The applied fee type of the payment
|
|
124
|
+
*/
|
|
125
|
+
appliedFeeType?: 'EU_UNREGULATED' | 'NON_EU_BUSINESS' | 'NON_EU_CONSUMER' | 'EU_CONSUMER';
|
|
126
|
+
}
|
|
127
|
+
interface ComgateWebhookStatusResponseBase {
|
|
128
|
+
/**
|
|
129
|
+
* The code of the response
|
|
130
|
+
*/
|
|
131
|
+
code: 0 | 1100 | 1200 | 1400 | 1500;
|
|
132
|
+
message: string;
|
|
133
|
+
}
|
|
134
|
+
interface ComgateWebhookStatusSuccessResponse extends ComgateWebhookStatusResponseBase {
|
|
135
|
+
/**
|
|
136
|
+
* The code of the response
|
|
137
|
+
*/
|
|
138
|
+
code: 0;
|
|
139
|
+
/**
|
|
140
|
+
* The merchant of the response
|
|
141
|
+
*/
|
|
142
|
+
merchant: string;
|
|
143
|
+
/**
|
|
144
|
+
* String value of `true` or `false`
|
|
145
|
+
*/
|
|
146
|
+
test: string;
|
|
147
|
+
/**
|
|
148
|
+
* Price of the product in cents or pennies
|
|
149
|
+
*/
|
|
150
|
+
price: number;
|
|
151
|
+
/**
|
|
152
|
+
* Currency code according to ISO 4217
|
|
153
|
+
*/
|
|
154
|
+
curr: string;
|
|
155
|
+
/**
|
|
156
|
+
* The label of the product
|
|
157
|
+
*/
|
|
158
|
+
label: string;
|
|
159
|
+
/**
|
|
160
|
+
* The reference ID of the product
|
|
161
|
+
*/
|
|
162
|
+
refId: string;
|
|
163
|
+
/**
|
|
164
|
+
* The payer ID of the product
|
|
165
|
+
*/
|
|
166
|
+
payerId?: string;
|
|
167
|
+
/**
|
|
168
|
+
* The method of the product
|
|
169
|
+
*/
|
|
170
|
+
method?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The account of the product
|
|
173
|
+
*/
|
|
174
|
+
account?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Payer's contact e-mail
|
|
177
|
+
*/
|
|
178
|
+
email: string;
|
|
179
|
+
/**
|
|
180
|
+
* The name of the product
|
|
181
|
+
*/
|
|
182
|
+
name?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The phone of the product
|
|
185
|
+
*/
|
|
186
|
+
phone?: string;
|
|
187
|
+
/**
|
|
188
|
+
* The transaction ID of the product
|
|
189
|
+
*/
|
|
190
|
+
transId: string;
|
|
191
|
+
/**
|
|
192
|
+
* The secret of the product
|
|
193
|
+
*/
|
|
194
|
+
secret: string;
|
|
195
|
+
/**
|
|
196
|
+
* The status of the product
|
|
197
|
+
*/
|
|
198
|
+
status: 'PAID' | 'CANCELLED' | 'AUTHORIZED' | 'PENDING';
|
|
199
|
+
/**
|
|
200
|
+
* The payer name of the product
|
|
201
|
+
*/
|
|
202
|
+
payerName?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The payer account of the product
|
|
205
|
+
*/
|
|
206
|
+
payerAcc?: string;
|
|
207
|
+
/**
|
|
208
|
+
* The fee of the product
|
|
209
|
+
*/
|
|
210
|
+
fee?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The vs of the product
|
|
213
|
+
*/
|
|
214
|
+
vs?: string;
|
|
215
|
+
/**
|
|
216
|
+
* The card valid of the product
|
|
217
|
+
*/
|
|
218
|
+
cardValid?: string;
|
|
219
|
+
/**
|
|
220
|
+
* The card number of the product
|
|
221
|
+
*/
|
|
222
|
+
cardNumber?: string;
|
|
223
|
+
/**
|
|
224
|
+
* The applied fee of the product
|
|
225
|
+
*/
|
|
226
|
+
appliedFee?: number;
|
|
227
|
+
/**
|
|
228
|
+
* The applied fee type of the product
|
|
229
|
+
*/
|
|
230
|
+
appliedFeeType?: 'EU_UNREGULATED' | 'NON_EU_BUSINESS' | 'NON_EU_CONSUMER' | 'EU_CONSUMER';
|
|
231
|
+
/**
|
|
232
|
+
* The payment error reason of the product
|
|
233
|
+
*/
|
|
234
|
+
paymentErrorReason?: string;
|
|
235
|
+
}
|
|
236
|
+
interface ComgateRefundResponse {
|
|
237
|
+
/**
|
|
238
|
+
* The code of the response
|
|
239
|
+
*/
|
|
240
|
+
code: 0;
|
|
241
|
+
/**
|
|
242
|
+
* The message of the response
|
|
243
|
+
*/
|
|
244
|
+
message: string;
|
|
245
|
+
}
|
|
246
|
+
interface ComgatePaymentOperationResponse {
|
|
247
|
+
/**
|
|
248
|
+
* The code of the response
|
|
249
|
+
*/
|
|
250
|
+
code: number;
|
|
251
|
+
/**
|
|
252
|
+
* The message of the response
|
|
253
|
+
*/
|
|
254
|
+
message: string;
|
|
255
|
+
/**
|
|
256
|
+
* The transaction ID of the response
|
|
257
|
+
*/
|
|
258
|
+
transId?: string;
|
|
259
|
+
/**
|
|
260
|
+
* The redirect of the response
|
|
261
|
+
*/
|
|
262
|
+
redirect?: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export type { ComgatePaymentOperationResponse, ComgateRefundResponse, ComgateWebhookResponse, ComgateWebhookStatusResponseBase, ComgateWebhookStatusSuccessResponse };
|
package/dist/schema.js
ADDED
package/dist/schema.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Payment, Invoice } from '@paykit-sdk/core';
|
|
2
|
+
import { ComgateWebhookStatusSuccessResponse } from '../schema.mjs';
|
|
3
|
+
|
|
4
|
+
declare const paykitPayment$InboundSchema: (webhookResponse: ComgateWebhookStatusSuccessResponse, status: Payment["status"]) => Payment;
|
|
5
|
+
declare const paykitInvoice$InboundSchema: (webhookResponse: ComgateWebhookStatusSuccessResponse) => Invoice;
|
|
6
|
+
|
|
7
|
+
export { paykitInvoice$InboundSchema, paykitPayment$InboundSchema };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Payment, Invoice } from '@paykit-sdk/core';
|
|
2
|
+
import { ComgateWebhookStatusSuccessResponse } from '../schema.js';
|
|
3
|
+
|
|
4
|
+
declare const paykitPayment$InboundSchema: (webhookResponse: ComgateWebhookStatusSuccessResponse, status: Payment["status"]) => Payment;
|
|
5
|
+
declare const paykitInvoice$InboundSchema: (webhookResponse: ComgateWebhookStatusSuccessResponse) => Invoice;
|
|
6
|
+
|
|
7
|
+
export { paykitInvoice$InboundSchema, paykitPayment$InboundSchema };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@paykit-sdk/core');
|
|
4
|
+
|
|
5
|
+
// src/utils/mapper.ts
|
|
6
|
+
var paykitPayment$InboundSchema = (webhookResponse, status) => {
|
|
7
|
+
return {
|
|
8
|
+
id: webhookResponse.transId,
|
|
9
|
+
amount: webhookResponse.price,
|
|
10
|
+
currency: webhookResponse.curr,
|
|
11
|
+
customer: webhookResponse.payerId ?? { email: webhookResponse.email },
|
|
12
|
+
status,
|
|
13
|
+
metadata: core.omitInternalMetadata(JSON.parse(webhookResponse.refId)),
|
|
14
|
+
product_id: null
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
var paykitInvoice$InboundSchema = (webhookResponse) => {
|
|
18
|
+
const status = (() => {
|
|
19
|
+
if (webhookResponse.status == "PAID") return "paid";
|
|
20
|
+
return "open";
|
|
21
|
+
})();
|
|
22
|
+
return {
|
|
23
|
+
id: webhookResponse.transId,
|
|
24
|
+
status,
|
|
25
|
+
paid_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
26
|
+
amount_paid: webhookResponse.price,
|
|
27
|
+
currency: webhookResponse.curr,
|
|
28
|
+
customer: webhookResponse.payerId ?? { email: webhookResponse.email },
|
|
29
|
+
custom_fields: null,
|
|
30
|
+
subscription_id: null,
|
|
31
|
+
billing_mode: "one_time",
|
|
32
|
+
// comgate does not support recurring payments
|
|
33
|
+
line_items: webhookResponse.name ? [{ id: webhookResponse.name, quantity: 1 }] : [],
|
|
34
|
+
metadata: core.omitInternalMetadata(JSON.parse(webhookResponse.refId))
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.paykitInvoice$InboundSchema = paykitInvoice$InboundSchema;
|
|
39
|
+
exports.paykitPayment$InboundSchema = paykitPayment$InboundSchema;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { omitInternalMetadata } from '@paykit-sdk/core';
|
|
2
|
+
|
|
3
|
+
// src/utils/mapper.ts
|
|
4
|
+
var paykitPayment$InboundSchema = (webhookResponse, status) => {
|
|
5
|
+
return {
|
|
6
|
+
id: webhookResponse.transId,
|
|
7
|
+
amount: webhookResponse.price,
|
|
8
|
+
currency: webhookResponse.curr,
|
|
9
|
+
customer: webhookResponse.payerId ?? { email: webhookResponse.email },
|
|
10
|
+
status,
|
|
11
|
+
metadata: omitInternalMetadata(JSON.parse(webhookResponse.refId)),
|
|
12
|
+
product_id: null
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var paykitInvoice$InboundSchema = (webhookResponse) => {
|
|
16
|
+
const status = (() => {
|
|
17
|
+
if (webhookResponse.status == "PAID") return "paid";
|
|
18
|
+
return "open";
|
|
19
|
+
})();
|
|
20
|
+
return {
|
|
21
|
+
id: webhookResponse.transId,
|
|
22
|
+
status,
|
|
23
|
+
paid_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
+
amount_paid: webhookResponse.price,
|
|
25
|
+
currency: webhookResponse.curr,
|
|
26
|
+
customer: webhookResponse.payerId ?? { email: webhookResponse.email },
|
|
27
|
+
custom_fields: null,
|
|
28
|
+
subscription_id: null,
|
|
29
|
+
billing_mode: "one_time",
|
|
30
|
+
// comgate does not support recurring payments
|
|
31
|
+
line_items: webhookResponse.name ? [{ id: webhookResponse.name, quantity: 1 }] : [],
|
|
32
|
+
metadata: omitInternalMetadata(JSON.parse(webhookResponse.refId))
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { paykitInvoice$InboundSchema, paykitPayment$InboundSchema };
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paykit-sdk/comgate",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Comgate provider for PayKit",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsup",
|
|
13
|
+
"prepublishOnly": "rm -rf dist && npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@paykit-sdk/core": ">=1.1.9"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@paykit-sdk/core": "workspace:*",
|
|
23
|
+
"tsup": "^8.5.0",
|
|
24
|
+
"typescript": "^5.9.2",
|
|
25
|
+
"zod": "^3.24.2"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/usepaykit/paykit-sdk.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/usepaykit/paykit-sdk/issues"
|
|
36
|
+
}
|
|
37
|
+
}
|