@ngn-net/payment-provider-sdk 1.0.1

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 ADDED
@@ -0,0 +1,9 @@
1
+ #PaymentGateway Shared Library
2
+
3
+ A shared library for payment gateway
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @ngn-net/payment-provider-sdk
9
+ ```
@@ -0,0 +1,46 @@
1
+ export declare const RABBIT_URI: () => string[];
2
+ export declare const rabbitUri: string[];
3
+ export interface RabbitAddress {
4
+ exchange: string;
5
+ type: "topic" | "direct" | "fanout";
6
+ routingkeys: {
7
+ [key: string]: {
8
+ key: string;
9
+ messages?: {
10
+ [key: string]: string;
11
+ };
12
+ };
13
+ };
14
+ }
15
+ export declare const PaymentRabbitApi: {
16
+ exchange: string;
17
+ type: string;
18
+ routingkeys: {
19
+ default: {
20
+ key: string;
21
+ };
22
+ events: {
23
+ key: string;
24
+ };
25
+ stripe_checkout: {
26
+ key: string;
27
+ };
28
+ stripe_intent: {
29
+ key: string;
30
+ };
31
+ };
32
+ };
33
+ export interface CreateStripeCheckoutResponse {
34
+ id: string;
35
+ checkoutId: string;
36
+ amount: number;
37
+ url: string;
38
+ orderId: string;
39
+ }
40
+ export interface CreateStripePaymentIntentResponse {
41
+ id: string;
42
+ paymentId: string;
43
+ amount: number;
44
+ clientSecret: string;
45
+ orderId: string;
46
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentRabbitApi = exports.rabbitUri = exports.RABBIT_URI = void 0;
4
+ const RABBIT_URI = () => {
5
+ const rabbitUri = process.env.RABBIT_URI || "amqp://sabi:password@localhost:5672";
6
+ const [creadential, hosts] = rabbitUri.split("@");
7
+ const hostList = hosts.split(",");
8
+ return hostList.map((host) => {
9
+ return `${creadential}@${host}`;
10
+ });
11
+ };
12
+ exports.RABBIT_URI = RABBIT_URI;
13
+ exports.rabbitUri = (0, exports.RABBIT_URI)();
14
+ exports.PaymentRabbitApi = {
15
+ exchange: "payment",
16
+ type: "topic",
17
+ routingkeys: {
18
+ default: {
19
+ key: "default",
20
+ },
21
+ events: {
22
+ key: "paymentEvents",
23
+ },
24
+ stripe_checkout: {
25
+ key: "stripeCheckout",
26
+ },
27
+ stripe_intent: {
28
+ key: "stripePaymentIntent",
29
+ },
30
+ },
31
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.interface.js","sourceRoot":"","sources":["../../src/dto/common.interface.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,GAAa,EAAE;IACvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,uBAAuB,CAAC;IAEpE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,OAAO,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AATW,QAAA,UAAU,cASrB;AAEW,QAAA,SAAS,GAAG,IAAA,kBAAU,GAAE,CAAC;AAezB,QAAA,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,SAAS;IACnB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE;QACX,OAAO,EAAE;YACP,GAAG,EAAE,SAAS;SACf;QACD,MAAM,EAAE;YACN,GAAG,EAAE,eAAe;SACrB;QACD,eAAe,EAAE;YACf,GAAG,EAAE,gBAAgB;SACtB;QACD,aAAa,EAAE;YACb,GAAG,EAAE,qBAAqB;SAC3B;KACF;CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare class CreateStripeCheckoutDto {
2
+ amount: number;
3
+ orderId: string;
4
+ productName: string;
5
+ }
6
+ export declare class CreateStripePaymentIntentDto {
7
+ amount: number;
8
+ orderId: string;
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreateStripePaymentIntentDto = exports.CreateStripeCheckoutDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ class CreateStripeCheckoutDto {
16
+ }
17
+ exports.CreateStripeCheckoutDto = CreateStripeCheckoutDto;
18
+ __decorate([
19
+ (0, swagger_1.ApiProperty)(),
20
+ (0, class_validator_1.IsNotEmpty)(),
21
+ (0, class_validator_1.IsNumber)(),
22
+ (0, class_validator_1.Min)(50),
23
+ __metadata("design:type", Number)
24
+ ], CreateStripeCheckoutDto.prototype, "amount", void 0);
25
+ __decorate([
26
+ (0, swagger_1.ApiProperty)(),
27
+ (0, class_validator_1.IsNotEmpty)(),
28
+ (0, class_validator_1.IsString)(),
29
+ __metadata("design:type", String)
30
+ ], CreateStripeCheckoutDto.prototype, "orderId", void 0);
31
+ __decorate([
32
+ (0, swagger_1.ApiProperty)(),
33
+ (0, class_validator_1.IsNotEmpty)(),
34
+ (0, class_validator_1.IsString)(),
35
+ __metadata("design:type", String)
36
+ ], CreateStripeCheckoutDto.prototype, "productName", void 0);
37
+ class CreateStripePaymentIntentDto {
38
+ }
39
+ exports.CreateStripePaymentIntentDto = CreateStripePaymentIntentDto;
40
+ __decorate([
41
+ (0, swagger_1.ApiProperty)(),
42
+ (0, class_validator_1.IsNotEmpty)(),
43
+ (0, class_validator_1.IsNumber)(),
44
+ (0, class_validator_1.Min)(50),
45
+ __metadata("design:type", Number)
46
+ ], CreateStripePaymentIntentDto.prototype, "amount", void 0);
47
+ __decorate([
48
+ (0, swagger_1.ApiProperty)(),
49
+ (0, class_validator_1.IsNotEmpty)(),
50
+ (0, class_validator_1.IsString)(),
51
+ __metadata("design:type", String)
52
+ ], CreateStripePaymentIntentDto.prototype, "orderId", void 0);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripe.dto.js","sourceRoot":"","sources":["../../src/dto/stripe.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAsE;AAEtE,MAAa,uBAAuB;CAgBnC;AAhBD,0DAgBC;AAXC;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAG,EAAC,EAAE,CAAC;;uDACQ;AAKhB;IAHC,IAAA,qBAAW,GAAE;IACb,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wDACM;AAKjB;IAHC,IAAA,qBAAW,GAAE;IACb,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;4DACU;AAGvB,MAAa,4BAA4B;CAWxC;AAXD,oEAWC;AANC;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAG,EAAC,EAAE,CAAC;;4DACQ;AAKhB;IAHC,IAAA,qBAAW,GAAE;IACb,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;6DACM"}
@@ -0,0 +1,4 @@
1
+ export * from "./payment.module";
2
+ export * from "./payment.provider";
3
+ export * from "./dto/stripe.dto";
4
+ export * from "./dto/common.interface";
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payment.module"), exports);
18
+ __exportStar(require("./payment.provider"), exports);
19
+ __exportStar(require("./dto/stripe.dto"), exports);
20
+ __exportStar(require("./dto/common.interface"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,qDAAmC;AAEnC,mDAAiC;AACjC,yDAAuC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./payment.module";
2
+ export * from "./payment.provider";
3
+ export * from "./dto/stripe.dto";
4
+ export * from "./dto/common.interface";
package/dist/main.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payment.module"), exports);
18
+ __exportStar(require("./payment.provider"), exports);
19
+ __exportStar(require("./dto/stripe.dto"), exports);
20
+ __exportStar(require("./dto/common.interface"), exports);
@@ -0,0 +1,2 @@
1
+ export declare class PaymentModule {
2
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PaymentModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const payment_provider_1 = require("./payment.provider");
12
+ let PaymentModule = class PaymentModule {
13
+ };
14
+ exports.PaymentModule = PaymentModule;
15
+ exports.PaymentModule = PaymentModule = __decorate([
16
+ (0, common_1.Global)(),
17
+ (0, common_1.Module)({
18
+ providers: [payment_provider_1.PaymentProvider],
19
+ exports: [payment_provider_1.PaymentProvider],
20
+ })
21
+ ], PaymentModule);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.module.js","sourceRoot":"","sources":["../src/payment.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,yDAAqD;AAO9C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IALzB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,kCAAe,CAAC;QAC5B,OAAO,EAAE,CAAC,kCAAe,CAAC;KAC3B,CAAC;GACW,aAAa,CAAG"}
@@ -0,0 +1,9 @@
1
+ import { CreateStripeCheckoutDto, CreateStripePaymentIntentDto } from "./dto/stripe.dto";
2
+ import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
3
+ import { CreateStripeCheckoutResponse, CreateStripePaymentIntentResponse } from "./dto/common.interface";
4
+ export declare class PaymentProvider {
5
+ private readonly rabbit;
6
+ constructor(rabbit: AmqpConnection);
7
+ createStripeCheckout(payload: CreateStripeCheckoutDto): Promise<CreateStripeCheckoutResponse>;
8
+ createStripePaymentIntent(payload: CreateStripePaymentIntentDto): Promise<CreateStripePaymentIntentResponse>;
9
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PaymentProvider = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
15
+ const common_interface_1 = require("./dto/common.interface");
16
+ let PaymentProvider = class PaymentProvider {
17
+ constructor(rabbit) {
18
+ this.rabbit = rabbit;
19
+ }
20
+ createStripeCheckout(payload) {
21
+ return this.rabbit.request({
22
+ exchange: common_interface_1.PaymentRabbitApi.exchange,
23
+ routingKey: common_interface_1.PaymentRabbitApi.routingkeys.stripe_checkout.key,
24
+ payload,
25
+ });
26
+ }
27
+ createStripePaymentIntent(payload) {
28
+ return this.rabbit.request({
29
+ exchange: common_interface_1.PaymentRabbitApi.exchange,
30
+ routingKey: common_interface_1.PaymentRabbitApi.routingkeys.stripe_intent.key,
31
+ payload,
32
+ });
33
+ }
34
+ };
35
+ exports.PaymentProvider = PaymentProvider;
36
+ exports.PaymentProvider = PaymentProvider = __decorate([
37
+ (0, common_1.Injectable)(),
38
+ __metadata("design:paramtypes", [nestjs_rabbitmq_1.AmqpConnection])
39
+ ], PaymentProvider);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.provider.js","sourceRoot":"","sources":["../src/payment.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AAMpD,gEAA4D;AAE5D,6DAIgC;AAGzB,IAAM,eAAe,GAArB,MAAM,eAAe;IAI1B,oBAAoB,CAAC,OAAgC;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B;YACvD,QAAQ,EAAE,mCAAgB,CAAC,QAAQ;YACnC,UAAU,EAAE,mCAAgB,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG;YAC5D,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,yBAAyB,CAAC,OAAqC;QAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAoC;YAC5D,QAAQ,EAAE,mCAAgB,CAAC,QAAQ;YACnC,UAAU,EAAE,mCAAgB,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG;YAC1D,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnBY,0CAAe;AAET;IADhB,IAAA,eAAM,GAAE;8BACgB,gCAAc;+CAAC;0BAF7B,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAmB3B"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@ngn-net/payment-provider-sdk",
3
+ "version": "1.0.1",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "start": "nest start",
8
+ "start:dev": "nest start --watch",
9
+ "build": "tsc"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "description": "",
15
+ "dependencies": {
16
+ "@golevelup/nestjs-rabbitmq": "^9.0.2",
17
+ "@nestjs/common": "^11.1.26",
18
+ "@nestjs/swagger": "^11.4.4",
19
+ "class-transformer": "^0.5.1",
20
+ "class-validator": "^0.15.1"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^25.9.2",
24
+ "typescript": "^6.0.3"
25
+ }
26
+ }
@@ -0,0 +1,61 @@
1
+ export const RABBIT_URI = (): string[] => {
2
+ const rabbitUri =
3
+ process.env.RABBIT_URI || "amqp://sabi:password@localhost:5672";
4
+
5
+ const [creadential, hosts] = rabbitUri.split("@");
6
+ const hostList = hosts.split(",");
7
+
8
+ return hostList.map((host) => {
9
+ return `${creadential}@${host}`;
10
+ });
11
+ };
12
+
13
+ export const rabbitUri = RABBIT_URI();
14
+
15
+ export interface RabbitAddress {
16
+ exchange: string;
17
+ type: "topic" | "direct" | "fanout";
18
+ routingkeys: {
19
+ [key: string]: {
20
+ key: string;
21
+ messages?: {
22
+ [key: string]: string;
23
+ };
24
+ };
25
+ };
26
+ }
27
+
28
+ export const PaymentRabbitApi = {
29
+ exchange: "payment",
30
+ type: "topic",
31
+ routingkeys: {
32
+ default: {
33
+ key: "default",
34
+ },
35
+ events: {
36
+ key: "paymentEvents",
37
+ },
38
+ stripe_checkout: {
39
+ key: "stripeCheckout",
40
+ },
41
+ stripe_intent: {
42
+ key: "stripePaymentIntent",
43
+ },
44
+ },
45
+ };
46
+
47
+ export interface CreateStripeCheckoutResponse {
48
+ id: string;
49
+ checkoutId: string;
50
+ amount: number;
51
+ url: string;
52
+ orderId: string;
53
+ }
54
+
55
+ export interface CreateStripePaymentIntentResponse {
56
+ id: string;
57
+ paymentId: string;
58
+ amount: number;
59
+ clientSecret: string;
60
+ orderId: string;
61
+ }
@@ -0,0 +1,33 @@
1
+ import { ApiProperty } from "@nestjs/swagger";
2
+ import { IsNotEmpty, IsNumber, IsString, Min } from "class-validator";
3
+
4
+ export class CreateStripeCheckoutDto {
5
+ @ApiProperty()
6
+ @IsNotEmpty()
7
+ @IsNumber()
8
+ @Min(50)
9
+ amount!: number;
10
+
11
+ @ApiProperty()
12
+ @IsNotEmpty()
13
+ @IsString()
14
+ orderId!: string;
15
+
16
+ @ApiProperty()
17
+ @IsNotEmpty()
18
+ @IsString()
19
+ productName!: string;
20
+ }
21
+
22
+ export class CreateStripePaymentIntentDto {
23
+ @ApiProperty()
24
+ @IsNotEmpty()
25
+ @IsNumber()
26
+ @Min(50)
27
+ amount!: number;
28
+
29
+ @ApiProperty()
30
+ @IsNotEmpty()
31
+ @IsString()
32
+ orderId!: string;
33
+ }
package/src/main.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./payment.module";
2
+ export * from "./payment.provider";
3
+
4
+ export * from "./dto/stripe.dto";
5
+ export * from "./dto/common.interface";
@@ -0,0 +1,9 @@
1
+ import { Global, Module } from "@nestjs/common";
2
+ import { PaymentProvider } from "./payment.provider";
3
+
4
+ @Global()
5
+ @Module({
6
+ providers: [PaymentProvider],
7
+ exports: [PaymentProvider],
8
+ })
9
+ export class PaymentModule {}
@@ -0,0 +1,32 @@
1
+ import { Inject, Injectable } from "@nestjs/common";
2
+ import {
3
+ CreateStripeCheckoutDto,
4
+ CreateStripePaymentIntentDto,
5
+ } from "./dto/stripe.dto";
6
+ import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
7
+ import {
8
+ CreateStripeCheckoutResponse,
9
+ CreateStripePaymentIntentResponse,
10
+ PaymentRabbitApi,
11
+ } from "./dto/common.interface";
12
+
13
+ @Injectable()
14
+ export class PaymentProvider {
15
+ constructor(private readonly rabbit: AmqpConnection) {}
16
+
17
+ createStripeCheckout(payload: CreateStripeCheckoutDto) {
18
+ return this.rabbit.request<CreateStripeCheckoutResponse>({
19
+ exchange: PaymentRabbitApi.exchange,
20
+ routingKey: PaymentRabbitApi.routingkeys.stripe_checkout.key,
21
+ payload,
22
+ });
23
+ }
24
+
25
+ createStripePaymentIntent(payload: CreateStripePaymentIntentDto) {
26
+ return this.rabbit.request<CreateStripePaymentIntentResponse>({
27
+ exchange: PaymentRabbitApi.exchange,
28
+ routingKey: PaymentRabbitApi.routingkeys.stripe_intent.key,
29
+ payload,
30
+ });
31
+ }
32
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "declaration": true,
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+
9
+ "strict": true,
10
+
11
+ "experimentalDecorators": true,
12
+ "emitDecoratorMetadata": true,
13
+
14
+ "esModuleInterop": true,
15
+
16
+ "types": ["node"],
17
+
18
+ "skipLibCheck": true
19
+ },
20
+ "include": ["src/**/*"]
21
+ }