@medusajs/payment 2.11.0-snapshot-20250828185926 → 2.11.0-snapshot-20251014110210
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/loaders/providers.js +1 -1
- package/dist/loaders/providers.js.map +1 -1
- package/dist/migrations/Migration20240225134525.d.ts +1 -1
- package/dist/migrations/Migration20240225134525.d.ts.map +1 -1
- package/dist/migrations/Migration20240225134525.js +1 -1
- package/dist/migrations/Migration20240225134525.js.map +1 -1
- package/dist/migrations/Migration20240806072619.d.ts +1 -1
- package/dist/migrations/Migration20240806072619.d.ts.map +1 -1
- package/dist/migrations/Migration20240806072619.js +1 -1
- package/dist/migrations/Migration20240806072619.js.map +1 -1
- package/dist/migrations/Migration20241211151053.d.ts +1 -1
- package/dist/migrations/Migration20241211151053.d.ts.map +1 -1
- package/dist/migrations/Migration20241211151053.js +1 -1
- package/dist/migrations/Migration20241211151053.js.map +1 -1
- package/dist/migrations/Migration20250115160517.d.ts +1 -1
- package/dist/migrations/Migration20250115160517.d.ts.map +1 -1
- package/dist/migrations/Migration20250115160517.js +1 -1
- package/dist/migrations/Migration20250115160517.js.map +1 -1
- package/dist/migrations/Migration20250120110552.d.ts +1 -1
- package/dist/migrations/Migration20250120110552.d.ts.map +1 -1
- package/dist/migrations/Migration20250120110552.js +1 -1
- package/dist/migrations/Migration20250120110552.js.map +1 -1
- package/dist/migrations/Migration20250123122334.d.ts +1 -1
- package/dist/migrations/Migration20250123122334.d.ts.map +1 -1
- package/dist/migrations/Migration20250123122334.js +1 -1
- package/dist/migrations/Migration20250123122334.js.map +1 -1
- package/dist/migrations/Migration20250206105639.d.ts +1 -1
- package/dist/migrations/Migration20250206105639.d.ts.map +1 -1
- package/dist/migrations/Migration20250206105639.js +1 -1
- package/dist/migrations/Migration20250206105639.js.map +1 -1
- package/dist/migrations/Migration20250207132723.d.ts +1 -1
- package/dist/migrations/Migration20250207132723.d.ts.map +1 -1
- package/dist/migrations/Migration20250207132723.js +1 -1
- package/dist/migrations/Migration20250207132723.js.map +1 -1
- package/dist/migrations/Migration20250625084134.d.ts +1 -1
- package/dist/migrations/Migration20250625084134.d.ts.map +1 -1
- package/dist/migrations/Migration20250625084134.js +1 -1
- package/dist/migrations/Migration20250625084134.js.map +1 -1
- package/dist/migrations/Migration20250924135437.d.ts +6 -0
- package/dist/migrations/Migration20250924135437.d.ts.map +1 -0
- package/dist/migrations/Migration20250924135437.js +37 -0
- package/dist/migrations/Migration20250924135437.js.map +1 -0
- package/dist/migrations/Migration20250929124701.d.ts +6 -0
- package/dist/migrations/Migration20250929124701.d.ts.map +1 -0
- package/dist/migrations/Migration20250929124701.js +23 -0
- package/dist/migrations/Migration20250929124701.js.map +1 -0
- package/dist/models/capture.d.ts +2 -0
- package/dist/models/capture.d.ts.map +1 -1
- package/dist/models/payment-collection.d.ts +6 -0
- package/dist/models/payment-collection.d.ts.map +1 -1
- package/dist/models/payment-provider.d.ts +6 -0
- package/dist/models/payment-provider.d.ts.map +1 -1
- package/dist/models/payment-session.d.ts +4 -0
- package/dist/models/payment-session.d.ts.map +1 -1
- package/dist/models/payment.d.ts +2 -0
- package/dist/models/payment.d.ts.map +1 -1
- package/dist/models/refund-reason.d.ts +1 -0
- package/dist/models/refund-reason.d.ts.map +1 -1
- package/dist/models/refund-reason.js +2 -1
- package/dist/models/refund-reason.js.map +1 -1
- package/dist/models/refund.d.ts +2 -0
- package/dist/models/refund.d.ts.map +1 -1
- package/dist/services/payment-module.d.ts +240 -6
- package/dist/services/payment-module.d.ts.map +1 -1
- package/dist/services/payment-module.js +38 -21
- package/dist/services/payment-module.js.map +1 -1
- package/dist/services/payment-provider.d.ts +5 -1
- package/dist/services/payment-provider.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -25
package/dist/models/payment.d.ts
CHANGED
|
@@ -58,12 +58,14 @@ declare const Payment: import("@medusajs/framework/utils").DmlEntity<import("@me
|
|
|
58
58
|
refund_reason: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
59
59
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
60
60
|
label: import("@medusajs/framework/utils").TextProperty;
|
|
61
|
+
code: import("@medusajs/framework/utils").TextProperty;
|
|
61
62
|
description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
62
63
|
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
63
64
|
refunds: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<any>, "Refund">>;
|
|
64
65
|
}>, "RefundReason">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
65
66
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
66
67
|
label: import("@medusajs/framework/utils").TextProperty;
|
|
68
|
+
code: import("@medusajs/framework/utils").TextProperty;
|
|
67
69
|
description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
68
70
|
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
69
71
|
refunds: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<any>, "Refund">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/models/payment.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,sBAAsB,CAAA;AAMpD,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/models/payment.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,sBAAsB,CAAA;AAMpD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCT,CAAA;AAEJ,eAAe,OAAO,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const RefundReason: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
2
2
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
3
3
|
label: import("@medusajs/framework/utils").TextProperty;
|
|
4
|
+
code: import("@medusajs/framework/utils").TextProperty;
|
|
4
5
|
description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
5
6
|
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
6
7
|
refunds: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-reason.d.ts","sourceRoot":"","sources":["../../src/models/refund-reason.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"refund-reason.d.ts","sourceRoot":"","sources":["../../src/models/refund-reason.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAShB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -8,7 +8,8 @@ const refund_1 = __importDefault(require("./refund"));
|
|
|
8
8
|
const RefundReason = utils_1.model.define("RefundReason", {
|
|
9
9
|
id: utils_1.model.id({ prefix: "refr" }).primaryKey(),
|
|
10
10
|
label: utils_1.model.text().searchable(),
|
|
11
|
-
|
|
11
|
+
code: utils_1.model.text().searchable(),
|
|
12
|
+
description: utils_1.model.text().searchable().nullable(),
|
|
12
13
|
metadata: utils_1.model.json().nullable(),
|
|
13
14
|
refunds: utils_1.model.hasMany(() => refund_1.default, {
|
|
14
15
|
mappedBy: "refund_reason",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-reason.js","sourceRoot":"","sources":["../../src/models/refund-reason.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,sDAA6B;AAE7B,MAAM,YAAY,GAAG,aAAK,CAAC,MAAM,CAAC,cAAc,EAAE;IAChD,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE;IAC7C,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAChC,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"refund-reason.js","sourceRoot":"","sources":["../../src/models/refund-reason.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,sDAA6B;AAE7B,MAAM,YAAY,GAAG,aAAK,CAAC,MAAM,CAAC,cAAc,EAAE;IAChD,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE;IAC7C,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAChC,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC/B,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE;IACjD,QAAQ,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,aAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAM,EAAE;QACnC,QAAQ,EAAE,eAAe;KAC1B,CAAC;CACH,CAAC,CAAA;AAEF,kBAAe,YAAY,CAAA"}
|
package/dist/models/refund.d.ts
CHANGED
|
@@ -65,12 +65,14 @@ declare const Refund: import("@medusajs/framework/utils").DmlEntity<import("@med
|
|
|
65
65
|
refund_reason: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
66
66
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
67
67
|
label: import("@medusajs/framework/utils").TextProperty;
|
|
68
|
+
code: import("@medusajs/framework/utils").TextProperty;
|
|
68
69
|
description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
69
70
|
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
70
71
|
refunds: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<any>, "Refund">>;
|
|
71
72
|
}>, "RefundReason">, import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
72
73
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
73
74
|
label: import("@medusajs/framework/utils").TextProperty;
|
|
75
|
+
code: import("@medusajs/framework/utils").TextProperty;
|
|
74
76
|
description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
75
77
|
metadata: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
76
78
|
refunds: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<any>, "Refund">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../src/models/refund.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../src/models/refund.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAqBR,CAAA;AAEJ,eAAe,MAAM,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountHolderDTO, BigNumberInput, CaptureDTO, Context, CreateAccountHolderDTO, CreateCaptureDTO, CreatePaymentCollectionDTO, CreatePaymentMethodDTO, CreatePaymentSessionDTO, CreateRefundDTO, DAL, FilterablePaymentCollectionProps, FilterablePaymentMethodProps, FilterablePaymentProviderProps, FindConfig, InferEntityType, InternalModuleDeclaration, IPaymentModuleService, Logger, ModuleJoinerConfig, ModulesSdkTypes, PaymentCollectionDTO, PaymentCollectionUpdatableFields, PaymentDTO, PaymentMethodDTO, PaymentProviderDTO, PaymentSessionDTO, ProviderWebhookPayload, RefundDTO, RefundReasonDTO, UpdateAccountHolderDTO, UpdatePaymentCollectionDTO, UpdatePaymentDTO, UpdatePaymentSessionDTO, UpsertPaymentCollectionDTO, WebhookActionResult } from "@medusajs/framework/types";
|
|
2
|
-
import { ModulesSdkUtils, PaymentSessionStatus } from "@medusajs/framework/utils";
|
|
2
|
+
import { ModulesSdkUtils, PaymentCollectionStatus, PaymentSessionStatus } from "@medusajs/framework/utils";
|
|
3
3
|
import { AccountHolder, Capture, Payment, PaymentCollection, PaymentSession, Refund } from "../models";
|
|
4
4
|
import PaymentProviderService from "./payment-provider";
|
|
5
5
|
type InjectedDependencies = {
|
|
@@ -57,6 +57,7 @@ export default class PaymentModuleService extends PaymentModuleService_base impl
|
|
|
57
57
|
updatePaymentCollections_(data: UpdatePaymentCollectionDTO[], sharedContext?: Context): Promise<InferEntityType<typeof PaymentCollection>[]>;
|
|
58
58
|
upsertPaymentCollections(data: UpsertPaymentCollectionDTO[], sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
|
59
59
|
upsertPaymentCollections(data: UpsertPaymentCollectionDTO, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
|
60
|
+
protected upsertPaymentCollections_(data: UpsertPaymentCollectionDTO | UpsertPaymentCollectionDTO[], sharedContext?: Context): Promise<InferEntityType<typeof PaymentCollection>[]>;
|
|
60
61
|
completePaymentCollections(paymentCollectionId: string, sharedContext?: Context): Promise<PaymentCollectionDTO>;
|
|
61
62
|
completePaymentCollections(paymentCollectionId: string[], sharedContext?: Context): Promise<PaymentCollectionDTO[]>;
|
|
62
63
|
createPaymentSession(paymentCollectionId: string, input: CreatePaymentSessionDTO, sharedContext?: Context): Promise<PaymentSessionDTO>;
|
|
@@ -64,16 +65,249 @@ export default class PaymentModuleService extends PaymentModuleService_base impl
|
|
|
64
65
|
updatePaymentSession(data: UpdatePaymentSessionDTO, sharedContext?: Context): Promise<PaymentSessionDTO>;
|
|
65
66
|
deletePaymentSession(id: string, sharedContext?: Context): Promise<void>;
|
|
66
67
|
authorizePaymentSession(id: string, context: Record<string, unknown>, sharedContext?: Context): Promise<PaymentDTO>;
|
|
67
|
-
authorizePaymentSession_(session: InferEntityType<typeof PaymentSession>, data: Record<string, unknown> | undefined, status: PaymentSessionStatus, sharedContext?: Context): Promise<InferEntityType<typeof Payment>>;
|
|
68
|
+
protected authorizePaymentSession_(session: InferEntityType<typeof PaymentSession>, data: Record<string, unknown> | undefined, status: PaymentSessionStatus, sharedContext?: Context): Promise<InferEntityType<typeof Payment>>;
|
|
68
69
|
updatePayment(data: UpdatePaymentDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
|
69
70
|
capturePayment(data: CreateCaptureDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
protected capturePayment_(data: CreateCaptureDTO, payment: InferEntityType<typeof Payment>, sharedContext?: Context): Promise<{
|
|
72
|
+
isFullyCaptured: boolean;
|
|
73
|
+
capture?: InferEntityType<typeof Capture>;
|
|
74
|
+
}>;
|
|
75
|
+
protected capturePaymentFromProvider_(payment: InferEntityType<typeof Payment>, capture: InferEntityType<typeof Capture> | undefined, isFullyCaptured: boolean, sharedContext?: Context): Promise<{
|
|
76
|
+
id: string;
|
|
77
|
+
amount: number;
|
|
78
|
+
currency_code: string;
|
|
79
|
+
provider_id: string;
|
|
80
|
+
data: Record<string, unknown> | null;
|
|
81
|
+
metadata: Record<string, unknown> | null;
|
|
82
|
+
captured_at: Date | null;
|
|
83
|
+
canceled_at: Date | null;
|
|
84
|
+
payment_collection: {
|
|
85
|
+
id: string;
|
|
86
|
+
currency_code: string;
|
|
87
|
+
amount: number;
|
|
88
|
+
authorized_amount: number | null;
|
|
89
|
+
captured_amount: number | null;
|
|
90
|
+
refunded_amount: number | null;
|
|
91
|
+
completed_at: Date | null;
|
|
92
|
+
status: PaymentCollectionStatus;
|
|
93
|
+
metadata: Record<string, unknown> | null;
|
|
94
|
+
payment_providers: {
|
|
95
|
+
id: string;
|
|
96
|
+
is_enabled: boolean;
|
|
97
|
+
payment_collections: any[];
|
|
98
|
+
created_at: Date;
|
|
99
|
+
updated_at: Date;
|
|
100
|
+
deleted_at: Date | null;
|
|
101
|
+
}[];
|
|
102
|
+
payment_sessions: {
|
|
103
|
+
id: string;
|
|
104
|
+
currency_code: string;
|
|
105
|
+
amount: number;
|
|
106
|
+
provider_id: string;
|
|
107
|
+
data: Record<string, unknown>;
|
|
108
|
+
context: Record<string, unknown> | null;
|
|
109
|
+
status: PaymentSessionStatus;
|
|
110
|
+
authorized_at: Date | null;
|
|
111
|
+
payment_collection: any;
|
|
112
|
+
payment: any;
|
|
113
|
+
metadata: Record<string, unknown> | null;
|
|
114
|
+
raw_amount: Record<string, unknown>;
|
|
115
|
+
created_at: Date;
|
|
116
|
+
updated_at: Date;
|
|
117
|
+
deleted_at: Date | null;
|
|
118
|
+
payment_collection_id: string;
|
|
119
|
+
}[];
|
|
120
|
+
payments: any[];
|
|
121
|
+
raw_amount: Record<string, unknown>;
|
|
122
|
+
raw_authorized_amount: Record<string, unknown> | null;
|
|
123
|
+
raw_captured_amount: Record<string, unknown> | null;
|
|
124
|
+
raw_refunded_amount: Record<string, unknown> | null;
|
|
125
|
+
created_at: Date;
|
|
126
|
+
updated_at: Date;
|
|
127
|
+
deleted_at: Date | null;
|
|
128
|
+
};
|
|
129
|
+
payment_session: {
|
|
130
|
+
id: string;
|
|
131
|
+
currency_code: string;
|
|
132
|
+
amount: number;
|
|
133
|
+
provider_id: string;
|
|
134
|
+
data: Record<string, unknown>;
|
|
135
|
+
context: Record<string, unknown> | null;
|
|
136
|
+
status: PaymentSessionStatus;
|
|
137
|
+
authorized_at: Date | null;
|
|
138
|
+
payment_collection: any;
|
|
139
|
+
payment: any;
|
|
140
|
+
metadata: Record<string, unknown> | null;
|
|
141
|
+
raw_amount: Record<string, unknown>;
|
|
142
|
+
created_at: Date;
|
|
143
|
+
updated_at: Date;
|
|
144
|
+
deleted_at: Date | null;
|
|
145
|
+
payment_collection_id: string;
|
|
146
|
+
};
|
|
147
|
+
refunds: {
|
|
148
|
+
id: string;
|
|
149
|
+
amount: number;
|
|
150
|
+
payment: any;
|
|
151
|
+
refund_reason: {
|
|
152
|
+
id: string;
|
|
153
|
+
label: string;
|
|
154
|
+
code: string;
|
|
155
|
+
description: string | null;
|
|
156
|
+
metadata: Record<string, unknown> | null;
|
|
157
|
+
refunds: any[];
|
|
158
|
+
created_at: Date;
|
|
159
|
+
updated_at: Date;
|
|
160
|
+
deleted_at: Date | null;
|
|
161
|
+
};
|
|
162
|
+
note: string | null;
|
|
163
|
+
created_by: string | null;
|
|
164
|
+
metadata: Record<string, unknown> | null;
|
|
165
|
+
raw_amount: Record<string, unknown>;
|
|
166
|
+
created_at: Date;
|
|
167
|
+
updated_at: Date;
|
|
168
|
+
deleted_at: Date | null;
|
|
169
|
+
payment_id: string;
|
|
170
|
+
refund_reason_id: string | null;
|
|
171
|
+
}[];
|
|
172
|
+
captures: {
|
|
173
|
+
id: string;
|
|
174
|
+
amount: number;
|
|
175
|
+
payment: any;
|
|
176
|
+
metadata: Record<string, unknown> | null;
|
|
177
|
+
created_by: string | null;
|
|
178
|
+
raw_amount: Record<string, unknown>;
|
|
179
|
+
created_at: Date;
|
|
180
|
+
updated_at: Date;
|
|
181
|
+
deleted_at: Date | null;
|
|
182
|
+
payment_id: string;
|
|
183
|
+
}[];
|
|
184
|
+
raw_amount: Record<string, unknown>;
|
|
185
|
+
created_at: Date;
|
|
186
|
+
updated_at: Date;
|
|
187
|
+
deleted_at: Date | null;
|
|
188
|
+
payment_collection_id: string;
|
|
189
|
+
payment_session_id: string;
|
|
190
|
+
}>;
|
|
72
191
|
refundPayment(data: CreateRefundDTO, sharedContext?: Context): Promise<PaymentDTO>;
|
|
73
192
|
private refundPayment_;
|
|
74
|
-
|
|
193
|
+
protected refundPaymentFromProvider_(payment: InferEntityType<typeof Payment>, refund: InferEntityType<typeof Refund>, sharedContext?: Context): Promise<{
|
|
194
|
+
id: string;
|
|
195
|
+
amount: number;
|
|
196
|
+
currency_code: string;
|
|
197
|
+
provider_id: string;
|
|
198
|
+
data: Record<string, unknown> | null;
|
|
199
|
+
metadata: Record<string, unknown> | null;
|
|
200
|
+
captured_at: Date | null;
|
|
201
|
+
canceled_at: Date | null;
|
|
202
|
+
payment_collection: {
|
|
203
|
+
id: string;
|
|
204
|
+
currency_code: string;
|
|
205
|
+
amount: number;
|
|
206
|
+
authorized_amount: number | null;
|
|
207
|
+
captured_amount: number | null;
|
|
208
|
+
refunded_amount: number | null;
|
|
209
|
+
completed_at: Date | null;
|
|
210
|
+
status: PaymentCollectionStatus;
|
|
211
|
+
metadata: Record<string, unknown> | null;
|
|
212
|
+
payment_providers: {
|
|
213
|
+
id: string;
|
|
214
|
+
is_enabled: boolean;
|
|
215
|
+
payment_collections: any[];
|
|
216
|
+
created_at: Date;
|
|
217
|
+
updated_at: Date;
|
|
218
|
+
deleted_at: Date | null;
|
|
219
|
+
}[];
|
|
220
|
+
payment_sessions: {
|
|
221
|
+
id: string;
|
|
222
|
+
currency_code: string;
|
|
223
|
+
amount: number;
|
|
224
|
+
provider_id: string;
|
|
225
|
+
data: Record<string, unknown>;
|
|
226
|
+
context: Record<string, unknown> | null;
|
|
227
|
+
status: PaymentSessionStatus;
|
|
228
|
+
authorized_at: Date | null;
|
|
229
|
+
payment_collection: any;
|
|
230
|
+
payment: any;
|
|
231
|
+
metadata: Record<string, unknown> | null;
|
|
232
|
+
raw_amount: Record<string, unknown>;
|
|
233
|
+
created_at: Date;
|
|
234
|
+
updated_at: Date;
|
|
235
|
+
deleted_at: Date | null;
|
|
236
|
+
payment_collection_id: string;
|
|
237
|
+
}[];
|
|
238
|
+
payments: any[];
|
|
239
|
+
raw_amount: Record<string, unknown>;
|
|
240
|
+
raw_authorized_amount: Record<string, unknown> | null;
|
|
241
|
+
raw_captured_amount: Record<string, unknown> | null;
|
|
242
|
+
raw_refunded_amount: Record<string, unknown> | null;
|
|
243
|
+
created_at: Date;
|
|
244
|
+
updated_at: Date;
|
|
245
|
+
deleted_at: Date | null;
|
|
246
|
+
};
|
|
247
|
+
payment_session: {
|
|
248
|
+
id: string;
|
|
249
|
+
currency_code: string;
|
|
250
|
+
amount: number;
|
|
251
|
+
provider_id: string;
|
|
252
|
+
data: Record<string, unknown>;
|
|
253
|
+
context: Record<string, unknown> | null;
|
|
254
|
+
status: PaymentSessionStatus;
|
|
255
|
+
authorized_at: Date | null;
|
|
256
|
+
payment_collection: any;
|
|
257
|
+
payment: any;
|
|
258
|
+
metadata: Record<string, unknown> | null;
|
|
259
|
+
raw_amount: Record<string, unknown>;
|
|
260
|
+
created_at: Date;
|
|
261
|
+
updated_at: Date;
|
|
262
|
+
deleted_at: Date | null;
|
|
263
|
+
payment_collection_id: string;
|
|
264
|
+
};
|
|
265
|
+
refunds: {
|
|
266
|
+
id: string;
|
|
267
|
+
amount: number;
|
|
268
|
+
payment: any;
|
|
269
|
+
refund_reason: {
|
|
270
|
+
id: string;
|
|
271
|
+
label: string;
|
|
272
|
+
code: string;
|
|
273
|
+
description: string | null;
|
|
274
|
+
metadata: Record<string, unknown> | null;
|
|
275
|
+
refunds: any[];
|
|
276
|
+
created_at: Date;
|
|
277
|
+
updated_at: Date;
|
|
278
|
+
deleted_at: Date | null;
|
|
279
|
+
};
|
|
280
|
+
note: string | null;
|
|
281
|
+
created_by: string | null;
|
|
282
|
+
metadata: Record<string, unknown> | null;
|
|
283
|
+
raw_amount: Record<string, unknown>;
|
|
284
|
+
created_at: Date;
|
|
285
|
+
updated_at: Date;
|
|
286
|
+
deleted_at: Date | null;
|
|
287
|
+
payment_id: string;
|
|
288
|
+
refund_reason_id: string | null;
|
|
289
|
+
}[];
|
|
290
|
+
captures: {
|
|
291
|
+
id: string;
|
|
292
|
+
amount: number;
|
|
293
|
+
payment: any;
|
|
294
|
+
metadata: Record<string, unknown> | null;
|
|
295
|
+
created_by: string | null;
|
|
296
|
+
raw_amount: Record<string, unknown>;
|
|
297
|
+
created_at: Date;
|
|
298
|
+
updated_at: Date;
|
|
299
|
+
deleted_at: Date | null;
|
|
300
|
+
payment_id: string;
|
|
301
|
+
}[];
|
|
302
|
+
raw_amount: Record<string, unknown>;
|
|
303
|
+
created_at: Date;
|
|
304
|
+
updated_at: Date;
|
|
305
|
+
deleted_at: Date | null;
|
|
306
|
+
payment_collection_id: string;
|
|
307
|
+
payment_session_id: string;
|
|
308
|
+
}>;
|
|
75
309
|
cancelPayment(paymentId: string, sharedContext?: Context): Promise<PaymentDTO>;
|
|
76
|
-
|
|
310
|
+
protected maybeUpdatePaymentCollection_(paymentCollectionId: string, sharedContext?: Context): Promise<void>;
|
|
77
311
|
listPaymentProviders(filters?: FilterablePaymentProviderProps, config?: FindConfig<PaymentProviderDTO>, sharedContext?: Context): Promise<PaymentProviderDTO[]>;
|
|
78
312
|
listAndCountPaymentProviders(filters?: FilterablePaymentProviderProps, config?: FindConfig<PaymentProviderDTO>, sharedContext?: Context): Promise<[PaymentProviderDTO[], number]>;
|
|
79
313
|
createAccountHolder(input: CreateAccountHolderDTO, sharedContext?: Context): Promise<AccountHolderDTO>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-module.d.ts","sourceRoot":"","sources":["../../src/services/payment-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,sBAAsB,EAEtB,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,GAAG,EACH,gCAAgC,EAChC,4BAA4B,EAC5B,8BAA8B,EAC9B,UAAU,EACV,eAAe,EAEf,yBAAyB,EACzB,qBAAqB,EACrB,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,gCAAgC,EAChC,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,sBAAsB,EAEtB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"payment-module.d.ts","sourceRoot":"","sources":["../../src/services/payment-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,sBAAsB,EAEtB,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,GAAG,EACH,gCAAgC,EAChC,4BAA4B,EAC5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, sharedContext) {
|
|
60
60
|
const input = Array.isArray(data) ? data : [data];
|
|
61
61
|
const collections = await this.createPaymentCollections_(input, sharedContext);
|
|
62
|
-
return await this.baseRepository_.serialize(Array.isArray(data) ? collections : collections[0]
|
|
63
|
-
populate: true,
|
|
64
|
-
});
|
|
62
|
+
return await this.baseRepository_.serialize(Array.isArray(data) ? collections : collections[0]);
|
|
65
63
|
}
|
|
66
64
|
async createPaymentCollections_(data, sharedContext) {
|
|
67
65
|
return await this.paymentCollectionService_.create(data, sharedContext);
|
|
@@ -85,14 +83,16 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
85
83
|
}));
|
|
86
84
|
}
|
|
87
85
|
const result = await this.updatePaymentCollections_(updateData, sharedContext);
|
|
88
|
-
return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]
|
|
89
|
-
populate: true,
|
|
90
|
-
});
|
|
86
|
+
return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
|
|
91
87
|
}
|
|
92
88
|
async updatePaymentCollections_(data, sharedContext) {
|
|
93
89
|
return await this.paymentCollectionService_.update(data, sharedContext);
|
|
94
90
|
}
|
|
95
91
|
async upsertPaymentCollections(data, sharedContext) {
|
|
92
|
+
const result = await this.upsertPaymentCollections_(data, sharedContext);
|
|
93
|
+
return await this.baseRepository_.serialize(Array.isArray(data) ? result : result[0]);
|
|
94
|
+
}
|
|
95
|
+
async upsertPaymentCollections_(data, sharedContext) {
|
|
96
96
|
const input = Array.isArray(data) ? data : [data];
|
|
97
97
|
const forUpdate = input.filter((collection) => !!collection.id);
|
|
98
98
|
const forCreate = input.filter((collection) => !collection.id);
|
|
@@ -104,7 +104,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
104
104
|
operations.push(this.updatePaymentCollections_(forUpdate, sharedContext));
|
|
105
105
|
}
|
|
106
106
|
const result = (await (0, utils_1.promiseAll)(operations)).flat();
|
|
107
|
-
return
|
|
107
|
+
return result;
|
|
108
108
|
}
|
|
109
109
|
// Should we remove this and use `updatePaymentCollections` instead?
|
|
110
110
|
async completePaymentCollections(paymentCollectionId, sharedContext) {
|
|
@@ -116,7 +116,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
116
116
|
: [{ id: paymentCollectionId, completed_at: new Date() }];
|
|
117
117
|
// TODO: what checks should be done here? e.g. captured_amount === amount?
|
|
118
118
|
const updated = await this.paymentCollectionService_.update(input, sharedContext);
|
|
119
|
-
return await this.baseRepository_.serialize(Array.isArray(paymentCollectionId) ? updated : updated[0]
|
|
119
|
+
return await this.baseRepository_.serialize(Array.isArray(paymentCollectionId) ? updated : updated[0]);
|
|
120
120
|
}
|
|
121
121
|
async createPaymentSession(paymentCollectionId, input, sharedContext) {
|
|
122
122
|
let paymentSession;
|
|
@@ -180,7 +180,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
180
180
|
status: data.status ?? providerData.status ?? session.status,
|
|
181
181
|
metadata: data.metadata,
|
|
182
182
|
}, sharedContext);
|
|
183
|
-
return await this.baseRepository_.serialize(updated
|
|
183
|
+
return await this.baseRepository_.serialize(updated);
|
|
184
184
|
}
|
|
185
185
|
async deletePaymentSession(id, sharedContext) {
|
|
186
186
|
const session = await this.paymentSessionService_.retrieve(id, { select: ["id", "data", "provider_id"] }, sharedContext);
|
|
@@ -205,9 +205,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
205
205
|
}, sharedContext);
|
|
206
206
|
// this method needs to be idempotent
|
|
207
207
|
if (session.payment && session.authorized_at) {
|
|
208
|
-
return await this.baseRepository_.serialize(session.payment
|
|
209
|
-
populate: true,
|
|
210
|
-
});
|
|
208
|
+
return await this.baseRepository_.serialize(session.payment);
|
|
211
209
|
}
|
|
212
210
|
let { data, status } = await this.paymentProviderService_.authorizePayment(session.provider_id, {
|
|
213
211
|
data: session.data,
|
|
@@ -237,9 +235,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
237
235
|
throw error;
|
|
238
236
|
}
|
|
239
237
|
await this.maybeUpdatePaymentCollection_(session.payment_collection_id, sharedContext);
|
|
240
|
-
return await this.baseRepository_.serialize(payment
|
|
241
|
-
populate: true,
|
|
242
|
-
});
|
|
238
|
+
return await this.baseRepository_.serialize(payment);
|
|
243
239
|
}
|
|
244
240
|
async authorizePaymentSession_(session, data, status, sharedContext) {
|
|
245
241
|
let autoCapture = false;
|
|
@@ -302,9 +298,7 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
302
298
|
throw error;
|
|
303
299
|
}
|
|
304
300
|
await this.maybeUpdatePaymentCollection_(payment.payment_collection_id, sharedContext);
|
|
305
|
-
return await this.baseRepository_.serialize(payment
|
|
306
|
-
populate: true,
|
|
307
|
-
});
|
|
301
|
+
return await this.baseRepository_.serialize(payment);
|
|
308
302
|
}
|
|
309
303
|
async capturePayment_(data, payment, sharedContext = {}) {
|
|
310
304
|
if (payment.canceled_at) {
|
|
@@ -577,7 +571,8 @@ class PaymentModuleService extends utils_1.ModulesSdkUtils.MedusaService(generat
|
|
|
577
571
|
}
|
|
578
572
|
exports.default = PaymentModuleService;
|
|
579
573
|
__decorate([
|
|
580
|
-
(0, utils_1.InjectManager)()
|
|
574
|
+
(0, utils_1.InjectManager)(),
|
|
575
|
+
(0, utils_1.EmitEvents)()
|
|
581
576
|
// @ts-expect-error
|
|
582
577
|
,
|
|
583
578
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
@@ -593,7 +588,8 @@ __decorate([
|
|
|
593
588
|
__metadata("design:returntype", Promise)
|
|
594
589
|
], PaymentModuleService.prototype, "createPaymentCollections_", null);
|
|
595
590
|
__decorate([
|
|
596
|
-
(0, utils_1.InjectManager)()
|
|
591
|
+
(0, utils_1.InjectManager)(),
|
|
592
|
+
(0, utils_1.EmitEvents)()
|
|
597
593
|
// @ts-expect-error
|
|
598
594
|
,
|
|
599
595
|
__param(2, (0, utils_1.MedusaContext)()),
|
|
@@ -602,7 +598,7 @@ __decorate([
|
|
|
602
598
|
__metadata("design:returntype", Promise)
|
|
603
599
|
], PaymentModuleService.prototype, "updatePaymentCollections", null);
|
|
604
600
|
__decorate([
|
|
605
|
-
(0, utils_1.
|
|
601
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
606
602
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
607
603
|
__metadata("design:type", Function),
|
|
608
604
|
__metadata("design:paramtypes", [Array, Object]),
|
|
@@ -610,13 +606,22 @@ __decorate([
|
|
|
610
606
|
], PaymentModuleService.prototype, "updatePaymentCollections_", null);
|
|
611
607
|
__decorate([
|
|
612
608
|
(0, utils_1.InjectManager)(),
|
|
609
|
+
(0, utils_1.EmitEvents)(),
|
|
613
610
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
614
611
|
__metadata("design:type", Function),
|
|
615
612
|
__metadata("design:paramtypes", [Object, Object]),
|
|
616
613
|
__metadata("design:returntype", Promise)
|
|
617
614
|
], PaymentModuleService.prototype, "upsertPaymentCollections", null);
|
|
615
|
+
__decorate([
|
|
616
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
617
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
|
618
|
+
__metadata("design:type", Function),
|
|
619
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
620
|
+
__metadata("design:returntype", Promise)
|
|
621
|
+
], PaymentModuleService.prototype, "upsertPaymentCollections_", null);
|
|
618
622
|
__decorate([
|
|
619
623
|
(0, utils_1.InjectManager)(),
|
|
624
|
+
(0, utils_1.EmitEvents)(),
|
|
620
625
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
621
626
|
__metadata("design:type", Function),
|
|
622
627
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -624,6 +629,7 @@ __decorate([
|
|
|
624
629
|
], PaymentModuleService.prototype, "completePaymentCollections", null);
|
|
625
630
|
__decorate([
|
|
626
631
|
(0, utils_1.InjectManager)(),
|
|
632
|
+
(0, utils_1.EmitEvents)(),
|
|
627
633
|
__param(2, (0, utils_1.MedusaContext)()),
|
|
628
634
|
__metadata("design:type", Function),
|
|
629
635
|
__metadata("design:paramtypes", [String, Object, Object]),
|
|
@@ -638,6 +644,7 @@ __decorate([
|
|
|
638
644
|
], PaymentModuleService.prototype, "createPaymentSession_", null);
|
|
639
645
|
__decorate([
|
|
640
646
|
(0, utils_1.InjectManager)(),
|
|
647
|
+
(0, utils_1.EmitEvents)(),
|
|
641
648
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
642
649
|
__metadata("design:type", Function),
|
|
643
650
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -645,6 +652,7 @@ __decorate([
|
|
|
645
652
|
], PaymentModuleService.prototype, "updatePaymentSession", null);
|
|
646
653
|
__decorate([
|
|
647
654
|
(0, utils_1.InjectManager)(),
|
|
655
|
+
(0, utils_1.EmitEvents)(),
|
|
648
656
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
649
657
|
__metadata("design:type", Function),
|
|
650
658
|
__metadata("design:paramtypes", [String, Object]),
|
|
@@ -652,6 +660,7 @@ __decorate([
|
|
|
652
660
|
], PaymentModuleService.prototype, "deletePaymentSession", null);
|
|
653
661
|
__decorate([
|
|
654
662
|
(0, utils_1.InjectManager)(),
|
|
663
|
+
(0, utils_1.EmitEvents)(),
|
|
655
664
|
__param(2, (0, utils_1.MedusaContext)()),
|
|
656
665
|
__metadata("design:type", Function),
|
|
657
666
|
__metadata("design:paramtypes", [String, Object, Object]),
|
|
@@ -666,6 +675,7 @@ __decorate([
|
|
|
666
675
|
], PaymentModuleService.prototype, "authorizePaymentSession_", null);
|
|
667
676
|
__decorate([
|
|
668
677
|
(0, utils_1.InjectManager)(),
|
|
678
|
+
(0, utils_1.EmitEvents)(),
|
|
669
679
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
670
680
|
__metadata("design:type", Function),
|
|
671
681
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -673,6 +683,7 @@ __decorate([
|
|
|
673
683
|
], PaymentModuleService.prototype, "updatePayment", null);
|
|
674
684
|
__decorate([
|
|
675
685
|
(0, utils_1.InjectManager)(),
|
|
686
|
+
(0, utils_1.EmitEvents)(),
|
|
676
687
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
677
688
|
__metadata("design:type", Function),
|
|
678
689
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -694,6 +705,7 @@ __decorate([
|
|
|
694
705
|
], PaymentModuleService.prototype, "capturePaymentFromProvider_", null);
|
|
695
706
|
__decorate([
|
|
696
707
|
(0, utils_1.InjectManager)(),
|
|
708
|
+
(0, utils_1.EmitEvents)(),
|
|
697
709
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
698
710
|
__metadata("design:type", Function),
|
|
699
711
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -715,6 +727,7 @@ __decorate([
|
|
|
715
727
|
], PaymentModuleService.prototype, "refundPaymentFromProvider_", null);
|
|
716
728
|
__decorate([
|
|
717
729
|
(0, utils_1.InjectManager)(),
|
|
730
|
+
(0, utils_1.EmitEvents)(),
|
|
718
731
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
719
732
|
__metadata("design:type", Function),
|
|
720
733
|
__metadata("design:paramtypes", [String, Object]),
|
|
@@ -742,6 +755,7 @@ __decorate([
|
|
|
742
755
|
], PaymentModuleService.prototype, "listAndCountPaymentProviders", null);
|
|
743
756
|
__decorate([
|
|
744
757
|
(0, utils_1.InjectManager)(),
|
|
758
|
+
(0, utils_1.EmitEvents)(),
|
|
745
759
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
746
760
|
__metadata("design:type", Function),
|
|
747
761
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -749,6 +763,7 @@ __decorate([
|
|
|
749
763
|
], PaymentModuleService.prototype, "createAccountHolder", null);
|
|
750
764
|
__decorate([
|
|
751
765
|
(0, utils_1.InjectManager)(),
|
|
766
|
+
(0, utils_1.EmitEvents)(),
|
|
752
767
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
753
768
|
__metadata("design:type", Function),
|
|
754
769
|
__metadata("design:paramtypes", [Object, Object]),
|
|
@@ -756,6 +771,7 @@ __decorate([
|
|
|
756
771
|
], PaymentModuleService.prototype, "updateAccountHolder", null);
|
|
757
772
|
__decorate([
|
|
758
773
|
(0, utils_1.InjectManager)(),
|
|
774
|
+
(0, utils_1.EmitEvents)(),
|
|
759
775
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
760
776
|
__metadata("design:type", Function),
|
|
761
777
|
__metadata("design:paramtypes", [String, Object]),
|
|
@@ -777,6 +793,7 @@ __decorate([
|
|
|
777
793
|
], PaymentModuleService.prototype, "listAndCountPaymentMethods", null);
|
|
778
794
|
__decorate([
|
|
779
795
|
(0, utils_1.InjectManager)(),
|
|
796
|
+
(0, utils_1.EmitEvents)(),
|
|
780
797
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
781
798
|
__metadata("design:type", Function),
|
|
782
799
|
__metadata("design:paramtypes", [Object, Object]),
|