aeremmiddleware 1.0.45 → 1.0.47
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/Finance/index.d.ts +2 -0
- package/dist/Finance/index.js +2 -0
- package/dist/Finance/index.js.map +1 -1
- package/dist/Finance/ingenicoHtml.js +1 -1
- package/dist/Finance/ingenicoHtml.js.map +1 -1
- package/dist/Finance/razorpay.d.ts +28 -0
- package/dist/Finance/razorpay.js +68 -0
- package/dist/Finance/razorpay.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/Finance/index.ts +2 -0
- package/src/Finance/ingenicoHtml.ts +2 -2
- package/src/Finance/razorpay.ts +78 -0
package/dist/Finance/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import QbrikApiWrapper from "./qbrik";
|
|
|
6
6
|
import AuFinanceApiWrapper from "./auFinance";
|
|
7
7
|
import SetuApiWrapper from "./setu";
|
|
8
8
|
import KycCartAPIWrapper from "./kycKart";
|
|
9
|
+
import RazorpayApiWrapper from "./razorpay";
|
|
9
10
|
export declare const finance: {
|
|
10
11
|
idFy: typeof IdfyAPIWrapper;
|
|
11
12
|
novel: typeof NovelApiWrapper;
|
|
@@ -15,4 +16,5 @@ export declare const finance: {
|
|
|
15
16
|
auFinance: typeof AuFinanceApiWrapper;
|
|
16
17
|
setu: typeof SetuApiWrapper;
|
|
17
18
|
kycKart: typeof KycCartAPIWrapper;
|
|
19
|
+
razorpay: typeof RazorpayApiWrapper;
|
|
18
20
|
};
|
package/dist/Finance/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const qbrik_1 = __importDefault(require("./qbrik"));
|
|
|
12
12
|
const auFinance_1 = __importDefault(require("./auFinance"));
|
|
13
13
|
const setu_1 = __importDefault(require("./setu"));
|
|
14
14
|
const kycKart_1 = __importDefault(require("./kycKart"));
|
|
15
|
+
const razorpay_1 = __importDefault(require("./razorpay"));
|
|
15
16
|
exports.finance = {
|
|
16
17
|
idFy: idfy_1.default,
|
|
17
18
|
novel: novel_1.default,
|
|
@@ -21,5 +22,6 @@ exports.finance = {
|
|
|
21
22
|
auFinance: auFinance_1.default,
|
|
22
23
|
setu: setu_1.default,
|
|
23
24
|
kycKart: kycKart_1.default,
|
|
25
|
+
razorpay: razorpay_1.default,
|
|
24
26
|
};
|
|
25
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Finance/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAoC;AACpC,oDAAsC;AACtC,0DAA4C;AAC5C,8DAAiD;AACjD,oDAAsC;AACtC,4DAA8C;AAC9C,kDAAoC;AACpC,wDAA0C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Finance/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAoC;AACpC,oDAAsC;AACtC,0DAA4C;AAC5C,8DAAiD;AACjD,oDAAsC;AACtC,4DAA8C;AAC9C,kDAAoC;AACpC,wDAA0C;AAC1C,0DAA4C;AAC/B,QAAA,OAAO,GAAG;IACrB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,kBAAkB;IAC5B,UAAU,EAAE,oBAAqB;IACjC,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,mBAAmB;IAC9B,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,kBAAkB;CAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingenicoHtml.js","sourceRoot":"","sources":["../../src/Finance/ingenicoHtml.ts"],"names":[],"mappings":";;;AAEO,MAAM,WAAW,GAAG,CAAC,WAA4B,EAAE,OAAe,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"ingenicoHtml.js","sourceRoot":"","sources":["../../src/Finance/ingenicoHtml.ts"],"names":[],"mappings":";;;AAEO,MAAM,WAAW,GAAG,CAAC,WAA4B,EAAE,OAAe,EAAE,EAAE;IAC3E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAiEkB,OAAO;;uBAEX,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS;;kCAEX,WAAW,CAAC,WAAW;;;iCAGxB,WAAW,CAAC,UAAU;;iCAEtB,WAAW,CAAC,UAAU;uCAChB,WAAW,CAAC,gBAAgB;sCAC7B,WAAW,CAAC,eAAe;4BACrC,WAAW,CAAC,KAAK;;;;;iCAKZ,WAAW,CAAC,WAAW;;;;;;;;;;qCAUnB,WAAW,CAAC,cAAc;mCAC5B,WAAW,CAAC,YAAY;gCAC3B,WAAW,CAAC,SAAS;iCACpB,WAAW,CAAC,UAAU;gCACvB,WAAW,CAAC,SAAS;;;;;;;;;;;;;;GAclD,CAAC;AACJ,CAAC,CAAC;AAhHW,QAAA,WAAW,eAgHtB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface StandardPayload {
|
|
2
|
+
amount: number;
|
|
3
|
+
reference_id: string;
|
|
4
|
+
currency: string;
|
|
5
|
+
customer: {
|
|
6
|
+
name?: string;
|
|
7
|
+
contact?: number;
|
|
8
|
+
email?: string;
|
|
9
|
+
};
|
|
10
|
+
notes: {
|
|
11
|
+
feature: string;
|
|
12
|
+
id: string;
|
|
13
|
+
module: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare class RazorpayApiWrapper {
|
|
18
|
+
private url;
|
|
19
|
+
private apiKey;
|
|
20
|
+
private secret;
|
|
21
|
+
constructor({ apiKey, secret }: {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
secret: string;
|
|
24
|
+
});
|
|
25
|
+
createPaymentLink(standardPayload: StandardPayload): Promise<any>;
|
|
26
|
+
getEpochTimeOneDayLater(): number;
|
|
27
|
+
}
|
|
28
|
+
export default RazorpayApiWrapper;
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
class RazorpayApiWrapper {
|
|
17
|
+
constructor({ apiKey, secret }) {
|
|
18
|
+
this.url = "https://api.razorpay.com/v1/payment_links";
|
|
19
|
+
this.apiKey = apiKey;
|
|
20
|
+
this.secret = secret;
|
|
21
|
+
}
|
|
22
|
+
createPaymentLink(standardPayload) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const authHeader = "Basic " +
|
|
25
|
+
Buffer.from(`${this.apiKey}:${this.secret}`).toString("base64");
|
|
26
|
+
const payload = {
|
|
27
|
+
amount: standardPayload.amount,
|
|
28
|
+
currency: standardPayload.currency,
|
|
29
|
+
accept_partial: false,
|
|
30
|
+
expire_by: this.getEpochTimeOneDayLater(),
|
|
31
|
+
reference_id: standardPayload.reference_id,
|
|
32
|
+
description: standardPayload.notes.feature +
|
|
33
|
+
" Payment for Loan " +
|
|
34
|
+
standardPayload.reference_id,
|
|
35
|
+
customer: {
|
|
36
|
+
name: standardPayload.customer.name,
|
|
37
|
+
contact: standardPayload.customer.contact,
|
|
38
|
+
email: standardPayload.customer.email,
|
|
39
|
+
},
|
|
40
|
+
notify: {
|
|
41
|
+
sms: true,
|
|
42
|
+
email: true,
|
|
43
|
+
},
|
|
44
|
+
reminder_enable: true,
|
|
45
|
+
notes: standardPayload.notes,
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
const response = yield axios_1.default.post(this.url, payload, {
|
|
49
|
+
headers: {
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
Authorization: authHeader,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return response.data;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw error.response.data;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getEpochTimeOneDayLater() {
|
|
62
|
+
const date = new Date();
|
|
63
|
+
date.setDate(date.getDate() + 90);
|
|
64
|
+
return Math.floor(date.getTime() / 1000);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = RazorpayApiWrapper;
|
|
68
|
+
//# sourceMappingURL=razorpay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"razorpay.js","sourceRoot":"","sources":["../../src/Finance/razorpay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAmB1B,MAAM,kBAAkB;IAKtB,YAAY,EAAE,MAAM,EAAE,MAAM,EAAsC;QAJ1D,QAAG,GAAG,2CAA2C,CAAC;QAKxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,iBAAiB,CAAC,eAAgC;;YACtD,MAAM,UAAU,GACd,QAAQ;gBACR,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,C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ACF;AAED,kBAAe,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const AeremMiddleware: {
|
|
|
8
8
|
auFinance: typeof import("./Finance/auFinance").default;
|
|
9
9
|
setu: typeof import("./Finance/setu").default;
|
|
10
10
|
kycKart: typeof import("./Finance/kycKart").default;
|
|
11
|
+
razorpay: typeof import("./Finance/razorpay").default;
|
|
11
12
|
};
|
|
12
13
|
socials: {
|
|
13
14
|
whatsapp: typeof import("./Socials/whatsApp").default;
|
package/package.json
CHANGED
package/src/Finance/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import QbrikApiWrapper from "./qbrik";
|
|
|
6
6
|
import AuFinanceApiWrapper from "./auFinance";
|
|
7
7
|
import SetuApiWrapper from "./setu";
|
|
8
8
|
import KycCartAPIWrapper from "./kycKart";
|
|
9
|
+
import RazorpayApiWrapper from "./razorpay";
|
|
9
10
|
export const finance = {
|
|
10
11
|
idFy: IdfyAPIWrapper,
|
|
11
12
|
novel: NovelApiWrapper,
|
|
@@ -15,4 +16,5 @@ export const finance = {
|
|
|
15
16
|
auFinance: AuFinanceApiWrapper,
|
|
16
17
|
setu: SetuApiWrapper,
|
|
17
18
|
kycKart: KycCartAPIWrapper,
|
|
19
|
+
razorpay: RazorpayApiWrapper,
|
|
18
20
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MandateDataType } from "./Ingenico.types";
|
|
2
2
|
|
|
3
3
|
export const mandateHtml = (mandateData: MandateDataType, tokenId: string) => {
|
|
4
|
-
|
|
4
|
+
return `<!DOCTYPE html>
|
|
5
5
|
<html>
|
|
6
6
|
<head>
|
|
7
7
|
<title>Checkout Demo</title>
|
|
@@ -82,7 +82,7 @@ export const mandateHtml = (mandateData: MandateDataType, tokenId: string) => {
|
|
|
82
82
|
|
|
83
83
|
items: [
|
|
84
84
|
{
|
|
85
|
-
itemId: "
|
|
85
|
+
itemId: "Test",
|
|
86
86
|
amount: "${mandateData.totalamount}",
|
|
87
87
|
comAmt: "0",
|
|
88
88
|
},
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
interface StandardPayload {
|
|
4
|
+
amount: number;
|
|
5
|
+
reference_id: string;
|
|
6
|
+
currency: string;
|
|
7
|
+
customer: {
|
|
8
|
+
name?: string;
|
|
9
|
+
contact?: number;
|
|
10
|
+
email?: string;
|
|
11
|
+
};
|
|
12
|
+
notes: {
|
|
13
|
+
feature: string;
|
|
14
|
+
id: string;
|
|
15
|
+
module: string;
|
|
16
|
+
signature: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class RazorpayApiWrapper {
|
|
21
|
+
private url = "https://api.razorpay.com/v1/payment_links";
|
|
22
|
+
private apiKey: string;
|
|
23
|
+
private secret: String;
|
|
24
|
+
|
|
25
|
+
constructor({ apiKey, secret }: { apiKey: string; secret: string }) {
|
|
26
|
+
this.apiKey = apiKey;
|
|
27
|
+
this.secret = secret;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async createPaymentLink(standardPayload: StandardPayload) {
|
|
31
|
+
const authHeader =
|
|
32
|
+
"Basic " +
|
|
33
|
+
Buffer.from(`${this.apiKey}:${this.secret}`).toString("base64");
|
|
34
|
+
|
|
35
|
+
const payload = {
|
|
36
|
+
amount: standardPayload.amount,
|
|
37
|
+
currency: standardPayload.currency,
|
|
38
|
+
accept_partial: false,
|
|
39
|
+
expire_by: this.getEpochTimeOneDayLater(),
|
|
40
|
+
reference_id: standardPayload.reference_id,
|
|
41
|
+
description:
|
|
42
|
+
standardPayload.notes.feature +
|
|
43
|
+
" Payment for Loan " +
|
|
44
|
+
standardPayload.reference_id,
|
|
45
|
+
customer: {
|
|
46
|
+
name: standardPayload.customer.name,
|
|
47
|
+
contact: standardPayload.customer.contact,
|
|
48
|
+
email: standardPayload.customer.email,
|
|
49
|
+
},
|
|
50
|
+
notify: {
|
|
51
|
+
sms: true,
|
|
52
|
+
email: true,
|
|
53
|
+
},
|
|
54
|
+
reminder_enable: true,
|
|
55
|
+
notes: standardPayload.notes,
|
|
56
|
+
};
|
|
57
|
+
try {
|
|
58
|
+
const response = await axios.post(this.url, payload, {
|
|
59
|
+
headers: {
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
Authorization: authHeader,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
return response.data;
|
|
65
|
+
} catch (error: any) {
|
|
66
|
+
throw error.response.data;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getEpochTimeOneDayLater(): number {
|
|
71
|
+
const date = new Date();
|
|
72
|
+
date.setDate(date.getDate() + 90);
|
|
73
|
+
|
|
74
|
+
return Math.floor(date.getTime() / 1000);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default RazorpayApiWrapper;
|