@infrab4a/connect 4.1.2-beta.0 → 4.1.2-beta.10
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/index.cjs.js +842 -487
- package/index.esm.js +828 -488
- package/package.json +2 -1
- package/src/domain/general/index.d.ts +2 -0
- package/src/domain/general/models/index.d.ts +1 -0
- package/src/domain/general/models/sequences.d.ts +9 -0
- package/src/domain/general/repositories/index.d.ts +1 -0
- package/src/domain/general/repositories/sequences.repository.d.ts +4 -0
- package/src/domain/index.d.ts +4 -3
- package/src/domain/shop-settings/models/types/index.d.ts +0 -2
- package/src/domain/shop-settings/models/types/sections.type.d.ts +0 -3
- package/src/domain/shopping/enums/index.d.ts +2 -0
- package/src/domain/shopping/enums/payment-methods.enum.d.ts +5 -0
- package/src/domain/shopping/enums/payment-providers.enum.d.ts +4 -0
- package/src/domain/shopping/factories/adyen-payment-method.factory.d.ts +8 -0
- package/src/domain/shopping/factories/base-payment-method.factory.d.ts +7 -0
- package/src/domain/shopping/factories/glampoints-payment-method.factory.d.ts +8 -0
- package/src/domain/shopping/factories/index.d.ts +4 -0
- package/src/domain/shopping/factories/pagarme-payment-method.factory.d.ts +10 -0
- package/src/domain/shopping/factories/payment-provider.factory.d.ts +14 -0
- package/src/domain/shopping/index.d.ts +2 -0
- package/src/domain/shopping/interfaces/index.d.ts +6 -0
- package/src/domain/shopping/interfaces/payment-method-factory.interface.d.ts +14 -0
- package/src/domain/shopping/interfaces/payment-provider-bank-slip.interface.d.ts +5 -0
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +6 -0
- package/src/domain/shopping/interfaces/payment-provider-glampoints.interface.d.ts +5 -0
- package/src/domain/shopping/interfaces/payment-provider-pix.interface.d.ts +5 -0
- package/src/domain/shopping/interfaces/payment-provider.interface.d.ts +6 -0
- package/src/domain/shopping/models/index.d.ts +3 -0
- package/src/domain/shopping/models/order-blocked.d.ts +26 -0
- package/src/domain/shopping/models/order.d.ts +2 -2
- package/src/domain/shopping/models/payment.d.ts +7 -61
- package/src/domain/shopping/models/payment.transaction.d.ts +66 -0
- package/src/domain/shopping/models/types/index.d.ts +4 -4
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +4 -0
- package/src/domain/shopping/services/adyen-card-payment.service.d.ts +28 -0
- package/src/domain/shopping/services/antifraude.service.d.ts +19 -0
- package/src/domain/shopping/services/glampoints-payment.service.d.ts +4 -0
- package/src/domain/shopping/services/index.d.ts +5 -0
- package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +8 -0
- package/src/domain/shopping/services/pagarme-card-payment.service.d.ts +10 -0
- package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +8 -0
- package/src/domain/shopping/types/adyen-credentials.type.d.ts +6 -0
- package/src/domain/shopping/types/index.d.ts +5 -0
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +5 -0
- package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
- package/src/domain/shopping/types/payment-method.type.d.ts +2 -0
- package/src/domain/shopping/types/payment-provider.type.d.ts +2 -0
- package/src/infra/firebase/firestore/repositories/general/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +7 -0
- package/src/infra/firebase/firestore/repositories/index.d.ts +3 -2
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +7 -0
- package/src/domain/shop-settings/models/types/landing-page.d.ts +0 -8
- package/teste2.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
|
|
3
2
|
import * as tslib_1 from 'tslib';
|
|
4
3
|
import { __decorate, __metadata, __rest } from 'tslib';
|
|
4
|
+
import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
|
|
5
5
|
import { parseISO } from 'date-fns';
|
|
6
6
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
7
7
|
import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
@@ -9,10 +9,38 @@ export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil,
|
|
|
9
9
|
import { debug } from 'debug';
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
11
11
|
import axios from 'axios';
|
|
12
|
+
import * as moment from 'moment';
|
|
12
13
|
import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
|
|
13
14
|
import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
14
15
|
import { mutation, query as query$1 } from 'gql-query-builder';
|
|
15
16
|
|
|
17
|
+
class BasePaymentMethodFactory {
|
|
18
|
+
constructor(methods) {
|
|
19
|
+
this.methods = methods;
|
|
20
|
+
}
|
|
21
|
+
build(method) {
|
|
22
|
+
return this.methods[method];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class PaymentProviderFactory {
|
|
36
|
+
constructor(paymentProviders) {
|
|
37
|
+
this.paymentProviders = paymentProviders;
|
|
38
|
+
}
|
|
39
|
+
build(provider) {
|
|
40
|
+
return this.paymentProviders[provider];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
class BaseModel {
|
|
17
45
|
get identifier() {
|
|
18
46
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -36,6 +64,181 @@ class BaseModel {
|
|
|
36
64
|
}
|
|
37
65
|
}
|
|
38
66
|
|
|
67
|
+
class Filter extends BaseModel {
|
|
68
|
+
static get identifiersFields() {
|
|
69
|
+
return ['id'];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class CategoryBase extends BaseModel {
|
|
74
|
+
static get identifiersFields() {
|
|
75
|
+
return ['id'];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
__decorate([
|
|
79
|
+
Type(() => CategoryBase),
|
|
80
|
+
__metadata("design:type", CategoryBase)
|
|
81
|
+
], CategoryBase.prototype, "parent", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
Type(() => Filter),
|
|
84
|
+
__metadata("design:type", Array)
|
|
85
|
+
], CategoryBase.prototype, "filters", void 0);
|
|
86
|
+
|
|
87
|
+
class CategoryForProduct extends CategoryBase {
|
|
88
|
+
static get identifiersFields() {
|
|
89
|
+
return ['id'];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class ProductBase extends BaseModel {
|
|
94
|
+
get evaluation() {
|
|
95
|
+
return {
|
|
96
|
+
reviews: this.reviews,
|
|
97
|
+
count: this.reviewsTotal,
|
|
98
|
+
rating: this.rate,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
set evaluation(evaluation) {
|
|
102
|
+
if (!evaluation) {
|
|
103
|
+
this.reviews = null;
|
|
104
|
+
this.reviewsTotal = null;
|
|
105
|
+
this.rate = null;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
109
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
110
|
+
this.rate = evaluation.rating || this.rate;
|
|
111
|
+
}
|
|
112
|
+
static get identifiersFields() {
|
|
113
|
+
return ['id'];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class ProductForKit extends ProductBase {
|
|
118
|
+
static get identifiersFields() {
|
|
119
|
+
return ['id'];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
__decorate([
|
|
123
|
+
Type(() => CategoryForProduct),
|
|
124
|
+
__metadata("design:type", CategoryForProduct)
|
|
125
|
+
], ProductForKit.prototype, "category", void 0);
|
|
126
|
+
|
|
127
|
+
class KitProduct extends BaseModel {
|
|
128
|
+
static get identifiersFields() {
|
|
129
|
+
return ['productId', 'kitProductId'];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
__decorate([
|
|
133
|
+
Type(() => ProductForKit),
|
|
134
|
+
__metadata("design:type", ProductForKit)
|
|
135
|
+
], KitProduct.prototype, "kit", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
Type(() => ProductForKit),
|
|
138
|
+
__metadata("design:type", ProductForKit)
|
|
139
|
+
], KitProduct.prototype, "product", void 0);
|
|
140
|
+
|
|
141
|
+
class ProductForCategory extends ProductBase {
|
|
142
|
+
static get identifiersFields() {
|
|
143
|
+
return ['id'];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
__decorate([
|
|
147
|
+
Type(() => KitProduct),
|
|
148
|
+
__metadata("design:type", Array)
|
|
149
|
+
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
150
|
+
|
|
151
|
+
class Category extends CategoryBase {
|
|
152
|
+
static get identifiersFields() {
|
|
153
|
+
return ['id'];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
__decorate([
|
|
157
|
+
Type(() => ProductForCategory),
|
|
158
|
+
__metadata("design:type", Array)
|
|
159
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
160
|
+
|
|
161
|
+
class CategoryCollectionChildren extends BaseModel {
|
|
162
|
+
static get identifiersFields() {
|
|
163
|
+
return ['collectionId', 'categoryId'];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
__decorate([
|
|
167
|
+
Type(() => CategoryCollectionChildren),
|
|
168
|
+
__metadata("design:type", CategoryCollectionChildren)
|
|
169
|
+
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
170
|
+
|
|
171
|
+
class CategoryFilter extends BaseModel {
|
|
172
|
+
static get identifiersFields() {
|
|
173
|
+
return ['id'];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
__decorate([
|
|
177
|
+
Type(() => Filter),
|
|
178
|
+
__metadata("design:type", Filter)
|
|
179
|
+
], CategoryFilter.prototype, "filter", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
Type(() => Category),
|
|
182
|
+
__metadata("design:type", Category)
|
|
183
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
184
|
+
|
|
185
|
+
var GenderDestination;
|
|
186
|
+
(function (GenderDestination) {
|
|
187
|
+
GenderDestination["FEMALE"] = "female";
|
|
188
|
+
GenderDestination["MALE"] = "male";
|
|
189
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
190
|
+
})(GenderDestination || (GenderDestination = {}));
|
|
191
|
+
|
|
192
|
+
var Shops;
|
|
193
|
+
(function (Shops) {
|
|
194
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
195
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
196
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
197
|
+
Shops["ALL"] = "ALL";
|
|
198
|
+
})(Shops || (Shops = {}));
|
|
199
|
+
|
|
200
|
+
class FilterOption extends BaseModel {
|
|
201
|
+
static get identifiersFields() {
|
|
202
|
+
return ['id'];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
class Product extends ProductBase {
|
|
207
|
+
static get identifiersFields() {
|
|
208
|
+
return ['id'];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
__decorate([
|
|
212
|
+
Type(() => CategoryForProduct),
|
|
213
|
+
__metadata("design:type", CategoryForProduct)
|
|
214
|
+
], Product.prototype, "category", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
Type(() => KitProduct),
|
|
217
|
+
__metadata("design:type", Array)
|
|
218
|
+
], Product.prototype, "kitProducts", void 0);
|
|
219
|
+
|
|
220
|
+
class Variant extends BaseModel {
|
|
221
|
+
static get identifiersFields() {
|
|
222
|
+
return ['id', 'productId'];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
class Wishlist extends Category {
|
|
227
|
+
static get identifiersFields() {
|
|
228
|
+
return ['id'];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
class Buy2Win extends BaseModel {
|
|
233
|
+
static get identifiersFields() {
|
|
234
|
+
return ['id'];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
__decorate([
|
|
238
|
+
Type(() => Category),
|
|
239
|
+
__metadata("design:type", Array)
|
|
240
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
241
|
+
|
|
39
242
|
var Where;
|
|
40
243
|
(function (Where) {
|
|
41
244
|
Where["EQUALS"] = "==";
|
|
@@ -61,6 +264,18 @@ var UpdateOptionActions;
|
|
|
61
264
|
UpdateOptionActions["NULL"] = "null";
|
|
62
265
|
})(UpdateOptionActions || (UpdateOptionActions = {}));
|
|
63
266
|
|
|
267
|
+
class CampaignDashboard extends BaseModel {
|
|
268
|
+
static get identifiersFields() {
|
|
269
|
+
return ['id'];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
class CampaignHashtag extends BaseModel {
|
|
274
|
+
static get identifiersFields() {
|
|
275
|
+
return ['id'];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
64
279
|
var AccessoryImportances;
|
|
65
280
|
(function (AccessoryImportances) {
|
|
66
281
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -287,171 +502,178 @@ class Edition extends BaseModel {
|
|
|
287
502
|
}
|
|
288
503
|
}
|
|
289
504
|
|
|
290
|
-
class
|
|
291
|
-
static get identifiersFields() {
|
|
292
|
-
return ['id'];
|
|
293
|
-
}
|
|
505
|
+
class PaymentTransaction extends BaseModel {
|
|
294
506
|
}
|
|
295
507
|
__decorate([
|
|
296
508
|
Expose({ name: 'refuse_reason' }),
|
|
297
509
|
__metadata("design:type", String)
|
|
298
|
-
],
|
|
510
|
+
], PaymentTransaction.prototype, "refuseReason", void 0);
|
|
299
511
|
__decorate([
|
|
300
512
|
Expose({ name: 'status_reason' }),
|
|
301
513
|
__metadata("design:type", String)
|
|
302
|
-
],
|
|
514
|
+
], PaymentTransaction.prototype, "statusReason", void 0);
|
|
303
515
|
__decorate([
|
|
304
516
|
Expose({ name: 'acquirer_response_code' }),
|
|
305
517
|
__metadata("design:type", String)
|
|
306
|
-
],
|
|
518
|
+
], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
|
|
307
519
|
__decorate([
|
|
308
520
|
Expose({ name: 'acquirer_name' }),
|
|
309
521
|
__metadata("design:type", String)
|
|
310
|
-
],
|
|
522
|
+
], PaymentTransaction.prototype, "acquirerName", void 0);
|
|
311
523
|
__decorate([
|
|
312
524
|
Expose({ name: 'acquirer_id' }),
|
|
313
525
|
__metadata("design:type", String)
|
|
314
|
-
],
|
|
526
|
+
], PaymentTransaction.prototype, "acquirerId", void 0);
|
|
315
527
|
__decorate([
|
|
316
528
|
Expose({ name: 'authorization_code' }),
|
|
317
529
|
__metadata("design:type", String)
|
|
318
|
-
],
|
|
530
|
+
], PaymentTransaction.prototype, "authorizationCode", void 0);
|
|
319
531
|
__decorate([
|
|
320
532
|
Expose({ name: 'soft_descriptor' }),
|
|
321
533
|
__metadata("design:type", String)
|
|
322
|
-
],
|
|
534
|
+
], PaymentTransaction.prototype, "softDescriptor", void 0);
|
|
323
535
|
__decorate([
|
|
324
536
|
Expose({ name: 'date_created' }),
|
|
325
537
|
__metadata("design:type", String)
|
|
326
|
-
],
|
|
538
|
+
], PaymentTransaction.prototype, "dateCreated", void 0);
|
|
327
539
|
__decorate([
|
|
328
540
|
Expose({ name: 'date_updated' }),
|
|
329
541
|
__metadata("design:type", String)
|
|
330
|
-
],
|
|
542
|
+
], PaymentTransaction.prototype, "dateUpdated", void 0);
|
|
331
543
|
__decorate([
|
|
332
544
|
Expose({ name: 'authorized_amount' }),
|
|
333
545
|
__metadata("design:type", Number)
|
|
334
|
-
],
|
|
546
|
+
], PaymentTransaction.prototype, "authorizedAmount", void 0);
|
|
335
547
|
__decorate([
|
|
336
548
|
Expose({ name: 'paid_amount' }),
|
|
337
549
|
__metadata("design:type", Number)
|
|
338
|
-
],
|
|
550
|
+
], PaymentTransaction.prototype, "paidAmount", void 0);
|
|
339
551
|
__decorate([
|
|
340
552
|
Expose({ name: 'refunded_amount' }),
|
|
341
553
|
__metadata("design:type", Number)
|
|
342
|
-
],
|
|
554
|
+
], PaymentTransaction.prototype, "refundedAmount", void 0);
|
|
343
555
|
__decorate([
|
|
344
556
|
Expose({ name: 'card_holder_name' }),
|
|
345
557
|
__metadata("design:type", String)
|
|
346
|
-
],
|
|
558
|
+
], PaymentTransaction.prototype, "cardHolderName", void 0);
|
|
347
559
|
__decorate([
|
|
348
560
|
Expose({ name: 'card_last_digits' }),
|
|
349
561
|
__metadata("design:type", String)
|
|
350
|
-
],
|
|
562
|
+
], PaymentTransaction.prototype, "cardLastDigits", void 0);
|
|
351
563
|
__decorate([
|
|
352
564
|
Expose({ name: 'card_first_digits' }),
|
|
353
565
|
__metadata("design:type", String)
|
|
354
|
-
],
|
|
566
|
+
], PaymentTransaction.prototype, "cardFirstDigits", void 0);
|
|
355
567
|
__decorate([
|
|
356
568
|
Expose({ name: 'card_brand' }),
|
|
357
569
|
__metadata("design:type", String)
|
|
358
|
-
],
|
|
570
|
+
], PaymentTransaction.prototype, "cardBrand", void 0);
|
|
359
571
|
__decorate([
|
|
360
572
|
Expose({ name: 'card_pin_mode' }),
|
|
361
573
|
__metadata("design:type", String)
|
|
362
|
-
],
|
|
574
|
+
], PaymentTransaction.prototype, "cardPinMode", void 0);
|
|
363
575
|
__decorate([
|
|
364
576
|
Expose({ name: 'card_magstripe_fallback' }),
|
|
365
577
|
__metadata("design:type", Boolean)
|
|
366
|
-
],
|
|
578
|
+
], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
|
|
367
579
|
__decorate([
|
|
368
580
|
Expose({ name: 'cvm_pin' }),
|
|
369
581
|
__metadata("design:type", Boolean)
|
|
370
|
-
],
|
|
582
|
+
], PaymentTransaction.prototype, "cvmPin", void 0);
|
|
371
583
|
__decorate([
|
|
372
584
|
Expose({ name: 'postback_url' }),
|
|
373
585
|
__metadata("design:type", String)
|
|
374
|
-
],
|
|
586
|
+
], PaymentTransaction.prototype, "postbackUrl", void 0);
|
|
375
587
|
__decorate([
|
|
376
588
|
Expose({ name: 'payment_method' }),
|
|
377
589
|
__metadata("design:type", String)
|
|
378
|
-
],
|
|
590
|
+
], PaymentTransaction.prototype, "paymentMethod", void 0);
|
|
379
591
|
__decorate([
|
|
380
592
|
Expose({ name: 'capture_method' }),
|
|
381
593
|
__metadata("design:type", String)
|
|
382
|
-
],
|
|
594
|
+
], PaymentTransaction.prototype, "captureMethod", void 0);
|
|
383
595
|
__decorate([
|
|
384
596
|
Expose({ name: 'antifraud_score' }),
|
|
385
597
|
__metadata("design:type", String)
|
|
386
|
-
],
|
|
598
|
+
], PaymentTransaction.prototype, "antifraudScore", void 0);
|
|
387
599
|
__decorate([
|
|
388
600
|
Expose({ name: 'boleto_url' }),
|
|
389
601
|
__metadata("design:type", String)
|
|
390
|
-
],
|
|
602
|
+
], PaymentTransaction.prototype, "boletoUrl", void 0);
|
|
391
603
|
__decorate([
|
|
392
604
|
Expose({ name: 'boleto_barcode' }),
|
|
393
605
|
__metadata("design:type", String)
|
|
394
|
-
],
|
|
606
|
+
], PaymentTransaction.prototype, "boletoBarcode", void 0);
|
|
395
607
|
__decorate([
|
|
396
608
|
Expose({ name: 'boleto_expiration_date' }),
|
|
397
609
|
__metadata("design:type", String)
|
|
398
|
-
],
|
|
610
|
+
], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
|
|
399
611
|
__decorate([
|
|
400
612
|
Expose({ name: 'subscription_id' }),
|
|
401
613
|
__metadata("design:type", String)
|
|
402
|
-
],
|
|
614
|
+
], PaymentTransaction.prototype, "subscriptionId", void 0);
|
|
403
615
|
__decorate([
|
|
404
616
|
Expose({ name: 'split_rules' }),
|
|
405
617
|
__metadata("design:type", String)
|
|
406
|
-
],
|
|
618
|
+
], PaymentTransaction.prototype, "splitRules", void 0);
|
|
407
619
|
__decorate([
|
|
408
620
|
Expose({ name: 'antifraud_metadata' }),
|
|
409
621
|
__metadata("design:type", Object)
|
|
410
|
-
],
|
|
622
|
+
], PaymentTransaction.prototype, "antifraudMetadata", void 0);
|
|
411
623
|
__decorate([
|
|
412
624
|
Expose({ name: 'reference_key' }),
|
|
413
625
|
__metadata("design:type", String)
|
|
414
|
-
],
|
|
626
|
+
], PaymentTransaction.prototype, "referenceKey", void 0);
|
|
415
627
|
__decorate([
|
|
416
628
|
Expose({ name: 'local_transaction_id' }),
|
|
417
629
|
__metadata("design:type", String)
|
|
418
|
-
],
|
|
630
|
+
], PaymentTransaction.prototype, "localTransactionId", void 0);
|
|
419
631
|
__decorate([
|
|
420
632
|
Expose({ name: 'local_time' }),
|
|
421
633
|
__metadata("design:type", String)
|
|
422
|
-
],
|
|
634
|
+
], PaymentTransaction.prototype, "localTime", void 0);
|
|
423
635
|
__decorate([
|
|
424
636
|
Expose({ name: 'fraud_covered' }),
|
|
425
637
|
__metadata("design:type", Boolean)
|
|
426
|
-
],
|
|
638
|
+
], PaymentTransaction.prototype, "fraudCovered", void 0);
|
|
427
639
|
__decorate([
|
|
428
640
|
Expose({ name: 'fraud_reimbursed' }),
|
|
429
641
|
__metadata("design:type", String)
|
|
430
|
-
],
|
|
642
|
+
], PaymentTransaction.prototype, "fraudReimbursed", void 0);
|
|
431
643
|
__decorate([
|
|
432
644
|
Expose({ name: 'order_id' }),
|
|
433
645
|
__metadata("design:type", String)
|
|
434
|
-
],
|
|
646
|
+
], PaymentTransaction.prototype, "orderId", void 0);
|
|
435
647
|
__decorate([
|
|
436
648
|
Expose({ name: 'risk_level' }),
|
|
437
649
|
__metadata("design:type", String)
|
|
438
|
-
],
|
|
650
|
+
], PaymentTransaction.prototype, "riskLevel", void 0);
|
|
439
651
|
__decorate([
|
|
440
652
|
Expose({ name: 'receipt_url' }),
|
|
441
653
|
__metadata("design:type", String)
|
|
442
|
-
],
|
|
654
|
+
], PaymentTransaction.prototype, "receiptUrl", void 0);
|
|
443
655
|
__decorate([
|
|
444
656
|
Expose({ name: 'private_label' }),
|
|
445
657
|
__metadata("design:type", String)
|
|
446
|
-
],
|
|
658
|
+
], PaymentTransaction.prototype, "privateLabel", void 0);
|
|
447
659
|
__decorate([
|
|
448
660
|
Expose({ name: 'pix_qr_code' }),
|
|
449
661
|
__metadata("design:type", String)
|
|
450
|
-
],
|
|
662
|
+
], PaymentTransaction.prototype, "pixQrCode", void 0);
|
|
451
663
|
__decorate([
|
|
452
664
|
Expose({ name: 'pix_expiration_date' }),
|
|
453
665
|
__metadata("design:type", String)
|
|
454
|
-
],
|
|
666
|
+
], PaymentTransaction.prototype, "pixExpirationDate", void 0);
|
|
667
|
+
|
|
668
|
+
class Payment extends BaseModel {
|
|
669
|
+
static get identifiersFields() {
|
|
670
|
+
return ['id'];
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
__decorate([
|
|
674
|
+
Type(() => PaymentTransaction),
|
|
675
|
+
__metadata("design:type", PaymentTransaction)
|
|
676
|
+
], Payment.prototype, "transaction", void 0);
|
|
455
677
|
|
|
456
678
|
class SubscriptionPayment extends BaseModel {
|
|
457
679
|
static get identifiersFields() {
|
|
@@ -1963,231 +2185,44 @@ class RecoveryPassword {
|
|
|
1963
2185
|
}
|
|
1964
2186
|
}
|
|
1965
2187
|
|
|
1966
|
-
class
|
|
2188
|
+
class LineItem extends Product {
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
class ShippingMethod extends BaseModel {
|
|
1967
2192
|
static get identifiersFields() {
|
|
1968
2193
|
return ['id'];
|
|
1969
2194
|
}
|
|
1970
2195
|
}
|
|
1971
2196
|
|
|
1972
|
-
class
|
|
2197
|
+
class Checkout extends BaseModel {
|
|
1973
2198
|
static get identifiersFields() {
|
|
1974
2199
|
return ['id'];
|
|
1975
2200
|
}
|
|
1976
2201
|
}
|
|
1977
2202
|
__decorate([
|
|
1978
|
-
Type(() =>
|
|
1979
|
-
__metadata("design:type", CategoryBase)
|
|
1980
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
1981
|
-
__decorate([
|
|
1982
|
-
Type(() => Filter),
|
|
2203
|
+
Type(() => LineItem),
|
|
1983
2204
|
__metadata("design:type", Array)
|
|
1984
|
-
],
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
return;
|
|
2006
|
-
}
|
|
2007
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
2008
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
2009
|
-
this.rate = evaluation.rating || this.rate;
|
|
2010
|
-
}
|
|
2011
|
-
static get identifiersFields() {
|
|
2012
|
-
return ['id'];
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
class ProductForKit extends ProductBase {
|
|
2017
|
-
static get identifiersFields() {
|
|
2018
|
-
return ['id'];
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
__decorate([
|
|
2022
|
-
Type(() => CategoryForProduct),
|
|
2023
|
-
__metadata("design:type", CategoryForProduct)
|
|
2024
|
-
], ProductForKit.prototype, "category", void 0);
|
|
2025
|
-
|
|
2026
|
-
class KitProduct extends BaseModel {
|
|
2027
|
-
static get identifiersFields() {
|
|
2028
|
-
return ['productId', 'kitProductId'];
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
__decorate([
|
|
2032
|
-
Type(() => ProductForKit),
|
|
2033
|
-
__metadata("design:type", ProductForKit)
|
|
2034
|
-
], KitProduct.prototype, "kit", void 0);
|
|
2035
|
-
__decorate([
|
|
2036
|
-
Type(() => ProductForKit),
|
|
2037
|
-
__metadata("design:type", ProductForKit)
|
|
2038
|
-
], KitProduct.prototype, "product", void 0);
|
|
2039
|
-
|
|
2040
|
-
class ProductForCategory extends ProductBase {
|
|
2041
|
-
static get identifiersFields() {
|
|
2042
|
-
return ['id'];
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
__decorate([
|
|
2046
|
-
Type(() => KitProduct),
|
|
2047
|
-
__metadata("design:type", Array)
|
|
2048
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
2049
|
-
|
|
2050
|
-
class Category extends CategoryBase {
|
|
2051
|
-
static get identifiersFields() {
|
|
2052
|
-
return ['id'];
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
__decorate([
|
|
2056
|
-
Type(() => ProductForCategory),
|
|
2057
|
-
__metadata("design:type", Array)
|
|
2058
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
2059
|
-
|
|
2060
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
2061
|
-
static get identifiersFields() {
|
|
2062
|
-
return ['collectionId', 'categoryId'];
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
__decorate([
|
|
2066
|
-
Type(() => CategoryCollectionChildren),
|
|
2067
|
-
__metadata("design:type", CategoryCollectionChildren)
|
|
2068
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
2069
|
-
|
|
2070
|
-
class CategoryFilter extends BaseModel {
|
|
2071
|
-
static get identifiersFields() {
|
|
2072
|
-
return ['id'];
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
__decorate([
|
|
2076
|
-
Type(() => Filter),
|
|
2077
|
-
__metadata("design:type", Filter)
|
|
2078
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
2079
|
-
__decorate([
|
|
2080
|
-
Type(() => Category),
|
|
2081
|
-
__metadata("design:type", Category)
|
|
2082
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
2083
|
-
|
|
2084
|
-
var GenderDestination;
|
|
2085
|
-
(function (GenderDestination) {
|
|
2086
|
-
GenderDestination["FEMALE"] = "female";
|
|
2087
|
-
GenderDestination["MALE"] = "male";
|
|
2088
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
2089
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
2090
|
-
|
|
2091
|
-
var Shops;
|
|
2092
|
-
(function (Shops) {
|
|
2093
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
2094
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
2095
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
2096
|
-
Shops["ALL"] = "ALL";
|
|
2097
|
-
})(Shops || (Shops = {}));
|
|
2098
|
-
|
|
2099
|
-
class FilterOption extends BaseModel {
|
|
2100
|
-
static get identifiersFields() {
|
|
2101
|
-
return ['id'];
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
class Product extends ProductBase {
|
|
2106
|
-
static get identifiersFields() {
|
|
2107
|
-
return ['id'];
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
__decorate([
|
|
2111
|
-
Type(() => CategoryForProduct),
|
|
2112
|
-
__metadata("design:type", CategoryForProduct)
|
|
2113
|
-
], Product.prototype, "category", void 0);
|
|
2114
|
-
__decorate([
|
|
2115
|
-
Type(() => KitProduct),
|
|
2116
|
-
__metadata("design:type", Array)
|
|
2117
|
-
], Product.prototype, "kitProducts", void 0);
|
|
2118
|
-
|
|
2119
|
-
class Variant extends BaseModel {
|
|
2120
|
-
static get identifiersFields() {
|
|
2121
|
-
return ['id', 'productId'];
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
class Wishlist extends Category {
|
|
2126
|
-
static get identifiersFields() {
|
|
2127
|
-
return ['id'];
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
class Buy2Win extends BaseModel {
|
|
2132
|
-
static get identifiersFields() {
|
|
2133
|
-
return ['id'];
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
__decorate([
|
|
2137
|
-
Type(() => Category),
|
|
2138
|
-
__metadata("design:type", Array)
|
|
2139
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
2140
|
-
|
|
2141
|
-
class CampaignDashboard extends BaseModel {
|
|
2142
|
-
static get identifiersFields() {
|
|
2143
|
-
return ['id'];
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
class CampaignHashtag extends BaseModel {
|
|
2148
|
-
static get identifiersFields() {
|
|
2149
|
-
return ['id'];
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
class LineItem extends Product {
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
class ShippingMethod extends BaseModel {
|
|
2157
|
-
static get identifiersFields() {
|
|
2158
|
-
return ['id'];
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
class Checkout extends BaseModel {
|
|
2163
|
-
static get identifiersFields() {
|
|
2164
|
-
return ['id'];
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
__decorate([
|
|
2168
|
-
Type(() => LineItem),
|
|
2169
|
-
__metadata("design:type", Array)
|
|
2170
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
2171
|
-
__decorate([
|
|
2172
|
-
Type(() => User),
|
|
2173
|
-
__metadata("design:type", User)
|
|
2174
|
-
], Checkout.prototype, "user", void 0);
|
|
2175
|
-
__decorate([
|
|
2176
|
-
Type(() => UserAddress),
|
|
2177
|
-
__metadata("design:type", UserAddress)
|
|
2178
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
2179
|
-
__decorate([
|
|
2180
|
-
Type(() => UserAddress),
|
|
2181
|
-
__metadata("design:type", UserAddress)
|
|
2182
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
2183
|
-
__decorate([
|
|
2184
|
-
Type(() => ShippingMethod),
|
|
2185
|
-
__metadata("design:type", ShippingMethod)
|
|
2186
|
-
], Checkout.prototype, "shipping", void 0);
|
|
2187
|
-
__decorate([
|
|
2188
|
-
Type(() => Coupon),
|
|
2189
|
-
__metadata("design:type", Coupon)
|
|
2190
|
-
], Checkout.prototype, "coupon", void 0);
|
|
2205
|
+
], Checkout.prototype, "lineItems", void 0);
|
|
2206
|
+
__decorate([
|
|
2207
|
+
Type(() => User),
|
|
2208
|
+
__metadata("design:type", User)
|
|
2209
|
+
], Checkout.prototype, "user", void 0);
|
|
2210
|
+
__decorate([
|
|
2211
|
+
Type(() => UserAddress),
|
|
2212
|
+
__metadata("design:type", UserAddress)
|
|
2213
|
+
], Checkout.prototype, "shippingAddress", void 0);
|
|
2214
|
+
__decorate([
|
|
2215
|
+
Type(() => UserAddress),
|
|
2216
|
+
__metadata("design:type", UserAddress)
|
|
2217
|
+
], Checkout.prototype, "billingAddress", void 0);
|
|
2218
|
+
__decorate([
|
|
2219
|
+
Type(() => ShippingMethod),
|
|
2220
|
+
__metadata("design:type", ShippingMethod)
|
|
2221
|
+
], Checkout.prototype, "shipping", void 0);
|
|
2222
|
+
__decorate([
|
|
2223
|
+
Type(() => Coupon),
|
|
2224
|
+
__metadata("design:type", Coupon)
|
|
2225
|
+
], Checkout.prototype, "coupon", void 0);
|
|
2191
2226
|
|
|
2192
2227
|
var OrderStatus;
|
|
2193
2228
|
(function (OrderStatus) {
|
|
@@ -2204,10 +2239,16 @@ var OrderStatus;
|
|
|
2204
2239
|
class Order extends Checkout {
|
|
2205
2240
|
}
|
|
2206
2241
|
__decorate([
|
|
2207
|
-
Type(() =>
|
|
2208
|
-
__metadata("design:type",
|
|
2242
|
+
Type(() => PaymentTransaction),
|
|
2243
|
+
__metadata("design:type", PaymentTransaction)
|
|
2209
2244
|
], Order.prototype, "payment", void 0);
|
|
2210
2245
|
|
|
2246
|
+
class OrderBlocked extends BaseModel {
|
|
2247
|
+
static get identifiersFields() {
|
|
2248
|
+
return ['id'];
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2211
2252
|
class CheckoutSubscription extends BaseModel {
|
|
2212
2253
|
static get identifiersFields() {
|
|
2213
2254
|
return ['id'];
|
|
@@ -2230,6 +2271,277 @@ __decorate([
|
|
|
2230
2271
|
__metadata("design:type", Coupon)
|
|
2231
2272
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2232
2273
|
|
|
2274
|
+
class AdyenCardService {
|
|
2275
|
+
constructor(credentials) {
|
|
2276
|
+
this.credentials = credentials;
|
|
2277
|
+
}
|
|
2278
|
+
async pay(checkout, card) {
|
|
2279
|
+
try {
|
|
2280
|
+
const result = await axios({
|
|
2281
|
+
method: 'POST',
|
|
2282
|
+
url: this.credentials.URL_TRANSACTION,
|
|
2283
|
+
headers: {
|
|
2284
|
+
'x-api-key': this.credentials.API_KEY,
|
|
2285
|
+
'content-type': 'application/json',
|
|
2286
|
+
},
|
|
2287
|
+
data: this.createCardPayment(checkout, card),
|
|
2288
|
+
});
|
|
2289
|
+
if (result.data.resultCode !== 'Authorised') {
|
|
2290
|
+
this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2291
|
+
return Promise.reject(new Error(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`));
|
|
2292
|
+
}
|
|
2293
|
+
const payment = {
|
|
2294
|
+
createdAt: new Date(),
|
|
2295
|
+
updatedAt: new Date(),
|
|
2296
|
+
userId: checkout.user.id,
|
|
2297
|
+
checkoutId: checkout.id,
|
|
2298
|
+
totalPrice: checkout.totalPrice,
|
|
2299
|
+
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2300
|
+
};
|
|
2301
|
+
return payment;
|
|
2302
|
+
}
|
|
2303
|
+
catch (error) { }
|
|
2304
|
+
}
|
|
2305
|
+
createCardPayment(checkout, card) {
|
|
2306
|
+
return {
|
|
2307
|
+
amount: {
|
|
2308
|
+
currency: 'BRL',
|
|
2309
|
+
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2310
|
+
},
|
|
2311
|
+
paymentMethod: {
|
|
2312
|
+
type: 'scheme',
|
|
2313
|
+
storedPaymentMethodId: card.cardId,
|
|
2314
|
+
},
|
|
2315
|
+
reference: checkout.id,
|
|
2316
|
+
shopperInteraction: 'Ecommerce',
|
|
2317
|
+
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2318
|
+
shopperReference: checkout.user.id,
|
|
2319
|
+
recurringProcessingModel: 'CardOnFile',
|
|
2320
|
+
returnUrl: this.credentials.URL_POSTBACK,
|
|
2321
|
+
installments: {
|
|
2322
|
+
value: card.installments,
|
|
2323
|
+
},
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
addCard() {
|
|
2327
|
+
throw new Error('Method not implemented.');
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
class GlampointsPaymentService {
|
|
2332
|
+
pay(checkout) {
|
|
2333
|
+
const payment = {
|
|
2334
|
+
createdAt: new Date(),
|
|
2335
|
+
updatedAt: new Date(),
|
|
2336
|
+
userId: checkout.user.id,
|
|
2337
|
+
checkoutId: checkout.id,
|
|
2338
|
+
totalPrice: checkout.totalPrice,
|
|
2339
|
+
transaction: {
|
|
2340
|
+
amount: 0,
|
|
2341
|
+
acquirerResponseCode: '0000',
|
|
2342
|
+
acquirerName: 'glampoints',
|
|
2343
|
+
authorizedAmount: 0,
|
|
2344
|
+
captureMethod: 'ecommerce',
|
|
2345
|
+
installments: 1,
|
|
2346
|
+
cost: 0,
|
|
2347
|
+
paidAmount: 0,
|
|
2348
|
+
paymentMethod: 'glampoints',
|
|
2349
|
+
referer: 'api_key',
|
|
2350
|
+
refundedAmount: 0,
|
|
2351
|
+
status: 'paid',
|
|
2352
|
+
statusReason: 'acquirer',
|
|
2353
|
+
},
|
|
2354
|
+
};
|
|
2355
|
+
return Promise.resolve(payment);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
class PagarmeBankSlipService {
|
|
2360
|
+
constructor(credentials) {
|
|
2361
|
+
this.credentials = credentials;
|
|
2362
|
+
}
|
|
2363
|
+
async pay(checkout) {
|
|
2364
|
+
try {
|
|
2365
|
+
const result = await axios({
|
|
2366
|
+
method: 'POST',
|
|
2367
|
+
url: this.credentials.URL_TRANSACTION,
|
|
2368
|
+
data: this.createBoletoPayment(checkout),
|
|
2369
|
+
});
|
|
2370
|
+
if (result.data.status !== 'processing') {
|
|
2371
|
+
console.log('Erro ao gerar o boleto para o checkout: ');
|
|
2372
|
+
return Promise.reject(new Error(`Erro ao gerar o boleto para o checkout: ${checkout.id}`));
|
|
2373
|
+
}
|
|
2374
|
+
const payment = {
|
|
2375
|
+
createdAt: new Date(),
|
|
2376
|
+
updatedAt: new Date(),
|
|
2377
|
+
userId: checkout.user.id,
|
|
2378
|
+
checkoutId: checkout.id,
|
|
2379
|
+
totalPrice: checkout.totalPrice,
|
|
2380
|
+
transaction: result.data,
|
|
2381
|
+
};
|
|
2382
|
+
return payment;
|
|
2383
|
+
}
|
|
2384
|
+
catch (error) {
|
|
2385
|
+
console.log(error);
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
createBoletoPayment(checkout) {
|
|
2389
|
+
return {
|
|
2390
|
+
api_key: this.credentials.API_KEY,
|
|
2391
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
2392
|
+
boleto_rules: ['strict_expiration_date'],
|
|
2393
|
+
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
2394
|
+
boleto_expiration_date: moment().add(3, 'day').format('YYYY-MM-DD'),
|
|
2395
|
+
payment_method: 'boleto',
|
|
2396
|
+
postback_url: this.credentials.URL_POSTBACK,
|
|
2397
|
+
customer: {
|
|
2398
|
+
external_id: checkout.user.id,
|
|
2399
|
+
type: 'individual',
|
|
2400
|
+
country: 'br',
|
|
2401
|
+
name: checkout.user.displayName,
|
|
2402
|
+
documents: [
|
|
2403
|
+
{
|
|
2404
|
+
type: 'cpf',
|
|
2405
|
+
number: checkout.user.cpf,
|
|
2406
|
+
},
|
|
2407
|
+
],
|
|
2408
|
+
},
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
class PagarmeCardService {
|
|
2414
|
+
constructor(credentials) {
|
|
2415
|
+
this.credentials = credentials;
|
|
2416
|
+
}
|
|
2417
|
+
async pay(checkout, card) {
|
|
2418
|
+
try {
|
|
2419
|
+
const result = await axios({
|
|
2420
|
+
method: 'POST',
|
|
2421
|
+
url: this.credentials.URL_TRANSACTION,
|
|
2422
|
+
data: this.createCardPayment(checkout, card),
|
|
2423
|
+
});
|
|
2424
|
+
if (result.data.status !== 'paid') {
|
|
2425
|
+
this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2426
|
+
return Promise.reject(new Error(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`));
|
|
2427
|
+
}
|
|
2428
|
+
const payment = {
|
|
2429
|
+
createdAt: new Date(),
|
|
2430
|
+
updatedAt: new Date(),
|
|
2431
|
+
userId: checkout.user.id,
|
|
2432
|
+
checkoutId: checkout.id,
|
|
2433
|
+
totalPrice: checkout.totalPrice,
|
|
2434
|
+
transaction: result.data,
|
|
2435
|
+
};
|
|
2436
|
+
return payment;
|
|
2437
|
+
}
|
|
2438
|
+
catch (error) {
|
|
2439
|
+
console.log(error);
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
addCard() {
|
|
2443
|
+
throw new Error('Method not implemented.');
|
|
2444
|
+
}
|
|
2445
|
+
createCardPayment(checkout, card) {
|
|
2446
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2447
|
+
return {
|
|
2448
|
+
api_key: this.credentials.API_KEY,
|
|
2449
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
2450
|
+
card_id: card.cardId,
|
|
2451
|
+
payment_method: 'credit_card',
|
|
2452
|
+
installments: card.installments,
|
|
2453
|
+
soft_descriptor: checkout.shop,
|
|
2454
|
+
customer: {
|
|
2455
|
+
external_id: checkout.user.id,
|
|
2456
|
+
name: checkout.user.displayName,
|
|
2457
|
+
type: 'individual',
|
|
2458
|
+
country: 'br',
|
|
2459
|
+
email: checkout.user.email,
|
|
2460
|
+
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2461
|
+
documents: [
|
|
2462
|
+
{
|
|
2463
|
+
type: 'cpf',
|
|
2464
|
+
number: checkout.user.cpf,
|
|
2465
|
+
},
|
|
2466
|
+
],
|
|
2467
|
+
},
|
|
2468
|
+
billing: {
|
|
2469
|
+
name: checkout.user.displayName,
|
|
2470
|
+
address: {
|
|
2471
|
+
country: 'br',
|
|
2472
|
+
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
2473
|
+
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
2474
|
+
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
2475
|
+
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
2476
|
+
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
2477
|
+
zipcode: checkout.billingAddress
|
|
2478
|
+
? checkout.billingAddress.zip.replace('-', '')
|
|
2479
|
+
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
2480
|
+
},
|
|
2481
|
+
},
|
|
2482
|
+
items: checkout.lineItems.map((item) => {
|
|
2483
|
+
return {
|
|
2484
|
+
id: item.id,
|
|
2485
|
+
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
2486
|
+
unit_price: Math.floor(item.pricePaid * 100),
|
|
2487
|
+
quantity: item.quantity,
|
|
2488
|
+
tangible: true,
|
|
2489
|
+
};
|
|
2490
|
+
}),
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
class PagarmePixService {
|
|
2496
|
+
constructor(credentials) {
|
|
2497
|
+
this.credentials = credentials;
|
|
2498
|
+
}
|
|
2499
|
+
async pay(checkout) {
|
|
2500
|
+
try {
|
|
2501
|
+
const result = await axios({
|
|
2502
|
+
method: 'POST',
|
|
2503
|
+
url: this.credentials.URL_TRANSACTION,
|
|
2504
|
+
data: this.createPixPayment(checkout),
|
|
2505
|
+
});
|
|
2506
|
+
const payment = {
|
|
2507
|
+
createdAt: new Date(),
|
|
2508
|
+
updatedAt: new Date(),
|
|
2509
|
+
userId: checkout.user.id,
|
|
2510
|
+
checkoutId: checkout.id,
|
|
2511
|
+
totalPrice: checkout.totalPrice,
|
|
2512
|
+
transaction: result.data,
|
|
2513
|
+
};
|
|
2514
|
+
return payment;
|
|
2515
|
+
}
|
|
2516
|
+
catch (error) {
|
|
2517
|
+
console.log(error);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
createPixPayment(checkout) {
|
|
2521
|
+
return {
|
|
2522
|
+
payment_method: 'pix',
|
|
2523
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
2524
|
+
api_key: this.credentials.API_KEY,
|
|
2525
|
+
postback_url: this.credentials.URL_POSTBACK,
|
|
2526
|
+
pix_expiration_date: moment().add(1, 'day').format('YYYY-MM-DD'),
|
|
2527
|
+
customer: {
|
|
2528
|
+
external_id: checkout.user.id,
|
|
2529
|
+
type: 'individual',
|
|
2530
|
+
country: 'br',
|
|
2531
|
+
name: checkout.user.displayName,
|
|
2532
|
+
email: checkout.user.email.trim(),
|
|
2533
|
+
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2534
|
+
documents: [
|
|
2535
|
+
{
|
|
2536
|
+
type: 'cpf',
|
|
2537
|
+
number: checkout.user.cpf,
|
|
2538
|
+
},
|
|
2539
|
+
],
|
|
2540
|
+
},
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2233
2545
|
class RoundProductPricesHelper {
|
|
2234
2546
|
static roundProductPrices(product) {
|
|
2235
2547
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2244,6 +2556,12 @@ class RoundProductPricesHelper {
|
|
|
2244
2556
|
}
|
|
2245
2557
|
}
|
|
2246
2558
|
|
|
2559
|
+
class Sequence extends BaseModel {
|
|
2560
|
+
static get identifiersFields() {
|
|
2561
|
+
return ['id'];
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2247
2565
|
var FilterType;
|
|
2248
2566
|
(function (FilterType) {
|
|
2249
2567
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2758,7 +3076,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2758
3076
|
const collection = this.collection(this.buildCollectionPathForFind(find.filters));
|
|
2759
3077
|
const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
|
|
2760
3078
|
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
2761
|
-
const { filters, limits, orderBy } = intercepted.find || find;
|
|
3079
|
+
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2762
3080
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
2763
3081
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
2764
3082
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -2916,139 +3234,6 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
2916
3234
|
};
|
|
2917
3235
|
};
|
|
2918
3236
|
|
|
2919
|
-
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2920
|
-
constructor({ firestore, interceptors }) {
|
|
2921
|
-
super({
|
|
2922
|
-
firestore,
|
|
2923
|
-
collectionName: 'leads',
|
|
2924
|
-
model: Lead,
|
|
2925
|
-
interceptors,
|
|
2926
|
-
});
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2931
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2932
|
-
super({
|
|
2933
|
-
firestore,
|
|
2934
|
-
collectionName: 'editions',
|
|
2935
|
-
parentIdField: 'subscriptionId',
|
|
2936
|
-
model: Edition,
|
|
2937
|
-
interceptors,
|
|
2938
|
-
});
|
|
2939
|
-
this.parentRepository = parentRepository;
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2944
|
-
constructor({ firestore, interceptors, }) {
|
|
2945
|
-
super({
|
|
2946
|
-
firestore,
|
|
2947
|
-
collectionName: 'subscription',
|
|
2948
|
-
model: Subscription,
|
|
2949
|
-
interceptors,
|
|
2950
|
-
});
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2955
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2956
|
-
super({
|
|
2957
|
-
firestore,
|
|
2958
|
-
collectionName: 'payments',
|
|
2959
|
-
parentIdField: 'subscriptionId',
|
|
2960
|
-
model: SubscriptionPayment,
|
|
2961
|
-
interceptors,
|
|
2962
|
-
});
|
|
2963
|
-
this.parentRepository = parentRepository;
|
|
2964
|
-
}
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2968
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2969
|
-
super({
|
|
2970
|
-
firestore,
|
|
2971
|
-
collectionName: 'address',
|
|
2972
|
-
parentIdField: 'userId',
|
|
2973
|
-
model: UserAddress,
|
|
2974
|
-
interceptors,
|
|
2975
|
-
});
|
|
2976
|
-
this.parentRepository = parentRepository;
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2981
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2982
|
-
super({
|
|
2983
|
-
firestore,
|
|
2984
|
-
collectionName: 'CX',
|
|
2985
|
-
parentIdField: 'userId',
|
|
2986
|
-
model: BeautyProfile,
|
|
2987
|
-
interceptors,
|
|
2988
|
-
});
|
|
2989
|
-
this.parentRepository = parentRepository;
|
|
2990
|
-
}
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2994
|
-
constructor({ firestore, interceptors }) {
|
|
2995
|
-
super({
|
|
2996
|
-
firestore,
|
|
2997
|
-
collectionName: 'users',
|
|
2998
|
-
model: User,
|
|
2999
|
-
interceptors,
|
|
3000
|
-
});
|
|
3001
|
-
}
|
|
3002
|
-
async get(identifiers) {
|
|
3003
|
-
const user = await super.get({ id: identifiers.id });
|
|
3004
|
-
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3005
|
-
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3006
|
-
return user;
|
|
3007
|
-
}
|
|
3008
|
-
async checkIfExistsByField(field, value) {
|
|
3009
|
-
const result = await this.find({ filters: { [field]: value } });
|
|
3010
|
-
return result.count > 0;
|
|
3011
|
-
}
|
|
3012
|
-
buildModelInstance() {
|
|
3013
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3014
|
-
return {
|
|
3015
|
-
toFirestore: (data) => {
|
|
3016
|
-
const plain = toFirestore(data);
|
|
3017
|
-
delete plain.isSubscriber;
|
|
3018
|
-
return plain;
|
|
3019
|
-
},
|
|
3020
|
-
fromFirestore,
|
|
3021
|
-
};
|
|
3022
|
-
}
|
|
3023
|
-
async getBeautyProfile(userId) {
|
|
3024
|
-
const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
3025
|
-
return beautyProfile.data();
|
|
3026
|
-
}
|
|
3027
|
-
async checkIfIsSubscriber(userId) {
|
|
3028
|
-
const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
|
|
3029
|
-
return !!docs && !!docs.size;
|
|
3030
|
-
}
|
|
3031
|
-
buildBeautyProfileModelInstance() {
|
|
3032
|
-
return {
|
|
3033
|
-
toFirestore: (data) => data.toPlain(),
|
|
3034
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3035
|
-
};
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3040
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3041
|
-
super({
|
|
3042
|
-
firestore,
|
|
3043
|
-
collectionName: 'payment_method',
|
|
3044
|
-
parentIdField: 'userId',
|
|
3045
|
-
model: UserPaymentMethod,
|
|
3046
|
-
interceptors,
|
|
3047
|
-
});
|
|
3048
|
-
this.parentRepository = parentRepository;
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
3237
|
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3053
3238
|
constructor({ firestore, interceptors }) {
|
|
3054
3239
|
super({
|
|
@@ -3134,55 +3319,150 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3134
3319
|
const { data: products } = await this.find();
|
|
3135
3320
|
products.forEach((product) => {
|
|
3136
3321
|
var _a;
|
|
3137
|
-
if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
|
|
3138
|
-
return;
|
|
3139
|
-
const productInfo = {
|
|
3140
|
-
productId: product.id,
|
|
3141
|
-
productName: product.name,
|
|
3142
|
-
productSku: product.sku,
|
|
3143
|
-
};
|
|
3144
|
-
this.reviews.pending = [];
|
|
3145
|
-
this.reviews.approved = [];
|
|
3146
|
-
this.reviews.rejected = [];
|
|
3147
|
-
product.reviews.forEach((review) => {
|
|
3148
|
-
if ([null, undefined].includes(review.status))
|
|
3149
|
-
return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3150
|
-
if (review.status === false)
|
|
3151
|
-
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3152
|
-
if (!!review.status)
|
|
3153
|
-
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3154
|
-
return review;
|
|
3322
|
+
if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
|
|
3323
|
+
return;
|
|
3324
|
+
const productInfo = {
|
|
3325
|
+
productId: product.id,
|
|
3326
|
+
productName: product.name,
|
|
3327
|
+
productSku: product.sku,
|
|
3328
|
+
};
|
|
3329
|
+
this.reviews.pending = [];
|
|
3330
|
+
this.reviews.approved = [];
|
|
3331
|
+
this.reviews.rejected = [];
|
|
3332
|
+
product.reviews.forEach((review) => {
|
|
3333
|
+
if ([null, undefined].includes(review.status))
|
|
3334
|
+
return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3335
|
+
if (review.status === false)
|
|
3336
|
+
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3337
|
+
if (!!review.status)
|
|
3338
|
+
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3339
|
+
return review;
|
|
3340
|
+
});
|
|
3341
|
+
});
|
|
3342
|
+
return this.reviews[status];
|
|
3343
|
+
}
|
|
3344
|
+
cleanShoppingCountFromIds() {
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
findCatalog(params) {
|
|
3348
|
+
return this.find(params);
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3353
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3354
|
+
super({
|
|
3355
|
+
firestore,
|
|
3356
|
+
collectionName: 'variants',
|
|
3357
|
+
parentIdField: 'productId',
|
|
3358
|
+
model: Variant,
|
|
3359
|
+
interceptors,
|
|
3360
|
+
});
|
|
3361
|
+
this.parentRepository = parentRepository;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3366
|
+
constructor({ firestore, interceptors }) {
|
|
3367
|
+
super({
|
|
3368
|
+
firestore,
|
|
3369
|
+
collectionName: 'subscriptionProducts',
|
|
3370
|
+
model: Product,
|
|
3371
|
+
interceptors,
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3377
|
+
constructor({ firestore, interceptors }) {
|
|
3378
|
+
super({
|
|
3379
|
+
firestore,
|
|
3380
|
+
collectionName: 'sequences',
|
|
3381
|
+
model: Sequence,
|
|
3382
|
+
interceptors,
|
|
3383
|
+
});
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3388
|
+
constructor({ firestore, interceptors }) {
|
|
3389
|
+
super({
|
|
3390
|
+
firestore,
|
|
3391
|
+
collectionName: 'dms',
|
|
3392
|
+
model: Home,
|
|
3393
|
+
interceptors,
|
|
3394
|
+
});
|
|
3395
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3396
|
+
var _a, _b, _c;
|
|
3397
|
+
return ({
|
|
3398
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3399
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3400
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3401
|
+
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
3402
|
+
});
|
|
3403
|
+
};
|
|
3404
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3405
|
+
var _a;
|
|
3406
|
+
return ({
|
|
3407
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3408
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3155
3409
|
});
|
|
3156
|
-
}
|
|
3157
|
-
return this.reviews[status];
|
|
3410
|
+
};
|
|
3158
3411
|
}
|
|
3159
|
-
|
|
3160
|
-
|
|
3412
|
+
buildModelInstance() {
|
|
3413
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3414
|
+
return {
|
|
3415
|
+
toFirestore: (data) => {
|
|
3416
|
+
const modifiedData = this.homeToFirestore(data);
|
|
3417
|
+
return toFirestore(modifiedData);
|
|
3418
|
+
},
|
|
3419
|
+
fromFirestore: (snap) => {
|
|
3420
|
+
const instance = fromFirestore(snap);
|
|
3421
|
+
return this.homeFromFirestore(instance);
|
|
3422
|
+
},
|
|
3423
|
+
};
|
|
3161
3424
|
}
|
|
3162
|
-
|
|
3163
|
-
|
|
3425
|
+
homeToFirestore(home) {
|
|
3426
|
+
var _a, _b, _c, _d;
|
|
3427
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3428
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3429
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3430
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3431
|
+
}
|
|
3432
|
+
return home;
|
|
3433
|
+
}
|
|
3434
|
+
homeFromFirestore(home) {
|
|
3435
|
+
var _a;
|
|
3436
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3437
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3438
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3439
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3440
|
+
home.data.createdAt =
|
|
3441
|
+
home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3442
|
+
home.data.expiresAt =
|
|
3443
|
+
home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3444
|
+
}
|
|
3445
|
+
return home;
|
|
3164
3446
|
}
|
|
3165
3447
|
}
|
|
3166
3448
|
|
|
3167
|
-
class
|
|
3168
|
-
constructor({ firestore, interceptors }
|
|
3449
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3450
|
+
constructor({ firestore, interceptors }) {
|
|
3169
3451
|
super({
|
|
3170
3452
|
firestore,
|
|
3171
|
-
collectionName: '
|
|
3172
|
-
|
|
3173
|
-
model: Variant,
|
|
3453
|
+
collectionName: 'shopMenus',
|
|
3454
|
+
model: ShopMenu,
|
|
3174
3455
|
interceptors,
|
|
3175
3456
|
});
|
|
3176
|
-
this.parentRepository = parentRepository;
|
|
3177
3457
|
}
|
|
3178
3458
|
}
|
|
3179
3459
|
|
|
3180
|
-
class
|
|
3181
|
-
constructor({ firestore, interceptors }) {
|
|
3460
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3461
|
+
constructor({ firestore, interceptors, }) {
|
|
3182
3462
|
super({
|
|
3183
3463
|
firestore,
|
|
3184
|
-
collectionName: '
|
|
3185
|
-
model:
|
|
3464
|
+
collectionName: 'shopSettings',
|
|
3465
|
+
model: ShopSettings,
|
|
3186
3466
|
interceptors,
|
|
3187
3467
|
});
|
|
3188
3468
|
}
|
|
@@ -3318,6 +3598,17 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3318
3598
|
}
|
|
3319
3599
|
}
|
|
3320
3600
|
|
|
3601
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3602
|
+
constructor({ firestore, interceptors, }) {
|
|
3603
|
+
super({
|
|
3604
|
+
firestore,
|
|
3605
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3606
|
+
model: OrderBlocked,
|
|
3607
|
+
interceptors,
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3321
3612
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3322
3613
|
constructor({ firestore, interceptors }) {
|
|
3323
3614
|
super({
|
|
@@ -3340,87 +3631,136 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
3340
3631
|
}
|
|
3341
3632
|
}
|
|
3342
3633
|
|
|
3343
|
-
class
|
|
3634
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3344
3635
|
constructor({ firestore, interceptors }) {
|
|
3345
3636
|
super({
|
|
3346
3637
|
firestore,
|
|
3347
|
-
collectionName: '
|
|
3348
|
-
model:
|
|
3638
|
+
collectionName: 'leads',
|
|
3639
|
+
model: Lead,
|
|
3349
3640
|
interceptors,
|
|
3350
3641
|
});
|
|
3351
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3352
|
-
var _a, _b, _c;
|
|
3353
|
-
return ({
|
|
3354
|
-
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3355
|
-
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3356
|
-
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3357
|
-
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
3358
|
-
});
|
|
3359
|
-
};
|
|
3360
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3361
|
-
var _a;
|
|
3362
|
-
return ({
|
|
3363
|
-
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3364
|
-
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3365
|
-
});
|
|
3366
|
-
};
|
|
3367
3642
|
}
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3646
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3647
|
+
super({
|
|
3648
|
+
firestore,
|
|
3649
|
+
collectionName: 'editions',
|
|
3650
|
+
parentIdField: 'subscriptionId',
|
|
3651
|
+
model: Edition,
|
|
3652
|
+
interceptors,
|
|
3653
|
+
});
|
|
3654
|
+
this.parentRepository = parentRepository;
|
|
3380
3655
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3659
|
+
constructor({ firestore, interceptors, }) {
|
|
3660
|
+
super({
|
|
3661
|
+
firestore,
|
|
3662
|
+
collectionName: 'subscription',
|
|
3663
|
+
model: Subscription,
|
|
3664
|
+
interceptors,
|
|
3665
|
+
});
|
|
3389
3666
|
}
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3670
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3671
|
+
super({
|
|
3672
|
+
firestore,
|
|
3673
|
+
collectionName: 'payments',
|
|
3674
|
+
parentIdField: 'subscriptionId',
|
|
3675
|
+
model: SubscriptionPayment,
|
|
3676
|
+
interceptors,
|
|
3677
|
+
});
|
|
3678
|
+
this.parentRepository = parentRepository;
|
|
3402
3679
|
}
|
|
3403
3680
|
}
|
|
3404
3681
|
|
|
3405
|
-
class
|
|
3682
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3683
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3684
|
+
super({
|
|
3685
|
+
firestore,
|
|
3686
|
+
collectionName: 'address',
|
|
3687
|
+
parentIdField: 'userId',
|
|
3688
|
+
model: UserAddress,
|
|
3689
|
+
interceptors,
|
|
3690
|
+
});
|
|
3691
|
+
this.parentRepository = parentRepository;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3696
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3697
|
+
super({
|
|
3698
|
+
firestore,
|
|
3699
|
+
collectionName: 'CX',
|
|
3700
|
+
parentIdField: 'userId',
|
|
3701
|
+
model: BeautyProfile,
|
|
3702
|
+
interceptors,
|
|
3703
|
+
});
|
|
3704
|
+
this.parentRepository = parentRepository;
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
|
|
3708
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3406
3709
|
constructor({ firestore, interceptors }) {
|
|
3407
3710
|
super({
|
|
3408
3711
|
firestore,
|
|
3409
|
-
collectionName: '
|
|
3410
|
-
model:
|
|
3712
|
+
collectionName: 'users',
|
|
3713
|
+
model: User,
|
|
3411
3714
|
interceptors,
|
|
3412
3715
|
});
|
|
3413
3716
|
}
|
|
3717
|
+
async get(identifiers) {
|
|
3718
|
+
const user = await super.get({ id: identifiers.id });
|
|
3719
|
+
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3720
|
+
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3721
|
+
return user;
|
|
3722
|
+
}
|
|
3723
|
+
async checkIfExistsByField(field, value) {
|
|
3724
|
+
const result = await this.find({ filters: { [field]: value } });
|
|
3725
|
+
return result.count > 0;
|
|
3726
|
+
}
|
|
3727
|
+
buildModelInstance() {
|
|
3728
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3729
|
+
return {
|
|
3730
|
+
toFirestore: (data) => {
|
|
3731
|
+
const plain = toFirestore(data);
|
|
3732
|
+
delete plain.isSubscriber;
|
|
3733
|
+
return plain;
|
|
3734
|
+
},
|
|
3735
|
+
fromFirestore,
|
|
3736
|
+
};
|
|
3737
|
+
}
|
|
3738
|
+
async getBeautyProfile(userId) {
|
|
3739
|
+
const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
3740
|
+
return beautyProfile.data();
|
|
3741
|
+
}
|
|
3742
|
+
async checkIfIsSubscriber(userId) {
|
|
3743
|
+
const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
|
|
3744
|
+
return !!docs && !!docs.size;
|
|
3745
|
+
}
|
|
3746
|
+
buildBeautyProfileModelInstance() {
|
|
3747
|
+
return {
|
|
3748
|
+
toFirestore: (data) => data.toPlain(),
|
|
3749
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3414
3752
|
}
|
|
3415
3753
|
|
|
3416
|
-
class
|
|
3417
|
-
constructor({ firestore, interceptors,
|
|
3754
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3755
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3418
3756
|
super({
|
|
3419
3757
|
firestore,
|
|
3420
|
-
collectionName: '
|
|
3421
|
-
|
|
3758
|
+
collectionName: 'payment_method',
|
|
3759
|
+
parentIdField: 'userId',
|
|
3760
|
+
model: UserPaymentMethod,
|
|
3422
3761
|
interceptors,
|
|
3423
3762
|
});
|
|
3763
|
+
this.parentRepository = parentRepository;
|
|
3424
3764
|
}
|
|
3425
3765
|
}
|
|
3426
3766
|
|
|
@@ -5510,4 +5850,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5510
5850
|
}
|
|
5511
5851
|
}
|
|
5512
5852
|
|
|
5513
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
5853
|
+
export { AccessoryImportances, Address, AdyenCardService, AdyenPaymentMethodFactory, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipService, PagarmeCardService, PagarmePaymentMethodFactory, PagarmePixService, Payment, PaymentFirestoreRepository, PaymentProviderFactory, PaymentTransaction, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|