@ngn-net/payment-provider-sdk 1.0.13 → 1.0.15
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.
|
@@ -67,6 +67,11 @@ export interface RpcEnvelope<T = unknown> extends RpcClientContext {
|
|
|
67
67
|
export interface GetIntentByOrderId {
|
|
68
68
|
orderId: string;
|
|
69
69
|
}
|
|
70
|
+
export interface RefundStripeIntentDto {
|
|
71
|
+
orderId: string;
|
|
72
|
+
/** USD dollars — set for a partial refund; omit/undefined for full */
|
|
73
|
+
amountUsd?: number;
|
|
74
|
+
}
|
|
70
75
|
export interface UpdatePaymentMethodDto {
|
|
71
76
|
name: string;
|
|
72
77
|
enabled: boolean;
|
|
@@ -114,10 +119,12 @@ export interface StripePaymentCompleteEvent {
|
|
|
114
119
|
}
|
|
115
120
|
export interface CreateCryptoIntentResponse {
|
|
116
121
|
id: string;
|
|
117
|
-
paymentId
|
|
122
|
+
paymentId?: string | null;
|
|
118
123
|
amount: number;
|
|
119
|
-
payAdress
|
|
120
|
-
payAmount
|
|
124
|
+
payAdress?: string | null;
|
|
125
|
+
payAmount?: number | null;
|
|
126
|
+
invoiceUrl?: string;
|
|
127
|
+
invoiceId?: string;
|
|
121
128
|
}
|
|
122
129
|
export interface EventResponse<T> {
|
|
123
130
|
correlationId: string;
|
|
@@ -132,6 +139,10 @@ export interface NPCompleteEvent {
|
|
|
132
139
|
orderId: string;
|
|
133
140
|
amount: number;
|
|
134
141
|
amountRecieved: number;
|
|
142
|
+
/** crypto units the customer paid (e.g. 0.003) */
|
|
143
|
+
payAmount?: number | null;
|
|
144
|
+
/** asset ticker (btc, trx, …) */
|
|
145
|
+
payCurrency?: string | null;
|
|
135
146
|
}
|
|
136
147
|
export interface EventDataMap {
|
|
137
148
|
stripe_succeeded: StripePaymentCompleteEvent;
|
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
|
-
description?: string;
|
|
4
|
+
payCurrency?: PayCurrency;
|
|
7
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);
|
|
34
|
+
__decorate([
|
|
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);
|
|
38
40
|
__decorate([
|
|
39
|
-
(0, swagger_1.ApiPropertyOptional)({ example: "
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { CreateStripeCheckoutDto, CreateStripePaymentIntentDto } from "./dto/stripe.dto";
|
|
2
2
|
import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
|
|
3
|
-
import { AvailableMethodsResponse, CreateCryptoIntentResponse, CreateStripeCheckoutResponse, CreateStripePaymentIntentResponse, GetIntentByOrderId, IntentStatusResult, OrderActionResponse, UpdatePaymentMethodDto } from "./dto/common.interface";
|
|
3
|
+
import { AvailableMethodsResponse, CreateCryptoIntentResponse, CreateStripeCheckoutResponse, CreateStripePaymentIntentResponse, GetIntentByOrderId, IntentStatusResult, OrderActionResponse, RefundStripeIntentDto, UpdatePaymentMethodDto } from "./dto/common.interface";
|
|
4
4
|
import { CreateCryptoPaymentDto } from "./dto/crypto.dto";
|
|
5
5
|
export interface PaymentProviderOptions {
|
|
6
6
|
serviceName: string;
|
|
@@ -19,7 +19,7 @@ export declare class PaymentProvider {
|
|
|
19
19
|
createCryptoPayment(payload: CreateCryptoPaymentDto): Promise<CreateCryptoIntentResponse>;
|
|
20
20
|
getIntentStatus(payload: GetIntentByOrderId): Promise<IntentStatusResult | null>;
|
|
21
21
|
markShipped(payload: GetIntentByOrderId): Promise<OrderActionResponse>;
|
|
22
|
-
refundStripeIntent(payload:
|
|
22
|
+
refundStripeIntent(payload: RefundStripeIntentDto): Promise<OrderActionResponse>;
|
|
23
23
|
cancelStripeIntent(payload: GetIntentByOrderId): Promise<OrderActionResponse>;
|
|
24
24
|
getAvailableMethods(): Promise<AvailableMethodsResponse>;
|
|
25
25
|
setPaymentMethodEnabled(payload: UpdatePaymentMethodDto): Promise<AvailableMethodsResponse>;
|
package/dist/payment.provider.js
CHANGED
|
@@ -76,7 +76,8 @@ let PaymentProvider = PaymentProvider_1 = class PaymentProvider {
|
|
|
76
76
|
async markShipped(payload) {
|
|
77
77
|
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_ship.key, payload);
|
|
78
78
|
}
|
|
79
|
-
/// Refund a Stripe intent
|
|
79
|
+
/// Refund a Stripe intent. Pass `amountUsd` for a partial refund;
|
|
80
|
+
/// omit it for a full refund.
|
|
80
81
|
async refundStripeIntent(payload) {
|
|
81
82
|
return this.request(common_interface_1.PaymentRabbitApi.routingkeys.stripe_refund.key, payload);
|
|
82
83
|
}
|