@felloh-org/lambda-wrapper 1.0.18 → 1.0.19

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.
@@ -50,6 +50,16 @@ let Account = (_dec = (0, _typeorm.Entity)({
50
50
  this.name = name;
51
51
  }
52
52
 
53
+ getPublicData() {
54
+ return {
55
+ iban: this.iban,
56
+ account_number: this.account_number,
57
+ sort_code: this.sort_code,
58
+ created_at: this.created_at,
59
+ name: this.name
60
+ };
61
+ }
62
+
53
63
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "iban", [_dec2], {
54
64
  configurable: true,
55
65
  enumerable: true,
@@ -52,6 +52,16 @@ let Disbursal = (_dec = (0, _typeorm.Entity)({
52
52
  _initializerDefineProperty(this, "created_at", _descriptor6, this);
53
53
  }
54
54
 
55
+ getPublicData() {
56
+ return {
57
+ id: this.id,
58
+ amount: this.amount,
59
+ bank_reference: this.bank_reference,
60
+ created_at: this.created_at,
61
+ receiving_account: this.iban.getPublicData()
62
+ };
63
+ }
64
+
55
65
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
56
66
  configurable: true,
57
67
  enumerable: true,
@@ -69,6 +69,32 @@ let Ledger = (_dec = (0, _typeorm.Entity)({
69
69
  _initializerDefineProperty(this, "created_at", _descriptor8, this);
70
70
  }
71
71
 
72
+ getSource() {
73
+ if (this.disbursal !== null) return 'disbursal';
74
+ if (this.transaction !== null) return 'settled transaction';
75
+ return 'Unknown';
76
+ }
77
+
78
+ getPublicData() {
79
+ const response = {
80
+ id: this.id,
81
+ type: this.is_credit === true ? 'credit' : 'debit',
82
+ amount: this.amount,
83
+ source: this.getSource(),
84
+ created_at: this.created_at
85
+ };
86
+
87
+ if (typeof this.disbursal !== 'undefined' && this.disbursal !== null) {
88
+ response.disbursal = this.disbursal.getPublicData();
89
+ }
90
+
91
+ if (typeof this.transaction !== 'undefined' && this.transaction !== null) {
92
+ response.transaction = this.transaction.getPublicCompactData();
93
+ }
94
+
95
+ return response;
96
+ }
97
+
72
98
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
73
99
  configurable: true,
74
100
  enumerable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {