@ngn-net/payment-provider-sdk 1.0.12 → 1.0.14
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/dto/common.interface.d.ts +58 -7
- package/dist/dto/common.interface.js +28 -2
- package/dist/dto/crypto.dto.d.ts +7 -4
- package/dist/dto/crypto.dto.js +42 -18
- package/dist/payment.provider.d.ts +17 -2
- package/dist/payment.provider.js +67 -26
- package/dist/payment.webhook.js +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FiatCurrency, PayCurrency, PaymentIntentStatus } from "../entity/crypto.entity";
|
|
2
1
|
export declare const RABBIT_URI: () => string[];
|
|
3
2
|
export declare const rabbitUri: string[];
|
|
4
3
|
export interface RabbitAddress {
|
|
@@ -32,12 +31,66 @@ export declare const PaymentRabbitApi: {
|
|
|
32
31
|
crypto_intent: {
|
|
33
32
|
key: string;
|
|
34
33
|
};
|
|
34
|
+
stripe_ship: {
|
|
35
|
+
key: string;
|
|
36
|
+
};
|
|
37
|
+
stripe_refund: {
|
|
38
|
+
key: string;
|
|
39
|
+
};
|
|
40
|
+
stripe_cancel: {
|
|
41
|
+
key: string;
|
|
42
|
+
};
|
|
43
|
+
payment_methods: {
|
|
44
|
+
key: string;
|
|
45
|
+
};
|
|
46
|
+
payment_methods_update: {
|
|
47
|
+
key: string;
|
|
48
|
+
};
|
|
49
|
+
intent_status: {
|
|
50
|
+
key: string;
|
|
51
|
+
};
|
|
35
52
|
available_methods: {
|
|
36
53
|
key: string;
|
|
37
54
|
};
|
|
38
55
|
};
|
|
39
56
|
};
|
|
40
57
|
export declare function paymentEventRoutingKey(serviceName: string): string;
|
|
58
|
+
export interface RpcClientContext {
|
|
59
|
+
serviceName: string;
|
|
60
|
+
signature: string;
|
|
61
|
+
correlationId?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface RpcEnvelope<T = unknown> extends RpcClientContext {
|
|
64
|
+
data: T;
|
|
65
|
+
callbackRoutingKey?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface GetIntentByOrderId {
|
|
68
|
+
orderId: string;
|
|
69
|
+
}
|
|
70
|
+
export interface UpdatePaymentMethodDto {
|
|
71
|
+
name: string;
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface OrderActionResponse {
|
|
75
|
+
orderId: string;
|
|
76
|
+
status: string;
|
|
77
|
+
}
|
|
78
|
+
export interface IntentStatusResult {
|
|
79
|
+
orderId: string;
|
|
80
|
+
status: string;
|
|
81
|
+
}
|
|
82
|
+
export interface MethodStatus {
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
healthy: boolean;
|
|
85
|
+
status: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface AvailableMethodsResponse {
|
|
88
|
+
stripe: MethodStatus;
|
|
89
|
+
nowPayment: MethodStatus & {
|
|
90
|
+
currency: string[];
|
|
91
|
+
};
|
|
92
|
+
active: string[];
|
|
93
|
+
}
|
|
41
94
|
export interface CreateStripeCheckoutResponse {
|
|
42
95
|
id: string;
|
|
43
96
|
checkoutId: string;
|
|
@@ -62,13 +115,11 @@ export interface StripePaymentCompleteEvent {
|
|
|
62
115
|
export interface CreateCryptoIntentResponse {
|
|
63
116
|
id: string;
|
|
64
117
|
paymentId: string;
|
|
65
|
-
|
|
66
|
-
fiatCurrency: FiatCurrency;
|
|
67
|
-
payCurrency: PayCurrency;
|
|
118
|
+
amount: number;
|
|
68
119
|
payAdress: string;
|
|
69
120
|
payAmount: number;
|
|
70
|
-
|
|
71
|
-
|
|
121
|
+
invoiceUrl?: string;
|
|
122
|
+
invoiceId?: string;
|
|
72
123
|
}
|
|
73
124
|
export interface EventResponse<T> {
|
|
74
125
|
correlationId: string;
|
|
@@ -82,7 +133,7 @@ export interface NPCompleteEvent {
|
|
|
82
133
|
payAddress: string;
|
|
83
134
|
orderId: string;
|
|
84
135
|
amount: number;
|
|
85
|
-
|
|
136
|
+
amountRecieved: number;
|
|
86
137
|
}
|
|
87
138
|
export interface EventDataMap {
|
|
88
139
|
stripe_succeeded: StripePaymentCompleteEvent;
|
|
@@ -5,9 +5,17 @@ exports.paymentEventRoutingKey = paymentEventRoutingKey;
|
|
|
5
5
|
const RABBIT_URI = () => {
|
|
6
6
|
const rabbitUri = process.env.RABBIT_URI || "amqp://user:pass@localhost:5672";
|
|
7
7
|
const [creadential, hosts] = rabbitUri.split("@");
|
|
8
|
+
if (!hosts) {
|
|
9
|
+
// No credentials part in the URI (e.g. amqp://host:5672 or plain
|
|
10
|
+
// comma-separated hosts) — use the URI(s) as-is instead of crashing.
|
|
11
|
+
return rabbitUri
|
|
12
|
+
.split(",")
|
|
13
|
+
.map((entry) => entry.trim())
|
|
14
|
+
.filter(Boolean);
|
|
15
|
+
}
|
|
8
16
|
const hostList = hosts.split(",");
|
|
9
|
-
return hostList.map((host
|
|
10
|
-
return `${creadential}@${host}`;
|
|
17
|
+
return hostList.map((host) => {
|
|
18
|
+
return `${creadential}@${host.trim()}`;
|
|
11
19
|
});
|
|
12
20
|
};
|
|
13
21
|
exports.RABBIT_URI = RABBIT_URI;
|
|
@@ -31,6 +39,24 @@ exports.PaymentRabbitApi = {
|
|
|
31
39
|
crypto_intent: {
|
|
32
40
|
key: "cryptoIntent",
|
|
33
41
|
},
|
|
42
|
+
stripe_ship: {
|
|
43
|
+
key: "stripeShip",
|
|
44
|
+
},
|
|
45
|
+
stripe_refund: {
|
|
46
|
+
key: "stripeRefund",
|
|
47
|
+
},
|
|
48
|
+
stripe_cancel: {
|
|
49
|
+
key: "stripeCancel",
|
|
50
|
+
},
|
|
51
|
+
payment_methods: {
|
|
52
|
+
key: "paymentMethods",
|
|
53
|
+
},
|
|
54
|
+
payment_methods_update: {
|
|
55
|
+
key: "paymentMethodsUpdate",
|
|
56
|
+
},
|
|
57
|
+
intent_status: {
|
|
58
|
+
key: "intentStatus",
|
|
59
|
+
},
|
|
34
60
|
available_methods: {
|
|
35
61
|
key: "availableMethods",
|
|
36
62
|
},
|
package/dist/dto/crypto.dto.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { PayCurrency } from "../entity/crypto.entity";
|
|
2
2
|
export declare class CreateCryptoPaymentDto {
|
|
3
|
-
orderId: string;
|
|
4
3
|
amount: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
payCurrency?: PayCurrency;
|
|
5
|
+
includeFee?: boolean;
|
|
6
|
+
orderId?: string;
|
|
7
|
+
orderDescription?: string;
|
|
8
8
|
isFixedRate?: boolean;
|
|
9
|
+
successUrl?: string;
|
|
10
|
+
cancelUrl?: string;
|
|
11
|
+
partiallyPaidUrl?: string;
|
|
9
12
|
}
|
package/dist/dto/crypto.dto.js
CHANGED
|
@@ -16,40 +16,64 @@ const crypto_entity_1 = require("../entity/crypto.entity");
|
|
|
16
16
|
class CreateCryptoPaymentDto {
|
|
17
17
|
}
|
|
18
18
|
exports.CreateCryptoPaymentDto = CreateCryptoPaymentDto;
|
|
19
|
-
__decorate([
|
|
20
|
-
(0, swagger_1.ApiProperty)(),
|
|
21
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
-
(0, class_validator_1.IsString)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], CreateCryptoPaymentDto.prototype, "orderId", void 0);
|
|
25
19
|
__decorate([
|
|
26
20
|
(0, swagger_1.ApiProperty)({ example: 50 }),
|
|
27
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
28
21
|
(0, class_validator_1.IsNumber)(),
|
|
29
|
-
(0, class_validator_1.Min)(50),
|
|
30
22
|
__metadata("design:type", Number)
|
|
31
23
|
], CreateCryptoPaymentDto.prototype, "amount", void 0);
|
|
32
24
|
__decorate([
|
|
33
|
-
(0, swagger_1.
|
|
34
|
-
|
|
25
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
26
|
+
description: "optional — omit so the customer chooses the asset on the hosted invoice page",
|
|
27
|
+
enum: crypto_entity_1.PayCurrency,
|
|
28
|
+
example: crypto_entity_1.PayCurrency.usdt,
|
|
29
|
+
}),
|
|
30
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
31
|
(0, class_validator_1.IsEnum)(crypto_entity_1.PayCurrency),
|
|
36
32
|
__metadata("design:type", String)
|
|
37
|
-
], CreateCryptoPaymentDto.prototype, "
|
|
33
|
+
], CreateCryptoPaymentDto.prototype, "payCurrency", void 0);
|
|
38
34
|
__decorate([
|
|
39
|
-
(0, swagger_1.ApiPropertyOptional)({ example:
|
|
35
|
+
(0, swagger_1.ApiPropertyOptional)({ example: false }),
|
|
36
|
+
(0, class_validator_1.IsOptional)(),
|
|
37
|
+
(0, class_validator_1.IsBoolean)(),
|
|
38
|
+
__metadata("design:type", Boolean)
|
|
39
|
+
], CreateCryptoPaymentDto.prototype, "includeFee", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, swagger_1.ApiPropertyOptional)({ example: "order_123" }),
|
|
40
42
|
(0, class_validator_1.IsOptional)(),
|
|
41
43
|
(0, class_validator_1.IsString)(),
|
|
42
44
|
__metadata("design:type", String)
|
|
43
|
-
], CreateCryptoPaymentDto.prototype, "
|
|
45
|
+
], CreateCryptoPaymentDto.prototype, "orderId", void 0);
|
|
44
46
|
__decorate([
|
|
45
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
47
|
+
(0, swagger_1.ApiPropertyOptional)({ example: "Test order description" }),
|
|
46
48
|
(0, class_validator_1.IsOptional)(),
|
|
47
|
-
(0, class_validator_1.
|
|
48
|
-
__metadata("design:type",
|
|
49
|
-
], CreateCryptoPaymentDto.prototype, "
|
|
49
|
+
(0, class_validator_1.IsString)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], CreateCryptoPaymentDto.prototype, "orderDescription", void 0);
|
|
50
52
|
__decorate([
|
|
51
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
53
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
54
|
+
description: "fixed-rate locks the quote but has a higher NP minimum (~$19); " +
|
|
55
|
+
"floating rate allows small-amount payments (e.g. $5 TRX)",
|
|
56
|
+
example: false,
|
|
57
|
+
}),
|
|
52
58
|
(0, class_validator_1.IsOptional)(),
|
|
53
59
|
(0, class_validator_1.IsBoolean)(),
|
|
54
60
|
__metadata("design:type", Boolean)
|
|
55
61
|
], CreateCryptoPaymentDto.prototype, "isFixedRate", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, swagger_1.ApiPropertyOptional)({ example: "https://shop.test/success" }),
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], CreateCryptoPaymentDto.prototype, "successUrl", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, swagger_1.ApiPropertyOptional)({ example: "https://shop.test/cancel" }),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
(0, class_validator_1.IsString)(),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], CreateCryptoPaymentDto.prototype, "cancelUrl", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, swagger_1.ApiPropertyOptional)({ example: "https://shop.test/partial" }),
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
(0, class_validator_1.IsString)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], CreateCryptoPaymentDto.prototype, "partiallyPaidUrl", void 0);
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { CreateStripeCheckoutDto, CreateStripePaymentIntentDto } from "./dto/stripe.dto";
|
|
2
2
|
import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
|
|
3
|
-
import { CreateCryptoIntentResponse, CreateStripeCheckoutResponse, CreateStripePaymentIntentResponse } from "./dto/common.interface";
|
|
3
|
+
import { AvailableMethodsResponse, CreateCryptoIntentResponse, CreateStripeCheckoutResponse, CreateStripePaymentIntentResponse, GetIntentByOrderId, IntentStatusResult, OrderActionResponse, UpdatePaymentMethodDto } from "./dto/common.interface";
|
|
4
4
|
import { CreateCryptoPaymentDto } from "./dto/crypto.dto";
|
|
5
|
+
export interface PaymentProviderOptions {
|
|
6
|
+
serviceName: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
}
|
|
5
9
|
export declare class PaymentProvider {
|
|
6
10
|
private readonly rabbit;
|
|
7
|
-
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private readonly serviceName;
|
|
13
|
+
private readonly secret;
|
|
14
|
+
constructor(rabbit: AmqpConnection, options?: PaymentProviderOptions);
|
|
15
|
+
private envelope;
|
|
16
|
+
private request;
|
|
8
17
|
createStripeCheckout(payload: CreateStripeCheckoutDto): Promise<CreateStripeCheckoutResponse>;
|
|
9
18
|
createStripePaymentIntent(payload: CreateStripePaymentIntentDto): Promise<CreateStripePaymentIntentResponse>;
|
|
10
19
|
createCryptoPayment(payload: CreateCryptoPaymentDto): Promise<CreateCryptoIntentResponse>;
|
|
20
|
+
getIntentStatus(payload: GetIntentByOrderId): Promise<IntentStatusResult | null>;
|
|
21
|
+
markShipped(payload: GetIntentByOrderId): Promise<OrderActionResponse>;
|
|
22
|
+
refundStripeIntent(payload: GetIntentByOrderId): Promise<OrderActionResponse>;
|
|
23
|
+
cancelStripeIntent(payload: GetIntentByOrderId): Promise<OrderActionResponse>;
|
|
24
|
+
getAvailableMethods(): Promise<AvailableMethodsResponse>;
|
|
25
|
+
setPaymentMethodEnabled(payload: UpdatePaymentMethodDto): Promise<AvailableMethodsResponse>;
|
|
11
26
|
availableMethods<T = unknown>(): Promise<T>;
|
|
12
27
|
}
|
package/dist/payment.provider.js
CHANGED
|
@@ -8,48 +8,87 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var PaymentProvider_1;
|
|
11
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
16
|
exports.PaymentProvider = void 0;
|
|
13
17
|
const common_1 = require("@nestjs/common");
|
|
14
18
|
const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
|
|
15
19
|
const common_interface_1 = require("./dto/common.interface");
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const payment_signature_1 = require("./payment.signature");
|
|
21
|
+
const crypto_1 = require("crypto");
|
|
22
|
+
let PaymentProvider = PaymentProvider_1 = class PaymentProvider {
|
|
23
|
+
constructor(rabbit, options) {
|
|
18
24
|
this.rabbit = rabbit;
|
|
25
|
+
this.logger = new common_1.Logger(PaymentProvider_1.name);
|
|
26
|
+
this.serviceName = options?.serviceName?.trim() ?? "";
|
|
27
|
+
this.secret = options?.secret?.trim() ?? "";
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
console.error("Raw RPC response:", JSON.stringify(res));
|
|
28
|
-
throw new Error(res.message);
|
|
29
|
+
/// Wrap a payload in the signed RPC envelope the gateway requires
|
|
30
|
+
/// (`clientRegistry.verify` rejects anything else). Every call gets a
|
|
31
|
+
/// fresh correlationId for end-to-end tracing.
|
|
32
|
+
envelope(data) {
|
|
33
|
+
if (!this.serviceName) {
|
|
34
|
+
throw new Error('PaymentProvider is not configured: "serviceName" is missing — ' +
|
|
35
|
+
"pass it via PaymentModule.forRoot({ serviceName, secret })");
|
|
29
36
|
}
|
|
30
|
-
|
|
37
|
+
if (!this.secret) {
|
|
38
|
+
throw new Error(`PaymentProvider is not configured: "secret" is missing for service ` +
|
|
39
|
+
`"${this.serviceName}" — it must match the gateway's PAYMENT_CLIENTS entry`);
|
|
40
|
+
}
|
|
41
|
+
const correlationId = (0, crypto_1.randomUUID)();
|
|
42
|
+
return {
|
|
43
|
+
serviceName: this.serviceName,
|
|
44
|
+
correlationId,
|
|
45
|
+
signature: (0, payment_signature_1.signPayload)(this.secret, data, correlationId),
|
|
46
|
+
data,
|
|
47
|
+
};
|
|
31
48
|
}
|
|
32
|
-
async
|
|
49
|
+
async request(routingKey, data) {
|
|
33
50
|
const res = await this.rabbit.request({
|
|
34
51
|
exchange: common_interface_1.PaymentRabbitApi.exchange,
|
|
35
|
-
routingKey
|
|
36
|
-
payload,
|
|
52
|
+
routingKey,
|
|
53
|
+
payload: this.envelope(data),
|
|
37
54
|
});
|
|
38
55
|
if (res.code !== 200) {
|
|
56
|
+
this.logger.error(`payment RPC ${routingKey} failed: ${res.message}`);
|
|
39
57
|
throw new Error(res.message);
|
|
40
58
|
}
|
|
41
59
|
return res.data;
|
|
42
60
|
}
|
|
61
|
+
async createStripeCheckout(payload) {
|
|
62
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_checkout.key, payload);
|
|
63
|
+
}
|
|
64
|
+
async createStripePaymentIntent(payload) {
|
|
65
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_intent.key, payload);
|
|
66
|
+
}
|
|
43
67
|
async createCryptoPayment(payload) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.crypto_intent.key, payload);
|
|
69
|
+
}
|
|
70
|
+
/// Query a payment intent's status by orderId. Resolves `null` when the
|
|
71
|
+
/// gateway has no intent for that order (code 200 with null data).
|
|
72
|
+
async getIntentStatus(payload) {
|
|
73
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.intent_status.key, payload);
|
|
74
|
+
}
|
|
75
|
+
/// Mark a Stripe intent shipped (post-fulfillment settlement).
|
|
76
|
+
async markShipped(payload) {
|
|
77
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_ship.key, payload);
|
|
78
|
+
}
|
|
79
|
+
/// Refund a Stripe intent (full or partial — decided gateway-side).
|
|
80
|
+
async refundStripeIntent(payload) {
|
|
81
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_refund.key, payload);
|
|
82
|
+
}
|
|
83
|
+
/// Cancel a Stripe intent before it is paid.
|
|
84
|
+
async cancelStripeIntent(payload) {
|
|
85
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_cancel.key, payload);
|
|
86
|
+
}
|
|
87
|
+
async getAvailableMethods() {
|
|
88
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.payment_methods.key, {});
|
|
89
|
+
}
|
|
90
|
+
async setPaymentMethodEnabled(payload) {
|
|
91
|
+
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.payment_methods_update.key, payload);
|
|
53
92
|
}
|
|
54
93
|
async availableMethods() {
|
|
55
94
|
const res = await this.rabbit.request({
|
|
@@ -64,7 +103,9 @@ let PaymentProvider = class PaymentProvider {
|
|
|
64
103
|
}
|
|
65
104
|
};
|
|
66
105
|
exports.PaymentProvider = PaymentProvider;
|
|
67
|
-
exports.PaymentProvider = PaymentProvider = __decorate([
|
|
106
|
+
exports.PaymentProvider = PaymentProvider = PaymentProvider_1 = __decorate([
|
|
68
107
|
(0, common_1.Injectable)(),
|
|
69
|
-
|
|
108
|
+
__param(1, (0, common_1.Optional)()),
|
|
109
|
+
__param(1, (0, common_1.Inject)("PAYMENT_PROVIDER_OPTIONS")),
|
|
110
|
+
__metadata("design:paramtypes", [nestjs_rabbitmq_1.AmqpConnection, Object])
|
|
70
111
|
], PaymentProvider);
|
package/dist/payment.webhook.js
CHANGED
|
@@ -21,7 +21,9 @@ const payment_signature_1 = require("./payment.signature");
|
|
|
21
21
|
/// The binding key must be known at decorator-evaluation time (module
|
|
22
22
|
/// load) — `this.serviceName` is not available there. Derived from the
|
|
23
23
|
/// same env the gateway uses to route per-service events.
|
|
24
|
-
|
|
24
|
+
/// `PAYMENT_CLIENT_NAME` is canonical (see the gateway's RPC-INTEGRATION
|
|
25
|
+
/// guide); `PAYMENT_SERVICE_NAME` is accepted as a fallback.
|
|
26
|
+
const WEBHOOK_ROUTING_KEY = () => `paymentEvents.${process.env.PAYMENT_CLIENT_NAME?.trim() || process.env.PAYMENT_SERVICE_NAME?.trim() || "default"}`;
|
|
25
27
|
exports.WEBHOOK_ROUTING_KEY = WEBHOOK_ROUTING_KEY;
|
|
26
28
|
let PaymentWebhookService = PaymentWebhookService_1 = class PaymentWebhookService {
|
|
27
29
|
constructor(options, rabbit) {
|