@felloh-org/lambda-wrapper 1.2.12 → 1.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _typeorm = require("typeorm");
9
+
10
+ var _organisation = _interopRequireDefault(require("../../user/organisation"));
11
+
12
+ var _user = _interopRequireDefault(require("../../user/user"));
13
+
14
+ var _booking = _interopRequireDefault(require("../../agent-data/booking"));
15
+
16
+ var _transaction = _interopRequireDefault(require("../transaction"));
17
+
18
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16;
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
23
+
24
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
25
+
26
+ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }
27
+
28
+ let Ecommerce = (_dec = (0, _typeorm.Entity)({
29
+ name: 'ecommerce',
30
+ schema: 'payment'
31
+ }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.ManyToOne)(() => _booking.default, {
32
+ nullable: true
33
+ }), _dec4 = (0, _typeorm.JoinColumn)({
34
+ name: 'booking_id',
35
+ referencedColumnName: 'id'
36
+ }), _dec5 = (0, _typeorm.ManyToOne)(() => _user.default), _dec6 = (0, _typeorm.JoinColumn)({
37
+ name: 'user_id',
38
+ referencedColumnName: 'id'
39
+ }), _dec7 = (0, _typeorm.ManyToOne)(() => _organisation.default), _dec8 = (0, _typeorm.JoinColumn)({
40
+ name: 'organisation_id',
41
+ referencedColumnName: 'id'
42
+ }), _dec9 = (0, _typeorm.Column)({
43
+ type: "int"
44
+ }), _dec10 = (0, _typeorm.Column)({
45
+ type: "varchar",
46
+ length: "150",
47
+ nullable: true
48
+ }), _dec11 = (0, _typeorm.Column)({
49
+ type: "varchar",
50
+ length: "250",
51
+ nullable: true
52
+ }), _dec12 = (0, _typeorm.OneToMany)(() => _transaction.default, transaction => transaction.payment_link), _dec13 = (0, _typeorm.Column)({
53
+ type: "boolean",
54
+ default: true
55
+ }), _dec14 = (0, _typeorm.Column)({
56
+ type: "boolean",
57
+ default: true
58
+ }), _dec15 = (0, _typeorm.Column)({
59
+ type: "boolean",
60
+ default: false
61
+ }), _dec16 = (0, _typeorm.Column)({
62
+ type: "varchar",
63
+ length: "3",
64
+ default: "GBX"
65
+ }), _dec17 = (0, _typeorm.Column)({
66
+ type: "timestamp with time zone"
67
+ }), _dec18 = (0, _typeorm.Column)({
68
+ type: "varchar",
69
+ length: "50",
70
+ default: 'active'
71
+ }), _dec19 = (0, _typeorm.CreateDateColumn)({
72
+ type: 'timestamp with time zone'
73
+ }), _dec20 = (0, _typeorm.UpdateDateColumn)({
74
+ type: 'timestamp with time zone'
75
+ }), _dec(_class = (_class2 = class Ecommerce {
76
+ constructor() {
77
+ _initializerDefineProperty(this, "id", _descriptor, this);
78
+
79
+ _initializerDefineProperty(this, "booking", _descriptor2, this);
80
+
81
+ _initializerDefineProperty(this, "user", _descriptor3, this);
82
+
83
+ _initializerDefineProperty(this, "organisation", _descriptor4, this);
84
+
85
+ _initializerDefineProperty(this, "amount", _descriptor5, this);
86
+
87
+ _initializerDefineProperty(this, "customer_name", _descriptor6, this);
88
+
89
+ _initializerDefineProperty(this, "email", _descriptor7, this);
90
+
91
+ _initializerDefineProperty(this, "transactions", _descriptor8, this);
92
+
93
+ _initializerDefineProperty(this, "open_banking_enabled", _descriptor9, this);
94
+
95
+ _initializerDefineProperty(this, "card_enabled", _descriptor10, this);
96
+
97
+ _initializerDefineProperty(this, "moto", _descriptor11, this);
98
+
99
+ _initializerDefineProperty(this, "currency", _descriptor12, this);
100
+
101
+ _initializerDefineProperty(this, "expires_at", _descriptor13, this);
102
+
103
+ _initializerDefineProperty(this, "status", _descriptor14, this);
104
+
105
+ _initializerDefineProperty(this, "created_at", _descriptor15, this);
106
+
107
+ _initializerDefineProperty(this, "updated_at", _descriptor16, this);
108
+ }
109
+
110
+ generateExpiryDate() {
111
+ let date = new Date();
112
+ date.setDate(date.getDate() + 30);
113
+ return date;
114
+ }
115
+
116
+ getPublicData() {
117
+ const response = {
118
+ id: this.id,
119
+ amount: this.amount,
120
+ customer_name: this.customer_name,
121
+ expires_at: this.expires_at,
122
+ created_at: this.created_at,
123
+ email: this.email,
124
+ currency: this.currency,
125
+ methods: {
126
+ open_banking: this.open_banking_enabled,
127
+ card: this.card_enabled
128
+ },
129
+ booking: null,
130
+ transactions: [],
131
+ user: null,
132
+ organisation: null
133
+ };
134
+
135
+ if (this.booking !== null && typeof this.booking.id !== 'undefined') {
136
+ response.booking = this.booking.getPublicData();
137
+ }
138
+
139
+ if (typeof this.transactions !== 'undefined') {
140
+ response.transactions = this.transactions.map(transaction => transaction.getPublicCompactData());
141
+ }
142
+
143
+ if (this.user !== null && typeof this.user.id !== 'undefined') {
144
+ response.user = this.user.getPublicCompactData();
145
+ }
146
+
147
+ if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
148
+ response.organisation = this.organisation.getPublicCompactData();
149
+ }
150
+
151
+ return response;
152
+ }
153
+
154
+ getPublicCompactData() {
155
+ return {
156
+ id: this.id,
157
+ amount: this.amount,
158
+ expires_at: this.expires_at,
159
+ created_at: this.created_at,
160
+ email: this.email,
161
+ currency: this.currency,
162
+ methods: {
163
+ open_banking: this.open_banking_enabled,
164
+ card: this.card_enabled
165
+ }
166
+ };
167
+ }
168
+
169
+ getPublicUltraCompactData() {
170
+ return {
171
+ id: this.id
172
+ };
173
+ }
174
+
175
+ }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
176
+ configurable: true,
177
+ enumerable: true,
178
+ writable: true,
179
+ initializer: function () {
180
+ return undefined;
181
+ }
182
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "booking", [_dec3, _dec4], {
183
+ configurable: true,
184
+ enumerable: true,
185
+ writable: true,
186
+ initializer: function () {
187
+ return _booking.default;
188
+ }
189
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "user", [_dec5, _dec6], {
190
+ configurable: true,
191
+ enumerable: true,
192
+ writable: true,
193
+ initializer: function () {
194
+ return _user.default;
195
+ }
196
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "organisation", [_dec7, _dec8], {
197
+ configurable: true,
198
+ enumerable: true,
199
+ writable: true,
200
+ initializer: function () {
201
+ return _organisation.default;
202
+ }
203
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "amount", [_dec9], {
204
+ configurable: true,
205
+ enumerable: true,
206
+ writable: true,
207
+ initializer: null
208
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "customer_name", [_dec10], {
209
+ configurable: true,
210
+ enumerable: true,
211
+ writable: true,
212
+ initializer: function () {
213
+ return "";
214
+ }
215
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "email", [_dec11], {
216
+ configurable: true,
217
+ enumerable: true,
218
+ writable: true,
219
+ initializer: function () {
220
+ return "";
221
+ }
222
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "transactions", [_dec12], {
223
+ configurable: true,
224
+ enumerable: true,
225
+ writable: true,
226
+ initializer: null
227
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "open_banking_enabled", [_dec13], {
228
+ configurable: true,
229
+ enumerable: true,
230
+ writable: true,
231
+ initializer: null
232
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "card_enabled", [_dec14], {
233
+ configurable: true,
234
+ enumerable: true,
235
+ writable: true,
236
+ initializer: null
237
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "moto", [_dec15], {
238
+ configurable: true,
239
+ enumerable: true,
240
+ writable: true,
241
+ initializer: null
242
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "currency", [_dec16], {
243
+ configurable: true,
244
+ enumerable: true,
245
+ writable: true,
246
+ initializer: function () {
247
+ return "GBX";
248
+ }
249
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "expires_at", [_dec17], {
250
+ configurable: true,
251
+ enumerable: true,
252
+ writable: true,
253
+ initializer: function () {
254
+ return this.generateExpiryDate();
255
+ }
256
+ }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "status", [_dec18], {
257
+ configurable: true,
258
+ enumerable: true,
259
+ writable: true,
260
+ initializer: function () {
261
+ return "";
262
+ }
263
+ }), _descriptor15 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec19], {
264
+ configurable: true,
265
+ enumerable: true,
266
+ writable: true,
267
+ initializer: null
268
+ }), _descriptor16 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec20], {
269
+ configurable: true,
270
+ enumerable: true,
271
+ writable: true,
272
+ initializer: null
273
+ })), _class2)) || _class);
274
+ exports.default = Ecommerce;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _typeorm = require("typeorm");
9
9
 
10
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10;
10
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12;
11
11
 
12
12
  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
13
13
 
@@ -20,7 +20,7 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
20
20
  schema: 'total_processing'
21
21
  }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.Column)({
22
22
  type: "varchar",
23
- length: 2
23
+ length: 5
24
24
  }), _dec4 = (0, _typeorm.Column)({
25
25
  type: "int"
26
26
  }), _dec5 = (0, _typeorm.Column)({
@@ -41,8 +41,16 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
41
41
  type: "int",
42
42
  nullable: true
43
43
  }), _dec10 = (0, _typeorm.Column)({
44
- type: "timestamp without time zone"
44
+ type: "varchar",
45
+ length: 50,
46
+ nullable: true
45
47
  }), _dec11 = (0, _typeorm.Column)({
48
+ type: "varchar",
49
+ length: 512,
50
+ nullable: true
51
+ }), _dec12 = (0, _typeorm.Column)({
52
+ type: "timestamp without time zone"
53
+ }), _dec13 = (0, _typeorm.Column)({
46
54
  type: "varchar",
47
55
  length: 1500
48
56
  }), _dec(_class = (_class2 = class Transaction {
@@ -63,9 +71,13 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
63
71
 
64
72
  _initializerDefineProperty(this, "status", _descriptor8, this);
65
73
 
66
- _initializerDefineProperty(this, "processing_time", _descriptor9, this);
74
+ _initializerDefineProperty(this, "code", _descriptor9, this);
75
+
76
+ _initializerDefineProperty(this, "message", _descriptor10, this);
67
77
 
68
- _initializerDefineProperty(this, "merchant_name", _descriptor10, this);
78
+ _initializerDefineProperty(this, "processing_time", _descriptor11, this);
79
+
80
+ _initializerDefineProperty(this, "merchant_name", _descriptor12, this);
69
81
  }
70
82
 
71
83
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "ndc", [_dec2], {
@@ -110,14 +122,24 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
110
122
  enumerable: true,
111
123
  writable: true,
112
124
  initializer: null
113
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "processing_time", [_dec10], {
125
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "code", [_dec10], {
126
+ configurable: true,
127
+ enumerable: true,
128
+ writable: true,
129
+ initializer: null
130
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "message", [_dec11], {
131
+ configurable: true,
132
+ enumerable: true,
133
+ writable: true,
134
+ initializer: null
135
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "processing_time", [_dec12], {
114
136
  configurable: true,
115
137
  enumerable: true,
116
138
  writable: true,
117
139
  initializer: function () {
118
140
  return null;
119
141
  }
120
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "merchant_name", [_dec11], {
142
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "merchant_name", [_dec13], {
121
143
  configurable: true,
122
144
  enumerable: true,
123
145
  writable: true,
@@ -0,0 +1,19 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class ecom1664181706131 {
4
+ name = 'ecom1664181706131'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`CREATE TABLE "payment"."ecommerce" ("id" character varying NOT NULL, "amount" integer NOT NULL, "customer_name" character varying(150), "email" character varying(250), "open_banking_enabled" boolean NOT NULL DEFAULT true, "card_enabled" boolean NOT NULL DEFAULT true, "moto" boolean NOT NULL DEFAULT false, "currency" character varying(3) NOT NULL DEFAULT 'GBX', "expires_at" TIMESTAMP WITH TIME ZONE NOT NULL, "status" character varying(50) NOT NULL DEFAULT 'active', "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "booking_id" character varying, "user_id" character varying, "organisation_id" character varying(150), CONSTRAINT "PK_e67660bf2a224d8ce3d2b1b57ab" PRIMARY KEY ("id"))`);
8
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" ADD CONSTRAINT "FK_b97332a73f4f77663071d3a4d4b" FOREIGN KEY ("booking_id") REFERENCES "agent_data"."booking"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
9
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" ADD CONSTRAINT "FK_860f2ae1e87e3f4f76a7d7bce2c" FOREIGN KEY ("user_id") REFERENCES "user"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
10
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" ADD CONSTRAINT "FK_d62ca05d9f4de040dfb4da51215" FOREIGN KEY ("organisation_id") REFERENCES "user"."organisation"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
11
+ }
12
+
13
+ async down(queryRunner) {
14
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" DROP CONSTRAINT "FK_d62ca05d9f4de040dfb4da51215"`);
15
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" DROP CONSTRAINT "FK_860f2ae1e87e3f4f76a7d7bce2c"`);
16
+ await queryRunner.query(`ALTER TABLE "payment"."ecommerce" DROP CONSTRAINT "FK_b97332a73f4f77663071d3a4d4b"`);
17
+ await queryRunner.query(`DROP TABLE "payment"."ecommerce"`);
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class tpmessagecode1663945952356 {
4
+ name = 'tpmessagecode1663945952356'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ADD "code" character varying(50)`);
8
+ await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ADD "message" character varying(512)`);
9
+ }
10
+
11
+ async down(queryRunner) {
12
+ await queryRunner.query(`ALTER TABLE "total_processing"."transaction" DROP COLUMN "message"`);
13
+ await queryRunner.query(`ALTER TABLE "total_processing"."transaction" DROP COLUMN "code"`);
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "engines": {