@siamf/sslcommerz 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/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/cjs/helpers/httpCall.d.ts +5 -0
- package/dist/cjs/helpers/httpCall.js +24 -0
- package/dist/cjs/helpers/httpCall.js.map +1 -0
- package/dist/cjs/helpers/init.data.d.ts +2 -0
- package/dist/cjs/helpers/init.data.js +79 -0
- package/dist/cjs/helpers/init.data.js.map +1 -0
- package/dist/cjs/helpers/paymentController.d.ts +38 -0
- package/dist/cjs/helpers/paymentController.js +47 -0
- package/dist/cjs/helpers/paymentController.js.map +1 -0
- package/dist/cjs/helpers/types.d.ts +208 -0
- package/dist/cjs/helpers/types.js +3 -0
- package/dist/cjs/helpers/types.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/helpers/httpCall.d.ts +5 -0
- package/dist/esm/helpers/httpCall.js +20 -0
- package/dist/esm/helpers/httpCall.js.map +1 -0
- package/dist/esm/helpers/init.data.d.ts +2 -0
- package/dist/esm/helpers/init.data.js +75 -0
- package/dist/esm/helpers/init.data.js.map +1 -0
- package/dist/esm/helpers/paymentController.d.ts +38 -0
- package/dist/esm/helpers/paymentController.js +43 -0
- package/dist/esm/helpers/paymentController.js.map +1 -0
- package/dist/esm/helpers/types.d.ts +208 -0
- package/dist/esm/helpers/types.js +2 -0
- package/dist/esm/helpers/types.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2022] [@siamf/sslcommerz]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<br/>
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://res.cloudinary.com/dub0dpenl/image/upload/v1731780157/Personal%20Logo/logo-white_e6fujz.png">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://res.cloudinary.com/dub0dpenl/image/upload/v1731780152/Personal%20Logo/logo-dark_qqwrqu.png">
|
|
5
|
+
<img alt="Siam Ahnaf" src="https://res.cloudinary.com/dub0dpenl/image/upload/v1731780152/Personal%20Logo/logo-dark_qqwrqu.png" height="auto" width="240">
|
|
6
|
+
</picture>
|
|
7
|
+
<br/> <br/>
|
|
8
|
+
|
|
9
|
+
# @siamf/sslcommerz
|
|
10
|
+
A well-maintained, unofficial Node.js package for integrating SSLCommerz payments. Provides reliable support for initiating and handling transactions with minimal setup.
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
```javascript
|
|
14
|
+
npm i @siamf/sslcommerz
|
|
15
|
+
pnpm i @siamf/sslcommerz
|
|
16
|
+
yarn add @siamf/sslcommerz
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# Usage
|
|
20
|
+
```javascript
|
|
21
|
+
import { SslCommerz } from "@/package";
|
|
22
|
+
|
|
23
|
+
const store_id = "<store_id>"
|
|
24
|
+
const store_passwd = "<store_password>"
|
|
25
|
+
const is_live = false;
|
|
26
|
+
export const sslcz = new SslCommerz(store_id, store_passwd, is_live);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
const data = {
|
|
31
|
+
total_amount: 100,
|
|
32
|
+
currency: 'EUR',
|
|
33
|
+
tran_id: 'REF123',
|
|
34
|
+
success_url: 'http://yoursite.com/success',
|
|
35
|
+
fail_url: 'http://yoursite.com/fail',
|
|
36
|
+
cancel_url: 'http://yoursite.com/cancel',
|
|
37
|
+
ipn_url: 'http://yoursite.com/ipn',
|
|
38
|
+
shipping_method: 'Courier',
|
|
39
|
+
product_name: 'Computer.',
|
|
40
|
+
product_category: 'Electronic',
|
|
41
|
+
product_profile: 'general',
|
|
42
|
+
cus_name: 'Customer Name',
|
|
43
|
+
cus_email: 'cust@yahoo.com',
|
|
44
|
+
cus_add1: 'Dhaka',
|
|
45
|
+
cus_add2: 'Dhaka',
|
|
46
|
+
cus_city: 'Dhaka',
|
|
47
|
+
cus_state: 'Dhaka',
|
|
48
|
+
cus_postcode: '1000',
|
|
49
|
+
cus_country: 'Bangladesh',
|
|
50
|
+
cus_phone: '01711111111',
|
|
51
|
+
cus_fax: '01711111111',
|
|
52
|
+
ship_name: 'Customer Name',
|
|
53
|
+
ship_add1: 'Dhaka',
|
|
54
|
+
ship_add2: 'Dhaka',
|
|
55
|
+
ship_city: 'Dhaka',
|
|
56
|
+
ship_state: 'Dhaka',
|
|
57
|
+
ship_postcode: 1000,
|
|
58
|
+
ship_country: 'Bangladesh',
|
|
59
|
+
multi_card_name: 'mastercard',
|
|
60
|
+
value_a: 'ref001_A',
|
|
61
|
+
value_b: 'ref002_B',
|
|
62
|
+
value_c: 'ref003_C',
|
|
63
|
+
value_d: 'ref004_D'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const sslResponse = await sslcz.init(data);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
const data = {
|
|
71
|
+
val_id:ADGAHHGDAKJ456454 //that you go from sslcommerz response
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const sslResponse = await sslcz.validate(data)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
const data = {
|
|
79
|
+
refund_amount:10,
|
|
80
|
+
refund_remarks: "",
|
|
81
|
+
bank_tran_id: "CB5464321445456456",
|
|
82
|
+
refe_id: "EASY5645415455"
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const sslResponse = await sslcz.initiateRefund(data)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
const data = {
|
|
90
|
+
refund_ref_id: "SL4561445410"
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const sslResponse = await sslcz.refundQuery(data)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
const data = {
|
|
98
|
+
sessionkey: "AKHLAKJS5456454"
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const sslResponse = await sslcz.transactionQueryBySessionId(data);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const data = {
|
|
106
|
+
tran_id: "AKHLAKJS5456454"
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const sslResponse = await sslcz.transactionQueryByTransactionId(data);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
# Stay in touch
|
|
113
|
+
- Author - [Siam Ahnaf](https://www.siamahnaf.com/)
|
|
114
|
+
- Website - [https://www.siamahnaf.com/](https://www.siamahnaf.com/)
|
|
115
|
+
- LinkedIn - [https://www.linkedin.com/in/siamahnaf/](https://www.linkedin.com/in/siamahnaf/)
|
|
116
|
+
- Github - [https://github.com/siamahnaf](https://github.com/siamahnaf)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.httpCall = void 0;
|
|
13
|
+
const httpCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ url, method = "POST", data, }) {
|
|
14
|
+
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(method);
|
|
15
|
+
console.log(data);
|
|
16
|
+
const response = yield fetch(url, Object.assign({ method, mode: "cors", cache: "no-cache", credentials: "same-origin", redirect: "follow" }, (isBodyMethod ? { body: data } : {})));
|
|
17
|
+
if (!response.ok) {
|
|
18
|
+
const errorBody = yield response.text().catch(() => "");
|
|
19
|
+
throw new Error(`HTTP error! ${response.status} - ${errorBody}`);
|
|
20
|
+
}
|
|
21
|
+
return response.json();
|
|
22
|
+
});
|
|
23
|
+
exports.httpCall = httpCall;
|
|
24
|
+
//# sourceMappingURL=httpCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAO,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,kBAC5B,MAAM,EACN,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,QAAQ,IACf,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACzC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;AACzC,CAAC,CAAA,CAAC;AAlBW,QAAA,QAAQ,YAkBnB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentInitData = void 0;
|
|
4
|
+
const paymentInitData = (data) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const postData = {
|
|
7
|
+
// Required
|
|
8
|
+
store_id: data.store_id,
|
|
9
|
+
store_passwd: data.store_passwd,
|
|
10
|
+
tran_id: data.tran_id,
|
|
11
|
+
total_amount: data.total_amount,
|
|
12
|
+
currency: data.currency,
|
|
13
|
+
success_url: data.success_url,
|
|
14
|
+
fail_url: data.fail_url,
|
|
15
|
+
cancel_url: data.cancel_url,
|
|
16
|
+
// Optional
|
|
17
|
+
ipn_url: data.ipn_url,
|
|
18
|
+
multi_card_name: data.multi_card_name,
|
|
19
|
+
allowed_bin: data.allowed_bin,
|
|
20
|
+
// EMI
|
|
21
|
+
emi_option: data.emi_option,
|
|
22
|
+
emi_max_inst_option: data.emi_max_inst_option,
|
|
23
|
+
emi_selected_inst: data.emi_selected_inst,
|
|
24
|
+
// Customer
|
|
25
|
+
cus_name: data.cus_name,
|
|
26
|
+
cus_email: data.cus_email,
|
|
27
|
+
cus_add1: data.cus_add1,
|
|
28
|
+
cus_add2: data.cus_add2,
|
|
29
|
+
cus_city: data.cus_city,
|
|
30
|
+
cus_state: data.cus_state,
|
|
31
|
+
cus_postcode: data.cus_postcode,
|
|
32
|
+
cus_country: data.cus_country,
|
|
33
|
+
cus_phone: data.cus_phone,
|
|
34
|
+
cus_fax: data.cus_fax,
|
|
35
|
+
// Shipping
|
|
36
|
+
shipping_method: data.shipping_method,
|
|
37
|
+
num_of_item: data.num_of_item,
|
|
38
|
+
ship_name: data.ship_name,
|
|
39
|
+
shipcity: data.shipcity,
|
|
40
|
+
ship_add1: data.ship_add1,
|
|
41
|
+
ship_add2: data.ship_add2,
|
|
42
|
+
ship_city: data.ship_city,
|
|
43
|
+
ship_state: data.ship_state,
|
|
44
|
+
ship_postcode: data.ship_postcode,
|
|
45
|
+
ship_country: data.ship_country,
|
|
46
|
+
// Product
|
|
47
|
+
product_name: data.product_name,
|
|
48
|
+
product_category: data.product_category,
|
|
49
|
+
product_profile: data.product_profile,
|
|
50
|
+
hours_till_departure: data.hours_till_departure,
|
|
51
|
+
flight_type: data.flight_type,
|
|
52
|
+
pnr: data.pnr,
|
|
53
|
+
journey_from_to: data.journey_from_to,
|
|
54
|
+
third_party_booking: data.third_party_booking,
|
|
55
|
+
hotel_name: data.hotel_name,
|
|
56
|
+
length_of_stay: data.length_of_stay,
|
|
57
|
+
check_in_time: data.check_in_time,
|
|
58
|
+
hotel_city: data.hotel_city,
|
|
59
|
+
product_type: data.product_type,
|
|
60
|
+
topup_number: data.topup_number,
|
|
61
|
+
country_topup: data.country_topup,
|
|
62
|
+
cart: data.cart,
|
|
63
|
+
product_amount: data.product_amount,
|
|
64
|
+
discount_amount: data.discount_amount,
|
|
65
|
+
convenience_fee: data.convenience_fee,
|
|
66
|
+
// Custom
|
|
67
|
+
value_a: data.value_a,
|
|
68
|
+
value_b: data.value_b,
|
|
69
|
+
value_c: data.value_c,
|
|
70
|
+
value_d: data.value_d,
|
|
71
|
+
};
|
|
72
|
+
const formData = new FormData();
|
|
73
|
+
for (const key in postData) {
|
|
74
|
+
formData.append(key, (_a = postData[key]) !== null && _a !== void 0 ? _a : '');
|
|
75
|
+
}
|
|
76
|
+
return formData;
|
|
77
|
+
};
|
|
78
|
+
exports.paymentInitData = paymentInitData;
|
|
79
|
+
//# sourceMappingURL=init.data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.data.js","sourceRoot":"","sources":["../../../src/helpers/init.data.ts"],"names":[],"mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,IAAqC,EAAY,EAAE;;IAC/E,MAAM,QAAQ,GAAwB;QAClC,WAAW;QACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;QAE3B,WAAW;QAC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C,GAAG;QACb,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QAErC,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;KACxB,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAA,QAAQ,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAhFW,QAAA,eAAe,mBAgF1B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PaymentInitData, PaymentInitResponse, PaymentValidationResponse, PaymentRefundInitiateResponse, PaymentRefundQueryResponse, TransactionQuerySessionIdResponse, TransactionQueryTransIdResponse } from "./types";
|
|
2
|
+
interface ValidatePayload {
|
|
3
|
+
val_id: string;
|
|
4
|
+
}
|
|
5
|
+
interface RefundPayload {
|
|
6
|
+
refund_amount: number | string;
|
|
7
|
+
refund_remarks: string;
|
|
8
|
+
bank_tran_id: string;
|
|
9
|
+
refe_id: string;
|
|
10
|
+
}
|
|
11
|
+
interface RefundQueryPayload {
|
|
12
|
+
refund_ref_id: string;
|
|
13
|
+
}
|
|
14
|
+
interface TransactionQueryBySessionPayload {
|
|
15
|
+
sessionkey: string;
|
|
16
|
+
}
|
|
17
|
+
interface TransactionQueryByTranIdPayload {
|
|
18
|
+
tran_id: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class SslCommerz {
|
|
21
|
+
private store_id;
|
|
22
|
+
private store_passwd;
|
|
23
|
+
private baseURL;
|
|
24
|
+
private initURL;
|
|
25
|
+
private validationURL;
|
|
26
|
+
private refundURL;
|
|
27
|
+
private refundQueryURL;
|
|
28
|
+
private transactionQueryBySessionIdURL;
|
|
29
|
+
private transactionQueryByTransactionIdURL;
|
|
30
|
+
constructor(store_id: string, store_passwd: string, live?: boolean);
|
|
31
|
+
init(data: PaymentInitData): Promise<PaymentInitResponse>;
|
|
32
|
+
validate(data: ValidatePayload): Promise<PaymentValidationResponse>;
|
|
33
|
+
initiateRefund(data: RefundPayload): Promise<PaymentRefundInitiateResponse>;
|
|
34
|
+
refundQuery(data: RefundQueryPayload): Promise<PaymentRefundQueryResponse>;
|
|
35
|
+
transactionQueryBySessionId(data: TransactionQueryBySessionPayload): Promise<TransactionQuerySessionIdResponse>;
|
|
36
|
+
transactionQueryByTransactionId(data: TransactionQueryByTranIdPayload): Promise<TransactionQueryTransIdResponse>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SslCommerz = void 0;
|
|
4
|
+
const httpCall_1 = require("./httpCall");
|
|
5
|
+
const init_data_1 = require("./init.data");
|
|
6
|
+
class SslCommerz {
|
|
7
|
+
constructor(store_id, store_passwd, live = false) {
|
|
8
|
+
this.baseURL = `https://${live ? "securepay" : "sandbox"}.sslcommerz.com`;
|
|
9
|
+
this.initURL = this.baseURL + "/gwprocess/v4/api.php";
|
|
10
|
+
this.validationURL = this.baseURL + "/validator/api/validationserverAPI.php?";
|
|
11
|
+
this.refundURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
12
|
+
this.refundQueryURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
13
|
+
this.transactionQueryBySessionIdURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
14
|
+
this.transactionQueryByTransactionIdURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
15
|
+
this.store_id = store_id;
|
|
16
|
+
this.store_passwd = store_passwd;
|
|
17
|
+
}
|
|
18
|
+
init(data) {
|
|
19
|
+
return (0, httpCall_1.httpCall)({
|
|
20
|
+
url: this.initURL,
|
|
21
|
+
method: "POST",
|
|
22
|
+
data: (0, init_data_1.paymentInitData)(Object.assign(Object.assign({}, data), { store_id: this.store_id, store_passwd: this.store_passwd })),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
validate(data) {
|
|
26
|
+
const requestUrl = `${this.validationURL}val_id=${data.val_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
27
|
+
return (0, httpCall_1.httpCall)({ url: requestUrl, method: "GET" });
|
|
28
|
+
}
|
|
29
|
+
initiateRefund(data) {
|
|
30
|
+
const requestUrl = `${this.refundURL}refund_amount=${data.refund_amount}&refund_remarks=${data.refund_remarks}&bank_tran_id=${data.bank_tran_id}&refe_id=${data.refe_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
31
|
+
return (0, httpCall_1.httpCall)({ url: requestUrl, method: "GET" });
|
|
32
|
+
}
|
|
33
|
+
refundQuery(data) {
|
|
34
|
+
const requestUrl = `${this.refundQueryURL}refund_ref_id=${data.refund_ref_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
35
|
+
return (0, httpCall_1.httpCall)({ url: requestUrl, method: "GET" });
|
|
36
|
+
}
|
|
37
|
+
transactionQueryBySessionId(data) {
|
|
38
|
+
const requestUrl = `${this.transactionQueryBySessionIdURL}sessionkey=${data.sessionkey}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
39
|
+
return (0, httpCall_1.httpCall)({ url: requestUrl, method: "GET" });
|
|
40
|
+
}
|
|
41
|
+
transactionQueryByTransactionId(data) {
|
|
42
|
+
const requestUrl = `${this.transactionQueryByTransactionIdURL}tran_id=${data.tran_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
43
|
+
return (0, httpCall_1.httpCall)({ url: requestUrl, method: "GET" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.SslCommerz = SslCommerz;
|
|
47
|
+
//# sourceMappingURL=paymentController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentController.js","sourceRoot":"","sources":["../../../src/helpers/paymentController.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,2CAA8C;AA0B9C,MAAa,UAAU;IAWnB,YAAY,QAAgB,EAAE,YAAoB,EAAE,IAAI,GAAG,KAAK;QAC5D,IAAI,CAAC,OAAO,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,iBAAiB,CAAC;QAC1E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,uBAAuB,CAAC;QACtD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,GAAG,yCAAyC,CAAC;QAC9E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACnF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACxF,IAAI,CAAC,8BAA8B,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACxG,IAAI,CAA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,OAAO,IAAA,mBAAQ,EAA6B,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,2BAA2B,CAAC,IAAsC;QAC9D,MAAM,UAAU,GACZ,GAAG,IAAI,CAAC,8BAA8B,cAAc,IAAI,CAAC,UAAU,aAAa,IAAI,CAAC,QAAQ,iBAAiB,IAAI,CAAC,YAAY,kBAAkB,CAAC;QAEtJ,OAAO,IAAA,mBAAQ,EAAoC,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,+BAA+B,CAAC,IAAqC;QACjE,MAAM,UAAU,GACZ,GAAG,IAAI,CAAC,kCAAkC,WAAW,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,QAAQ,iBAAiB,IAAI,CAAC,YAAY,kBAAkB,CAAC;QAEpJ,OAAO,IAAA,mBAAQ,EAAkC,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,CAAC;CACJ;AAlED,gCAkEC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
export type PaymentInitData = RequiredPaymentFields & Partial<OptionalPaymentFields>;
|
|
2
|
+
export interface StoreIntTypes {
|
|
3
|
+
store_id: string;
|
|
4
|
+
store_passwd: string;
|
|
5
|
+
}
|
|
6
|
+
interface RequiredPaymentFields {
|
|
7
|
+
total_amount: string | number;
|
|
8
|
+
currency: string;
|
|
9
|
+
tran_id: string;
|
|
10
|
+
product_category: string;
|
|
11
|
+
success_url: string;
|
|
12
|
+
fail_url: string;
|
|
13
|
+
cancel_url: string;
|
|
14
|
+
cus_name: string;
|
|
15
|
+
cus_email: string;
|
|
16
|
+
cus_add1: string;
|
|
17
|
+
cus_city: string;
|
|
18
|
+
cus_postcode: string;
|
|
19
|
+
cus_country: string;
|
|
20
|
+
cus_phone: string;
|
|
21
|
+
shipping_method: "YES" | "NO" | "Courier";
|
|
22
|
+
num_of_item: number;
|
|
23
|
+
product_name: string;
|
|
24
|
+
product_profile: "general" | "physical-goods" | "non-physical-goods" | "airline-tickets" | "travel-vertical" | "telecom-vertical";
|
|
25
|
+
}
|
|
26
|
+
interface OptionalPaymentFields {
|
|
27
|
+
cus_state?: string;
|
|
28
|
+
ipn_url?: string;
|
|
29
|
+
multi_card_name?: string;
|
|
30
|
+
allowed_bin?: string;
|
|
31
|
+
emi_option?: number;
|
|
32
|
+
emi_max_inst_option?: number | string;
|
|
33
|
+
emi_selected_inst?: number | string;
|
|
34
|
+
cus_add2?: string;
|
|
35
|
+
cus_fax?: string;
|
|
36
|
+
ship_name?: string;
|
|
37
|
+
shipcity?: string;
|
|
38
|
+
ship_add1?: string;
|
|
39
|
+
ship_add2?: string;
|
|
40
|
+
ship_city?: string;
|
|
41
|
+
ship_state?: string;
|
|
42
|
+
ship_postcode?: string;
|
|
43
|
+
ship_country?: string;
|
|
44
|
+
hours_till_departure?: string;
|
|
45
|
+
flight_type?: string;
|
|
46
|
+
pnr?: string;
|
|
47
|
+
journey_from_to?: string;
|
|
48
|
+
third_party_booking?: string;
|
|
49
|
+
hotel_name?: string;
|
|
50
|
+
length_of_stay?: string;
|
|
51
|
+
check_in_time?: string;
|
|
52
|
+
hotel_city?: string;
|
|
53
|
+
product_type?: string;
|
|
54
|
+
topup_number?: string;
|
|
55
|
+
country_topup?: string;
|
|
56
|
+
cart?: string;
|
|
57
|
+
product_amount?: string | number;
|
|
58
|
+
discount_amount?: string | number;
|
|
59
|
+
convenience_fee?: string | number;
|
|
60
|
+
value_a?: string;
|
|
61
|
+
value_b?: string;
|
|
62
|
+
value_c?: string;
|
|
63
|
+
value_d?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface PaymentInitResponse {
|
|
66
|
+
status: "FAILED" | "SUCCESS";
|
|
67
|
+
failedreason?: string;
|
|
68
|
+
sessionkey?: string;
|
|
69
|
+
gw?: {
|
|
70
|
+
visa?: string;
|
|
71
|
+
master?: string;
|
|
72
|
+
amex?: string;
|
|
73
|
+
othercards?: string;
|
|
74
|
+
internetbanking?: string;
|
|
75
|
+
mobilebanking?: string;
|
|
76
|
+
};
|
|
77
|
+
redirectGatewayURL?: string;
|
|
78
|
+
directPaymentURLBank?: string;
|
|
79
|
+
directPaymentURLCard?: string;
|
|
80
|
+
directPaymentURL?: string;
|
|
81
|
+
redirectGatewayURLFailed?: string;
|
|
82
|
+
GatewayPageURL?: string;
|
|
83
|
+
storeBanner?: string;
|
|
84
|
+
storeLogo?: string;
|
|
85
|
+
store_name?: string;
|
|
86
|
+
desc?: any[];
|
|
87
|
+
}
|
|
88
|
+
export interface PaymentValidationResponse {
|
|
89
|
+
status: "VALID" | "VALIDATED" | "INVALID_TRANSACTION";
|
|
90
|
+
tran_date: string;
|
|
91
|
+
tran_id: string;
|
|
92
|
+
val_id: string;
|
|
93
|
+
amount: string | number;
|
|
94
|
+
store_amount: string | number;
|
|
95
|
+
currency: string;
|
|
96
|
+
bank_tran_id: string;
|
|
97
|
+
card_type: string;
|
|
98
|
+
card_no: string;
|
|
99
|
+
card_issuer: string;
|
|
100
|
+
card_brand: string;
|
|
101
|
+
card_issuer_country: string;
|
|
102
|
+
card_issuer_country_code: string;
|
|
103
|
+
currency_type: string;
|
|
104
|
+
currency_amount: string | number;
|
|
105
|
+
currency_rate: string;
|
|
106
|
+
base_fair: string;
|
|
107
|
+
value_a: string;
|
|
108
|
+
value_b: string;
|
|
109
|
+
value_c: string;
|
|
110
|
+
value_d: string;
|
|
111
|
+
emi_instalment: string;
|
|
112
|
+
emi_amount: string | number;
|
|
113
|
+
emi_description: string;
|
|
114
|
+
emi_issuer: string;
|
|
115
|
+
account_details: string;
|
|
116
|
+
risk_title: string;
|
|
117
|
+
risk_level: string;
|
|
118
|
+
APIConnect: string;
|
|
119
|
+
validated_on: string;
|
|
120
|
+
gw_version: string;
|
|
121
|
+
}
|
|
122
|
+
export interface PaymentRefundInitiateResponse {
|
|
123
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
124
|
+
bank_tran_id: string;
|
|
125
|
+
trans_id: string;
|
|
126
|
+
refund_ref_id: string;
|
|
127
|
+
status: "success" | "failed" | "processing";
|
|
128
|
+
errorReason: string;
|
|
129
|
+
}
|
|
130
|
+
export interface PaymentRefundQueryResponse {
|
|
131
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
132
|
+
bank_tran_id: string;
|
|
133
|
+
tran_id: string;
|
|
134
|
+
refund_ref_id: string;
|
|
135
|
+
initiated_on: string;
|
|
136
|
+
refunded_on: string;
|
|
137
|
+
status: "refunded" | "processing" | "cancelled";
|
|
138
|
+
errorReason: string;
|
|
139
|
+
}
|
|
140
|
+
export interface TransactionQuerySessionIdResponse {
|
|
141
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
142
|
+
status: "VALID" | "VALIDATED" | "PENDING" | "FAILED";
|
|
143
|
+
sessionkey: string;
|
|
144
|
+
tran_date: string;
|
|
145
|
+
tran_id: string;
|
|
146
|
+
val_id: string;
|
|
147
|
+
amount: string;
|
|
148
|
+
store_amount: string;
|
|
149
|
+
bank_tran_id: string;
|
|
150
|
+
card_type: string;
|
|
151
|
+
card_no: string;
|
|
152
|
+
card_issuer: string;
|
|
153
|
+
card_brand: string;
|
|
154
|
+
card_issuer_country: string;
|
|
155
|
+
card_issuer_country_code: string;
|
|
156
|
+
currency_type: string;
|
|
157
|
+
currency_amount: string;
|
|
158
|
+
currency_rate: string;
|
|
159
|
+
base_fair: string;
|
|
160
|
+
value_a: string;
|
|
161
|
+
value_b: string;
|
|
162
|
+
value_c: string;
|
|
163
|
+
value_d: string;
|
|
164
|
+
risk_title: string;
|
|
165
|
+
risk_level: string;
|
|
166
|
+
validated_on: string;
|
|
167
|
+
gw_version: string;
|
|
168
|
+
}
|
|
169
|
+
export interface TransactionQueryTransIdResponse {
|
|
170
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
171
|
+
no_of_trans_found: number;
|
|
172
|
+
element: TransactionQueryTransIdResponseArray[];
|
|
173
|
+
}
|
|
174
|
+
export interface TransactionQueryTransIdResponseArray {
|
|
175
|
+
val_id: string;
|
|
176
|
+
status: string;
|
|
177
|
+
validated_on: string;
|
|
178
|
+
currency_type: string;
|
|
179
|
+
currency_amount: string;
|
|
180
|
+
currency_rate: string;
|
|
181
|
+
base_fair: string;
|
|
182
|
+
value_a: string;
|
|
183
|
+
value_b: string;
|
|
184
|
+
value_c: string;
|
|
185
|
+
value_d: string;
|
|
186
|
+
tran_date: string;
|
|
187
|
+
tran_id: string;
|
|
188
|
+
amount: string;
|
|
189
|
+
store_amount: string;
|
|
190
|
+
bank_tran_id: string;
|
|
191
|
+
card_type: string;
|
|
192
|
+
risk_title: string;
|
|
193
|
+
risk_level: string;
|
|
194
|
+
currency: string;
|
|
195
|
+
bank_gw: string;
|
|
196
|
+
card_no: string;
|
|
197
|
+
card_issuer: string;
|
|
198
|
+
card_brand: string;
|
|
199
|
+
card_issuer_country: string;
|
|
200
|
+
card_issuer_country_code: string;
|
|
201
|
+
gw_version: string;
|
|
202
|
+
emi_instalment: string;
|
|
203
|
+
emi_amount: string;
|
|
204
|
+
emi_description: string;
|
|
205
|
+
emi_issuer: string;
|
|
206
|
+
error: string;
|
|
207
|
+
}
|
|
208
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { SslCommerz } from "./helpers/paymentController";
|
|
2
|
+
export { type PaymentInitData, PaymentInitResponse, PaymentValidationResponse, PaymentRefundInitiateResponse, PaymentRefundQueryResponse, TransactionQuerySessionIdResponse, TransactionQueryTransIdResponse, TransactionQueryTransIdResponseArray } from "./helpers/types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SslCommerz = void 0;
|
|
4
|
+
var paymentController_1 = require("./helpers/paymentController");
|
|
5
|
+
Object.defineProperty(exports, "SslCommerz", { enumerable: true, get: function () { return paymentController_1.SslCommerz; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iEAAyD;AAAhD,+GAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const httpCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ url, method = "POST", data, }) {
|
|
11
|
+
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(method);
|
|
12
|
+
console.log(data);
|
|
13
|
+
const response = yield fetch(url, Object.assign({ method, mode: "cors", cache: "no-cache", credentials: "same-origin", redirect: "follow" }, (isBodyMethod ? { body: data } : {})));
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
const errorBody = yield response.text().catch(() => "");
|
|
16
|
+
throw new Error(`HTTP error! ${response.status} - ${errorBody}`);
|
|
17
|
+
}
|
|
18
|
+
return response.json();
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=httpCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,kBAC5B,MAAM,EACN,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,QAAQ,IACf,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACzC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;AACzC,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const paymentInitData = (data) => {
|
|
2
|
+
var _a;
|
|
3
|
+
const postData = {
|
|
4
|
+
// Required
|
|
5
|
+
store_id: data.store_id,
|
|
6
|
+
store_passwd: data.store_passwd,
|
|
7
|
+
tran_id: data.tran_id,
|
|
8
|
+
total_amount: data.total_amount,
|
|
9
|
+
currency: data.currency,
|
|
10
|
+
success_url: data.success_url,
|
|
11
|
+
fail_url: data.fail_url,
|
|
12
|
+
cancel_url: data.cancel_url,
|
|
13
|
+
// Optional
|
|
14
|
+
ipn_url: data.ipn_url,
|
|
15
|
+
multi_card_name: data.multi_card_name,
|
|
16
|
+
allowed_bin: data.allowed_bin,
|
|
17
|
+
// EMI
|
|
18
|
+
emi_option: data.emi_option,
|
|
19
|
+
emi_max_inst_option: data.emi_max_inst_option,
|
|
20
|
+
emi_selected_inst: data.emi_selected_inst,
|
|
21
|
+
// Customer
|
|
22
|
+
cus_name: data.cus_name,
|
|
23
|
+
cus_email: data.cus_email,
|
|
24
|
+
cus_add1: data.cus_add1,
|
|
25
|
+
cus_add2: data.cus_add2,
|
|
26
|
+
cus_city: data.cus_city,
|
|
27
|
+
cus_state: data.cus_state,
|
|
28
|
+
cus_postcode: data.cus_postcode,
|
|
29
|
+
cus_country: data.cus_country,
|
|
30
|
+
cus_phone: data.cus_phone,
|
|
31
|
+
cus_fax: data.cus_fax,
|
|
32
|
+
// Shipping
|
|
33
|
+
shipping_method: data.shipping_method,
|
|
34
|
+
num_of_item: data.num_of_item,
|
|
35
|
+
ship_name: data.ship_name,
|
|
36
|
+
shipcity: data.shipcity,
|
|
37
|
+
ship_add1: data.ship_add1,
|
|
38
|
+
ship_add2: data.ship_add2,
|
|
39
|
+
ship_city: data.ship_city,
|
|
40
|
+
ship_state: data.ship_state,
|
|
41
|
+
ship_postcode: data.ship_postcode,
|
|
42
|
+
ship_country: data.ship_country,
|
|
43
|
+
// Product
|
|
44
|
+
product_name: data.product_name,
|
|
45
|
+
product_category: data.product_category,
|
|
46
|
+
product_profile: data.product_profile,
|
|
47
|
+
hours_till_departure: data.hours_till_departure,
|
|
48
|
+
flight_type: data.flight_type,
|
|
49
|
+
pnr: data.pnr,
|
|
50
|
+
journey_from_to: data.journey_from_to,
|
|
51
|
+
third_party_booking: data.third_party_booking,
|
|
52
|
+
hotel_name: data.hotel_name,
|
|
53
|
+
length_of_stay: data.length_of_stay,
|
|
54
|
+
check_in_time: data.check_in_time,
|
|
55
|
+
hotel_city: data.hotel_city,
|
|
56
|
+
product_type: data.product_type,
|
|
57
|
+
topup_number: data.topup_number,
|
|
58
|
+
country_topup: data.country_topup,
|
|
59
|
+
cart: data.cart,
|
|
60
|
+
product_amount: data.product_amount,
|
|
61
|
+
discount_amount: data.discount_amount,
|
|
62
|
+
convenience_fee: data.convenience_fee,
|
|
63
|
+
// Custom
|
|
64
|
+
value_a: data.value_a,
|
|
65
|
+
value_b: data.value_b,
|
|
66
|
+
value_c: data.value_c,
|
|
67
|
+
value_d: data.value_d,
|
|
68
|
+
};
|
|
69
|
+
const formData = new FormData();
|
|
70
|
+
for (const key in postData) {
|
|
71
|
+
formData.append(key, (_a = postData[key]) !== null && _a !== void 0 ? _a : '');
|
|
72
|
+
}
|
|
73
|
+
return formData;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=init.data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.data.js","sourceRoot":"","sources":["../../../src/helpers/init.data.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAqC,EAAY,EAAE;;IAC/E,MAAM,QAAQ,GAAwB;QAClC,WAAW;QACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;QAE3B,WAAW;QACX,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,WAAW,EAAE,IAAI,CAAC,WAAW;QAE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,CAAC,UAAU;QAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QAErC,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;KACxB,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAA,QAAQ,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PaymentInitData, PaymentInitResponse, PaymentValidationResponse, PaymentRefundInitiateResponse, PaymentRefundQueryResponse, TransactionQuerySessionIdResponse, TransactionQueryTransIdResponse } from "./types";
|
|
2
|
+
interface ValidatePayload {
|
|
3
|
+
val_id: string;
|
|
4
|
+
}
|
|
5
|
+
interface RefundPayload {
|
|
6
|
+
refund_amount: number | string;
|
|
7
|
+
refund_remarks: string;
|
|
8
|
+
bank_tran_id: string;
|
|
9
|
+
refe_id: string;
|
|
10
|
+
}
|
|
11
|
+
interface RefundQueryPayload {
|
|
12
|
+
refund_ref_id: string;
|
|
13
|
+
}
|
|
14
|
+
interface TransactionQueryBySessionPayload {
|
|
15
|
+
sessionkey: string;
|
|
16
|
+
}
|
|
17
|
+
interface TransactionQueryByTranIdPayload {
|
|
18
|
+
tran_id: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class SslCommerz {
|
|
21
|
+
private store_id;
|
|
22
|
+
private store_passwd;
|
|
23
|
+
private baseURL;
|
|
24
|
+
private initURL;
|
|
25
|
+
private validationURL;
|
|
26
|
+
private refundURL;
|
|
27
|
+
private refundQueryURL;
|
|
28
|
+
private transactionQueryBySessionIdURL;
|
|
29
|
+
private transactionQueryByTransactionIdURL;
|
|
30
|
+
constructor(store_id: string, store_passwd: string, live?: boolean);
|
|
31
|
+
init(data: PaymentInitData): Promise<PaymentInitResponse>;
|
|
32
|
+
validate(data: ValidatePayload): Promise<PaymentValidationResponse>;
|
|
33
|
+
initiateRefund(data: RefundPayload): Promise<PaymentRefundInitiateResponse>;
|
|
34
|
+
refundQuery(data: RefundQueryPayload): Promise<PaymentRefundQueryResponse>;
|
|
35
|
+
transactionQueryBySessionId(data: TransactionQueryBySessionPayload): Promise<TransactionQuerySessionIdResponse>;
|
|
36
|
+
transactionQueryByTransactionId(data: TransactionQueryByTranIdPayload): Promise<TransactionQueryTransIdResponse>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { httpCall } from "./httpCall";
|
|
2
|
+
import { paymentInitData } from "./init.data";
|
|
3
|
+
export class SslCommerz {
|
|
4
|
+
constructor(store_id, store_passwd, live = false) {
|
|
5
|
+
this.baseURL = `https://${live ? "securepay" : "sandbox"}.sslcommerz.com`;
|
|
6
|
+
this.initURL = this.baseURL + "/gwprocess/v4/api.php";
|
|
7
|
+
this.validationURL = this.baseURL + "/validator/api/validationserverAPI.php?";
|
|
8
|
+
this.refundURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
9
|
+
this.refundQueryURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
10
|
+
this.transactionQueryBySessionIdURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
11
|
+
this.transactionQueryByTransactionIdURL = this.baseURL + "/validator/api/merchantTransIDvalidationAPI.php?";
|
|
12
|
+
this.store_id = store_id;
|
|
13
|
+
this.store_passwd = store_passwd;
|
|
14
|
+
}
|
|
15
|
+
init(data) {
|
|
16
|
+
return httpCall({
|
|
17
|
+
url: this.initURL,
|
|
18
|
+
method: "POST",
|
|
19
|
+
data: paymentInitData(Object.assign(Object.assign({}, data), { store_id: this.store_id, store_passwd: this.store_passwd })),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
validate(data) {
|
|
23
|
+
const requestUrl = `${this.validationURL}val_id=${data.val_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
24
|
+
return httpCall({ url: requestUrl, method: "GET" });
|
|
25
|
+
}
|
|
26
|
+
initiateRefund(data) {
|
|
27
|
+
const requestUrl = `${this.refundURL}refund_amount=${data.refund_amount}&refund_remarks=${data.refund_remarks}&bank_tran_id=${data.bank_tran_id}&refe_id=${data.refe_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
28
|
+
return httpCall({ url: requestUrl, method: "GET" });
|
|
29
|
+
}
|
|
30
|
+
refundQuery(data) {
|
|
31
|
+
const requestUrl = `${this.refundQueryURL}refund_ref_id=${data.refund_ref_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
32
|
+
return httpCall({ url: requestUrl, method: "GET" });
|
|
33
|
+
}
|
|
34
|
+
transactionQueryBySessionId(data) {
|
|
35
|
+
const requestUrl = `${this.transactionQueryBySessionIdURL}sessionkey=${data.sessionkey}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
36
|
+
return httpCall({ url: requestUrl, method: "GET" });
|
|
37
|
+
}
|
|
38
|
+
transactionQueryByTransactionId(data) {
|
|
39
|
+
const requestUrl = `${this.transactionQueryByTransactionIdURL}tran_id=${data.tran_id}&store_id=${this.store_id}&store_passwd=${this.store_passwd}&v=1&format=json`;
|
|
40
|
+
return httpCall({ url: requestUrl, method: "GET" });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=paymentController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentController.js","sourceRoot":"","sources":["../../../src/helpers/paymentController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0B9C,MAAM,OAAO,UAAU;IAWnB,YAAY,QAAgB,EAAE,YAAoB,EAAE,IAAI,GAAG,KAAK;QAC5D,IAAI,CAAC,OAAO,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,iBAAiB,CAAC;QAC1E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,uBAAuB,CAAC;QACtD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,GAAG,yCAAyC,CAAC;QAC9E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACnF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACxF,IAAI,CAAC,8BAA8B,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QACxG,IAAI,CAAC,kCAAkC,GAAG,IAAI,CAAC,OAAO,GAAG,kDAAkD,CAAC;QAE5G,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,IAAqB;QACtB,OAAO,QAAQ,CAAsB;YACjC,GAAG,EAAE,IAAI,CAAC,OAAO;YACjB,MAAM,EAAE,MAAM;YACd,IAAI,EAA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EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,+BAA+B,CAAC,IAAqC;QACjE,MAAM,UAAU,GACZ,GAAG,IAAI,CAAC,kCAAkC,WAAW,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,QAAQ,iBAAiB,IAAI,CAAC,YAAY,kBAAkB,CAAC;QAEpJ,OAAO,QAAQ,CAAkC,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,CAAC;CACJ"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
export type PaymentInitData = RequiredPaymentFields & Partial<OptionalPaymentFields>;
|
|
2
|
+
export interface StoreIntTypes {
|
|
3
|
+
store_id: string;
|
|
4
|
+
store_passwd: string;
|
|
5
|
+
}
|
|
6
|
+
interface RequiredPaymentFields {
|
|
7
|
+
total_amount: string | number;
|
|
8
|
+
currency: string;
|
|
9
|
+
tran_id: string;
|
|
10
|
+
product_category: string;
|
|
11
|
+
success_url: string;
|
|
12
|
+
fail_url: string;
|
|
13
|
+
cancel_url: string;
|
|
14
|
+
cus_name: string;
|
|
15
|
+
cus_email: string;
|
|
16
|
+
cus_add1: string;
|
|
17
|
+
cus_city: string;
|
|
18
|
+
cus_postcode: string;
|
|
19
|
+
cus_country: string;
|
|
20
|
+
cus_phone: string;
|
|
21
|
+
shipping_method: "YES" | "NO" | "Courier";
|
|
22
|
+
num_of_item: number;
|
|
23
|
+
product_name: string;
|
|
24
|
+
product_profile: "general" | "physical-goods" | "non-physical-goods" | "airline-tickets" | "travel-vertical" | "telecom-vertical";
|
|
25
|
+
}
|
|
26
|
+
interface OptionalPaymentFields {
|
|
27
|
+
cus_state?: string;
|
|
28
|
+
ipn_url?: string;
|
|
29
|
+
multi_card_name?: string;
|
|
30
|
+
allowed_bin?: string;
|
|
31
|
+
emi_option?: number;
|
|
32
|
+
emi_max_inst_option?: number | string;
|
|
33
|
+
emi_selected_inst?: number | string;
|
|
34
|
+
cus_add2?: string;
|
|
35
|
+
cus_fax?: string;
|
|
36
|
+
ship_name?: string;
|
|
37
|
+
shipcity?: string;
|
|
38
|
+
ship_add1?: string;
|
|
39
|
+
ship_add2?: string;
|
|
40
|
+
ship_city?: string;
|
|
41
|
+
ship_state?: string;
|
|
42
|
+
ship_postcode?: string;
|
|
43
|
+
ship_country?: string;
|
|
44
|
+
hours_till_departure?: string;
|
|
45
|
+
flight_type?: string;
|
|
46
|
+
pnr?: string;
|
|
47
|
+
journey_from_to?: string;
|
|
48
|
+
third_party_booking?: string;
|
|
49
|
+
hotel_name?: string;
|
|
50
|
+
length_of_stay?: string;
|
|
51
|
+
check_in_time?: string;
|
|
52
|
+
hotel_city?: string;
|
|
53
|
+
product_type?: string;
|
|
54
|
+
topup_number?: string;
|
|
55
|
+
country_topup?: string;
|
|
56
|
+
cart?: string;
|
|
57
|
+
product_amount?: string | number;
|
|
58
|
+
discount_amount?: string | number;
|
|
59
|
+
convenience_fee?: string | number;
|
|
60
|
+
value_a?: string;
|
|
61
|
+
value_b?: string;
|
|
62
|
+
value_c?: string;
|
|
63
|
+
value_d?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface PaymentInitResponse {
|
|
66
|
+
status: "FAILED" | "SUCCESS";
|
|
67
|
+
failedreason?: string;
|
|
68
|
+
sessionkey?: string;
|
|
69
|
+
gw?: {
|
|
70
|
+
visa?: string;
|
|
71
|
+
master?: string;
|
|
72
|
+
amex?: string;
|
|
73
|
+
othercards?: string;
|
|
74
|
+
internetbanking?: string;
|
|
75
|
+
mobilebanking?: string;
|
|
76
|
+
};
|
|
77
|
+
redirectGatewayURL?: string;
|
|
78
|
+
directPaymentURLBank?: string;
|
|
79
|
+
directPaymentURLCard?: string;
|
|
80
|
+
directPaymentURL?: string;
|
|
81
|
+
redirectGatewayURLFailed?: string;
|
|
82
|
+
GatewayPageURL?: string;
|
|
83
|
+
storeBanner?: string;
|
|
84
|
+
storeLogo?: string;
|
|
85
|
+
store_name?: string;
|
|
86
|
+
desc?: any[];
|
|
87
|
+
}
|
|
88
|
+
export interface PaymentValidationResponse {
|
|
89
|
+
status: "VALID" | "VALIDATED" | "INVALID_TRANSACTION";
|
|
90
|
+
tran_date: string;
|
|
91
|
+
tran_id: string;
|
|
92
|
+
val_id: string;
|
|
93
|
+
amount: string | number;
|
|
94
|
+
store_amount: string | number;
|
|
95
|
+
currency: string;
|
|
96
|
+
bank_tran_id: string;
|
|
97
|
+
card_type: string;
|
|
98
|
+
card_no: string;
|
|
99
|
+
card_issuer: string;
|
|
100
|
+
card_brand: string;
|
|
101
|
+
card_issuer_country: string;
|
|
102
|
+
card_issuer_country_code: string;
|
|
103
|
+
currency_type: string;
|
|
104
|
+
currency_amount: string | number;
|
|
105
|
+
currency_rate: string;
|
|
106
|
+
base_fair: string;
|
|
107
|
+
value_a: string;
|
|
108
|
+
value_b: string;
|
|
109
|
+
value_c: string;
|
|
110
|
+
value_d: string;
|
|
111
|
+
emi_instalment: string;
|
|
112
|
+
emi_amount: string | number;
|
|
113
|
+
emi_description: string;
|
|
114
|
+
emi_issuer: string;
|
|
115
|
+
account_details: string;
|
|
116
|
+
risk_title: string;
|
|
117
|
+
risk_level: string;
|
|
118
|
+
APIConnect: string;
|
|
119
|
+
validated_on: string;
|
|
120
|
+
gw_version: string;
|
|
121
|
+
}
|
|
122
|
+
export interface PaymentRefundInitiateResponse {
|
|
123
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
124
|
+
bank_tran_id: string;
|
|
125
|
+
trans_id: string;
|
|
126
|
+
refund_ref_id: string;
|
|
127
|
+
status: "success" | "failed" | "processing";
|
|
128
|
+
errorReason: string;
|
|
129
|
+
}
|
|
130
|
+
export interface PaymentRefundQueryResponse {
|
|
131
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
132
|
+
bank_tran_id: string;
|
|
133
|
+
tran_id: string;
|
|
134
|
+
refund_ref_id: string;
|
|
135
|
+
initiated_on: string;
|
|
136
|
+
refunded_on: string;
|
|
137
|
+
status: "refunded" | "processing" | "cancelled";
|
|
138
|
+
errorReason: string;
|
|
139
|
+
}
|
|
140
|
+
export interface TransactionQuerySessionIdResponse {
|
|
141
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
142
|
+
status: "VALID" | "VALIDATED" | "PENDING" | "FAILED";
|
|
143
|
+
sessionkey: string;
|
|
144
|
+
tran_date: string;
|
|
145
|
+
tran_id: string;
|
|
146
|
+
val_id: string;
|
|
147
|
+
amount: string;
|
|
148
|
+
store_amount: string;
|
|
149
|
+
bank_tran_id: string;
|
|
150
|
+
card_type: string;
|
|
151
|
+
card_no: string;
|
|
152
|
+
card_issuer: string;
|
|
153
|
+
card_brand: string;
|
|
154
|
+
card_issuer_country: string;
|
|
155
|
+
card_issuer_country_code: string;
|
|
156
|
+
currency_type: string;
|
|
157
|
+
currency_amount: string;
|
|
158
|
+
currency_rate: string;
|
|
159
|
+
base_fair: string;
|
|
160
|
+
value_a: string;
|
|
161
|
+
value_b: string;
|
|
162
|
+
value_c: string;
|
|
163
|
+
value_d: string;
|
|
164
|
+
risk_title: string;
|
|
165
|
+
risk_level: string;
|
|
166
|
+
validated_on: string;
|
|
167
|
+
gw_version: string;
|
|
168
|
+
}
|
|
169
|
+
export interface TransactionQueryTransIdResponse {
|
|
170
|
+
APIConnect: "INVALID_REQUEST" | "FAILED" | "INACTIVE" | "DONE";
|
|
171
|
+
no_of_trans_found: number;
|
|
172
|
+
element: TransactionQueryTransIdResponseArray[];
|
|
173
|
+
}
|
|
174
|
+
export interface TransactionQueryTransIdResponseArray {
|
|
175
|
+
val_id: string;
|
|
176
|
+
status: string;
|
|
177
|
+
validated_on: string;
|
|
178
|
+
currency_type: string;
|
|
179
|
+
currency_amount: string;
|
|
180
|
+
currency_rate: string;
|
|
181
|
+
base_fair: string;
|
|
182
|
+
value_a: string;
|
|
183
|
+
value_b: string;
|
|
184
|
+
value_c: string;
|
|
185
|
+
value_d: string;
|
|
186
|
+
tran_date: string;
|
|
187
|
+
tran_id: string;
|
|
188
|
+
amount: string;
|
|
189
|
+
store_amount: string;
|
|
190
|
+
bank_tran_id: string;
|
|
191
|
+
card_type: string;
|
|
192
|
+
risk_title: string;
|
|
193
|
+
risk_level: string;
|
|
194
|
+
currency: string;
|
|
195
|
+
bank_gw: string;
|
|
196
|
+
card_no: string;
|
|
197
|
+
card_issuer: string;
|
|
198
|
+
card_brand: string;
|
|
199
|
+
card_issuer_country: string;
|
|
200
|
+
card_issuer_country_code: string;
|
|
201
|
+
gw_version: string;
|
|
202
|
+
emi_instalment: string;
|
|
203
|
+
emi_amount: string;
|
|
204
|
+
emi_description: string;
|
|
205
|
+
emi_issuer: string;
|
|
206
|
+
error: string;
|
|
207
|
+
}
|
|
208
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { SslCommerz } from "./helpers/paymentController";
|
|
2
|
+
export { type PaymentInitData, PaymentInitResponse, PaymentValidationResponse, PaymentRefundInitiateResponse, PaymentRefundQueryResponse, TransactionQuerySessionIdResponse, TransactionQueryTransIdResponse, TransactionQueryTransIdResponseArray } from "./helpers/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siamf/sslcommerz",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A well-maintained, unofficial Node.js package for integrating SSLCommerz payments. Provides reliable support for initiating and handling transactions with minimal setup.",
|
|
5
|
+
"homepage": "https://github.com/siamahnaf/sslcommerz",
|
|
6
|
+
"main": "dist/cjs/index.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rimraf dist && npm run build:esm && npm run build:cjs",
|
|
13
|
+
"build:esm": "tsc",
|
|
14
|
+
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Siam Ahnaf",
|
|
18
|
+
"email": "mail@siamahnaf.com",
|
|
19
|
+
"url": "https://www.siamahnaf.com"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"sslcommerz",
|
|
24
|
+
"bd-sslcommerz",
|
|
25
|
+
"bd-payment"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"directory": "https://github.com/siamahnaf/sslcommerz",
|
|
30
|
+
"url": "https://github.com/siamahnaf/sslcommerz"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^24.0.15",
|
|
34
|
+
"typescript": "^5.8.3"
|
|
35
|
+
}
|
|
36
|
+
}
|