taxtank-core 0.28.99 → 0.28.101

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.
@@ -1079,6 +1079,7 @@
1079
1079
  SALARY_FORECAST_PUT: new Endpoint('PUT', '\\/salary-forecasts'),
1080
1080
  SERVICE_PRICES_GET: new Endpoint('GET', '\\/service-prices'),
1081
1081
  SERVICE_PAYMENTS_GET: new Endpoint('GET', '\\/service-payments'),
1082
+ SERVICE_PAYMENT_INVOICE_URL_GET: new Endpoint('GET', '\\/service-payments\\/\\d+\\/invoice-url'),
1082
1083
  STRIPE_BILLING_PORTAL_GET: new Endpoint('GET', '\\/stripe\\/billing-portal-session'),
1083
1084
  STRIPE_CHECKOUT_SESSION_POST: new Endpoint('POST', '\\/stripe\\/checkout-session'),
1084
1085
  SUBSCRIPTION_LAST_GET: new Endpoint('GET', '\\/subscriptions\\/last'),
@@ -11806,29 +11807,6 @@
11806
11807
  return MyTaxDividends;
11807
11808
  }());
11808
11809
 
11809
- var MyTaxEmployeeShareSchemes = /** @class */ (function () {
11810
- function MyTaxEmployeeShareSchemes(transactions) {
11811
- this.transactions = transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.EMPLOYEE_SHARE_SCHEME_INCOME);
11812
- this.eligibleForReductionAmount = this.transactions.getTransactionsMetadata()
11813
- .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.ELIGIBLE_FOR_REDUCTION)
11814
- .sumBy('value');
11815
- this.notEligibleForReductionAmount = this.transactions.getTransactionsMetadata()
11816
- .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.NOT_ELIGIBLE_FOR_DEDUCTION)
11817
- .sumBy('value');
11818
- this.discountFromDeferredSchemeAmount = this.transactions.getTransactionsMetadata()
11819
- .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.DISCOUNT_FROM_DEFERRED_SCHEMES)
11820
- .sumBy('value');
11821
- this.totalAssessableDiscountAmount = this.transactions.getTransactionsMetadata()
11822
- .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.NOT_ELIGIBLE_FOR_DEDUCTION)
11823
- .sumBy('value') +
11824
- this.transactions.getTransactionsMetadata()
11825
- .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.DISCOUNT_FROM_DEFERRED_SCHEMES)
11826
- .sumBy('value');
11827
- this.shareSchemesTotalTax = this.transactions.sumBy('tax');
11828
- }
11829
- return MyTaxEmployeeShareSchemes;
11830
- }());
11831
-
11832
11810
  /**
11833
11811
  * @Todo add link to documentation about related fields, add comments to methods
11834
11812
  */
@@ -11982,6 +11960,26 @@
11982
11960
  var MyTaxOtherIncome = /** @class */ (function () {
11983
11961
  function MyTaxOtherIncome(transactions) {
11984
11962
  this.transactions = transactions;
11963
+ this.employeeShareSchemesTransactions = transactions
11964
+ .filterBy('chartAccounts.id', exports.ChartAccountsListEnum.EMPLOYEE_SHARE_SCHEME_INCOME);
11965
+ // Employee Share Schemes data
11966
+ this.eligibleForReductionAmount = this.employeeShareSchemesTransactions.getTransactionsMetadata()
11967
+ .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.ELIGIBLE_FOR_REDUCTION)
11968
+ .sumBy('value');
11969
+ this.notEligibleForReductionAmount = this.employeeShareSchemesTransactions.getTransactionsMetadata()
11970
+ .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.NOT_ELIGIBLE_FOR_DEDUCTION)
11971
+ .sumBy('value');
11972
+ this.discountFromDeferredSchemeAmount = this.employeeShareSchemesTransactions.getTransactionsMetadata()
11973
+ .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.DISCOUNT_FROM_DEFERRED_SCHEMES)
11974
+ .sumBy('value');
11975
+ this.totalAssessableDiscountAmount = this.employeeShareSchemesTransactions.getTransactionsMetadata()
11976
+ .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.NOT_ELIGIBLE_FOR_DEDUCTION)
11977
+ .sumBy('value') +
11978
+ this.employeeShareSchemesTransactions.getTransactionsMetadata()
11979
+ .filterBy('chartAccountsMetadata.id', exports.ChartAccountsMetadataListEnum.DISCOUNT_FROM_DEFERRED_SCHEMES)
11980
+ .sumBy('value');
11981
+ this.shareSchemesTotalTax = this.employeeShareSchemesTransactions.sumBy('tax');
11982
+ // Other income data
11985
11983
  this.lumpSumPaymentsInArrearsTransactions = this.transactions
11986
11984
  .filterBy('chartAccounts.id', exports.ChartAccountsListEnum.LUMP_SUM_PAYMENTS_IN_ARREARS);
11987
11985
  this.bonusesTotalAmount = this.transactions
@@ -12157,11 +12155,23 @@
12157
12155
  function ServicePayment() {
12158
12156
  return _super !== null && _super.apply(this, arguments) || this;
12159
12157
  }
12158
+ /**
12159
+ * Stripe stores actual links to payment invoices for 30 days.
12160
+ * Link expires after 30 days
12161
+ */
12162
+ ServicePayment.prototype.isInvoiceLinkExpired = function () {
12163
+ var expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
12164
+ return expirationDate.getTime() < new Date().getTime();
12165
+ };
12160
12166
  return ServicePayment;
12161
12167
  }(ServicePayment$1));
12168
+ ServicePayment.daysToInvoiceUrlExpired = 30;
12162
12169
  __decorate([
12163
12170
  classTransformer.Type(function () { return ServiceSubscription; })
12164
12171
  ], ServicePayment.prototype, "subscription", void 0);
12172
+ __decorate([
12173
+ classTransformer.Type(function () { return Date; })
12174
+ ], ServicePayment.prototype, "date", void 0);
12165
12175
 
12166
12176
  var TaxReview$1 = /** @class */ (function (_super) {
12167
12177
  __extends(TaxReview, _super);
@@ -15236,7 +15246,6 @@
15236
15246
  return this.http.put(this.apiUrl, models)
15237
15247
  .pipe(operators.map(function (response) {
15238
15248
  var result = response.map(function (item) { return _this.createModelInstance(_this.modelClass, item); });
15239
- debugger;
15240
15249
  _this.handleResponse(result, 'put');
15241
15250
  return result;
15242
15251
  }));
@@ -16047,7 +16056,7 @@
16047
16056
  var _this = this;
16048
16057
  if (!this._servicePayments) {
16049
16058
  this.http.get(this.environment.apiV2 + "/service-payments").subscribe(function (response) {
16050
- _this._servicePayments = response.map(function (item) { return classTransformer.plainToClass(ServicePayment, item); });
16059
+ _this._servicePayments = response['hydra:member'].map(function (item) { return classTransformer.plainToClass(ServicePayment, item); });
16051
16060
  _this.servicePaymentsSubject.next(_this._servicePayments);
16052
16061
  });
16053
16062
  }
@@ -16087,6 +16096,15 @@
16087
16096
  }, 2000);
16088
16097
  });
16089
16098
  };
16099
+ /**
16100
+ * Stripe stores actual links to payment invoices for 30 days. After that, we need to request an actual link
16101
+ */
16102
+ SubscriptionService.prototype.getPaymentInvoiceUrl = function (payment) {
16103
+ if (!payment.isInvoiceLinkExpired()) {
16104
+ return rxjs.of(payment.receipt);
16105
+ }
16106
+ return this.http.get(this.environment.apiV2 + "/service-payments/" + payment.id + "/invoice-url");
16107
+ };
16090
16108
  return SubscriptionService;
16091
16109
  }());
16092
16110
  SubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SubscriptionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: ToastService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -20381,20 +20399,6 @@
20381
20399
  return MyTaxDividendsForm;
20382
20400
  }(AbstractForm));
20383
20401
 
20384
- var MyTaxEmployeeShareSchemesForm = /** @class */ (function (_super) {
20385
- __extends(MyTaxEmployeeShareSchemesForm, _super);
20386
- function MyTaxEmployeeShareSchemesForm(shareSchemes) {
20387
- return _super.call(this, {
20388
- eligibleForReductionAmount: new forms.FormControl(shareSchemes.eligibleForReductionAmount),
20389
- notEligibleForReductionAmount: new forms.FormControl(shareSchemes.notEligibleForReductionAmount),
20390
- discountFromDeferredSchemeAmount: new forms.FormControl(shareSchemes.discountFromDeferredSchemeAmount),
20391
- totalAssessableDiscountAmount: new forms.FormControl(shareSchemes.totalAssessableDiscountAmount),
20392
- shareSchemesTotalTax: new forms.FormControl(shareSchemes.shareSchemesTotalTax)
20393
- }) || this;
20394
- }
20395
- return MyTaxEmployeeShareSchemesForm;
20396
- }(AbstractForm));
20397
-
20398
20402
  var MyTaxIncomeStatementsForm = /** @class */ (function (_super) {
20399
20403
  __extends(MyTaxIncomeStatementsForm, _super);
20400
20404
  function MyTaxIncomeStatementsForm(incomeStatements, user) {
@@ -20572,6 +20576,11 @@
20572
20576
  __extends(MyTaxOtherIncomeForm, _super);
20573
20577
  function MyTaxOtherIncomeForm(otherIncome) {
20574
20578
  return _super.call(this, {
20579
+ eligibleForReductionAmount: new forms.FormControl(otherIncome.eligibleForReductionAmount),
20580
+ notEligibleForReductionAmount: new forms.FormControl(otherIncome.notEligibleForReductionAmount),
20581
+ discountFromDeferredSchemeAmount: new forms.FormControl(otherIncome.discountFromDeferredSchemeAmount),
20582
+ totalAssessableDiscountAmount: new forms.FormControl(otherIncome.totalAssessableDiscountAmount),
20583
+ shareSchemesTotalTax: new forms.FormControl(otherIncome.shareSchemesTotalTax),
20575
20584
  bonusesTotalAmount: new forms.FormControl({
20576
20585
  value: otherIncome.bonusesTotalAmount,
20577
20586
  disabled: true
@@ -20955,8 +20964,6 @@
20955
20964
  exports.MyTaxDeductionsForm = MyTaxDeductionsForm;
20956
20965
  exports.MyTaxDividends = MyTaxDividends;
20957
20966
  exports.MyTaxDividendsForm = MyTaxDividendsForm;
20958
- exports.MyTaxEmployeeShareSchemes = MyTaxEmployeeShareSchemes;
20959
- exports.MyTaxEmployeeShareSchemesForm = MyTaxEmployeeShareSchemesForm;
20960
20967
  exports.MyTaxEstimate = MyTaxEstimate;
20961
20968
  exports.MyTaxIncomeStatements = MyTaxIncomeStatements;
20962
20969
  exports.MyTaxIncomeStatementsForm = MyTaxIncomeStatementsForm;