taxtank-core 0.28.99 → 0.28.100

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'),
@@ -12157,11 +12158,23 @@
12157
12158
  function ServicePayment() {
12158
12159
  return _super !== null && _super.apply(this, arguments) || this;
12159
12160
  }
12161
+ /**
12162
+ * Stripe stores actual links to payment invoices for 30 days.
12163
+ * Link expires after 30 days
12164
+ */
12165
+ ServicePayment.prototype.isInvoiceLinkExpired = function () {
12166
+ var expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
12167
+ return expirationDate.getTime() < new Date().getTime();
12168
+ };
12160
12169
  return ServicePayment;
12161
12170
  }(ServicePayment$1));
12171
+ ServicePayment.daysToInvoiceUrlExpired = 30;
12162
12172
  __decorate([
12163
12173
  classTransformer.Type(function () { return ServiceSubscription; })
12164
12174
  ], ServicePayment.prototype, "subscription", void 0);
12175
+ __decorate([
12176
+ classTransformer.Type(function () { return Date; })
12177
+ ], ServicePayment.prototype, "date", void 0);
12165
12178
 
12166
12179
  var TaxReview$1 = /** @class */ (function (_super) {
12167
12180
  __extends(TaxReview, _super);
@@ -15236,7 +15249,6 @@
15236
15249
  return this.http.put(this.apiUrl, models)
15237
15250
  .pipe(operators.map(function (response) {
15238
15251
  var result = response.map(function (item) { return _this.createModelInstance(_this.modelClass, item); });
15239
- debugger;
15240
15252
  _this.handleResponse(result, 'put');
15241
15253
  return result;
15242
15254
  }));
@@ -16047,7 +16059,7 @@
16047
16059
  var _this = this;
16048
16060
  if (!this._servicePayments) {
16049
16061
  this.http.get(this.environment.apiV2 + "/service-payments").subscribe(function (response) {
16050
- _this._servicePayments = response.map(function (item) { return classTransformer.plainToClass(ServicePayment, item); });
16062
+ _this._servicePayments = response['hydra:member'].map(function (item) { return classTransformer.plainToClass(ServicePayment, item); });
16051
16063
  _this.servicePaymentsSubject.next(_this._servicePayments);
16052
16064
  });
16053
16065
  }
@@ -16087,6 +16099,15 @@
16087
16099
  }, 2000);
16088
16100
  });
16089
16101
  };
16102
+ /**
16103
+ * Stripe stores actual links to payment invoices for 30 days. After that, we need to request an actual link
16104
+ */
16105
+ SubscriptionService.prototype.getPaymentInvoiceUrl = function (payment) {
16106
+ if (!payment.isInvoiceLinkExpired()) {
16107
+ return rxjs.of(payment.receipt);
16108
+ }
16109
+ return this.http.get(this.environment.apiV2 + "/service-payments/" + payment.id + "/invoice-url");
16110
+ };
16090
16111
  return SubscriptionService;
16091
16112
  }());
16092
16113
  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 });