@hmcts/ccpay-web-component 6.5.22 → 6.5.24-beta01
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, EventEmitter, Output, Input, Inject, Component, Pipe, forwardRef, ViewChild, NgModule } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject, throwError } from 'rxjs';
|
|
3
|
+
import { BehaviorSubject, throwError, forkJoin } from 'rxjs';
|
|
4
4
|
import * as i3 from '@angular/common';
|
|
5
5
|
import { CommonModule, formatDate } from '@angular/common';
|
|
6
6
|
import * as i1 from '@angular/common/http';
|
|
@@ -4711,25 +4711,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
4711
4711
|
|
|
4712
4712
|
class StatusHistoryComponent {
|
|
4713
4713
|
statusHistoryService;
|
|
4714
|
+
paymentViewService;
|
|
4714
4715
|
paymentLibComponent;
|
|
4715
4716
|
isTakePayment;
|
|
4716
4717
|
pageTitle = 'Payment status history';
|
|
4717
4718
|
statuses;
|
|
4719
|
+
isDisplayFailureReasonColumn = false;
|
|
4720
|
+
isDisplayReasons = [];
|
|
4718
4721
|
errorMessage;
|
|
4719
|
-
constructor(statusHistoryService, paymentLibComponent) {
|
|
4722
|
+
constructor(statusHistoryService, paymentViewService, paymentLibComponent) {
|
|
4720
4723
|
this.statusHistoryService = statusHistoryService;
|
|
4724
|
+
this.paymentViewService = paymentViewService;
|
|
4721
4725
|
this.paymentLibComponent = paymentLibComponent;
|
|
4722
4726
|
}
|
|
4723
4727
|
ngOnInit() {
|
|
4724
|
-
|
|
4728
|
+
forkJoin({
|
|
4729
|
+
paymentGroup: this.paymentViewService.getApportionPaymentDetails(this.paymentLibComponent.paymentReference),
|
|
4730
|
+
statuses: this.statusHistoryService.getPaymentStatusesByReference(this.paymentLibComponent.paymentReference, this.paymentLibComponent.paymentMethod)
|
|
4731
|
+
}).subscribe(({ paymentGroup, statuses }) => {
|
|
4732
|
+
this.statuses = statuses;
|
|
4733
|
+
const firstPayment = paymentGroup &&
|
|
4734
|
+
paymentGroup.payments &&
|
|
4735
|
+
paymentGroup.payments.length > 0 ? paymentGroup.payments[0] : null;
|
|
4736
|
+
if (firstPayment &&
|
|
4737
|
+
(firstPayment.channel === 'telephony' || firstPayment.channel === 'online') &&
|
|
4738
|
+
(firstPayment.method === 'card')) {
|
|
4739
|
+
this.isDisplayReasons = this.statuses.status_histories.map(statusHistory => statusHistory.status === 'failed' ||
|
|
4740
|
+
statusHistory.status === 'declined' ||
|
|
4741
|
+
statusHistory.status === 'cancelled' ||
|
|
4742
|
+
statusHistory.status === 'timed out' ||
|
|
4743
|
+
statusHistory.status === 'error');
|
|
4744
|
+
this.isDisplayFailureReasonColumn = this.isDisplayReasons.some(isDisplayReason => isDisplayReason);
|
|
4745
|
+
}
|
|
4746
|
+
else {
|
|
4747
|
+
this.isDisplayReasons = [];
|
|
4748
|
+
this.isDisplayFailureReasonColumn = false;
|
|
4749
|
+
}
|
|
4750
|
+
}, (error) => this.errorMessage = error.replace(/"/g, ""));
|
|
4725
4751
|
}
|
|
4726
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StatusHistoryComponent, deps: [{ token: StatusHistoryService }, { token: 'PAYMENT_LIB' }], target: i0.ɵɵFactoryTarget.Component });
|
|
4727
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: StatusHistoryComponent, isStandalone: true, selector: "ccpay-payment-statuses", inputs: { isTakePayment: "isTakePayment" }, ngImport: i0, template: "<div class=\"column\">\n <h2 class=\"heading-medium\">{{ pageTitle }}</h2>\n</div>\n\n\n<div class=\"error-summary\" role=\"group\" aria-labelledby=\"failure-error-summary-heading\" tabindex=\"-1\" *ngIf=\"errorMessage\">\n <h2 class=\"heading-medium error-summary-heading\" id=\"failure-error-summary-heading\">\n Payment status history could not be retrieved\n </h2>\n <div class=\"govuk-error-summary__body\">\n {{ errorMessage }}\n </div>\n</div>\n\n<div *ngIf=\"!errorMessage && statuses\">\n <table>\n <thead>\n <tr>\n <th>Status</th>\n <th *ngIf=\"isTakePayment\">Amount</th>\n <th>Date and time</th>\n </tr>\n </thead
|
|
4752
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StatusHistoryComponent, deps: [{ token: StatusHistoryService }, { token: PaymentViewService }, { token: 'PAYMENT_LIB' }], target: i0.ɵɵFactoryTarget.Component });
|
|
4753
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: StatusHistoryComponent, isStandalone: true, selector: "ccpay-payment-statuses", inputs: { isTakePayment: "isTakePayment" }, ngImport: i0, template: "<div class=\"column\">\n <h2 class=\"heading-medium\">{{ pageTitle }}</h2>\n</div>\n\n\n<div class=\"error-summary\" role=\"group\" aria-labelledby=\"failure-error-summary-heading\" tabindex=\"-1\" *ngIf=\"errorMessage\">\n <h2 class=\"heading-medium error-summary-heading\" id=\"failure-error-summary-heading\">\n Payment status history could not be retrieved\n </h2>\n <div class=\"govuk-error-summary__body\">\n {{ errorMessage }}\n </div>\n</div>\n\n<div *ngIf=\"!errorMessage && statuses\">\n <table>\n <thead>\n <tr>\n <th>Status</th>\n <th *ngIf=\"isDisplayFailureReasonColumn\">Failure reason</th>\n <th *ngIf=\"isTakePayment\">Amount</th>\n <th>Date and time</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let status of statuses.status_histories; let i = index\">\n <td>{{ status.status }}</td>\n <td *ngIf=\"isDisplayFailureReasonColumn\">{{ isDisplayReasons[i] ? status.error_message : '' }}</td>\n <td *ngIf=\"isTakePayment\">\u00A3{{ statuses.amount | number:'.2' }}</td>\n <td>{{ status.date_created | date:'dd MMMM yyyy HH:mm:ss'}}</td>\n </tr>\n </tbody>\n </table>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.DecimalPipe, name: "number" }, { kind: "pipe", type: i3.DatePipe, name: "date" }] });
|
|
4728
4754
|
}
|
|
4729
4755
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StatusHistoryComponent, decorators: [{
|
|
4730
4756
|
type: Component,
|
|
4731
|
-
args: [{ selector: 'ccpay-payment-statuses', imports: [CommonModule], standalone: true, template: "<div class=\"column\">\n <h2 class=\"heading-medium\">{{ pageTitle }}</h2>\n</div>\n\n\n<div class=\"error-summary\" role=\"group\" aria-labelledby=\"failure-error-summary-heading\" tabindex=\"-1\" *ngIf=\"errorMessage\">\n <h2 class=\"heading-medium error-summary-heading\" id=\"failure-error-summary-heading\">\n Payment status history could not be retrieved\n </h2>\n <div class=\"govuk-error-summary__body\">\n {{ errorMessage }}\n </div>\n</div>\n\n<div *ngIf=\"!errorMessage && statuses\">\n <table>\n <thead>\n <tr>\n <th>Status</th>\n <th *ngIf=\"isTakePayment\">Amount</th>\n <th>Date and time</th>\n </tr>\n </thead
|
|
4732
|
-
}], ctorParameters: () => [{ type: StatusHistoryService }, { type: undefined, decorators: [{
|
|
4757
|
+
args: [{ selector: 'ccpay-payment-statuses', imports: [CommonModule], standalone: true, template: "<div class=\"column\">\n <h2 class=\"heading-medium\">{{ pageTitle }}</h2>\n</div>\n\n\n<div class=\"error-summary\" role=\"group\" aria-labelledby=\"failure-error-summary-heading\" tabindex=\"-1\" *ngIf=\"errorMessage\">\n <h2 class=\"heading-medium error-summary-heading\" id=\"failure-error-summary-heading\">\n Payment status history could not be retrieved\n </h2>\n <div class=\"govuk-error-summary__body\">\n {{ errorMessage }}\n </div>\n</div>\n\n<div *ngIf=\"!errorMessage && statuses\">\n <table>\n <thead>\n <tr>\n <th>Status</th>\n <th *ngIf=\"isDisplayFailureReasonColumn\">Failure reason</th>\n <th *ngIf=\"isTakePayment\">Amount</th>\n <th>Date and time</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let status of statuses.status_histories; let i = index\">\n <td>{{ status.status }}</td>\n <td *ngIf=\"isDisplayFailureReasonColumn\">{{ isDisplayReasons[i] ? status.error_message : '' }}</td>\n <td *ngIf=\"isTakePayment\">\u00A3{{ statuses.amount | number:'.2' }}</td>\n <td>{{ status.date_created | date:'dd MMMM yyyy HH:mm:ss'}}</td>\n </tr>\n </tbody>\n </table>\n</div>\n" }]
|
|
4758
|
+
}], ctorParameters: () => [{ type: StatusHistoryService }, { type: PaymentViewService }, { type: undefined, decorators: [{
|
|
4733
4759
|
type: Inject,
|
|
4734
4760
|
args: ['PAYMENT_LIB']
|
|
4735
4761
|
}] }], propDecorators: { isTakePayment: [{
|