All files / src/app/pages/withdrawal-request withdrawal-request-page.component.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 3/3
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 351x   1x                               1x 3x   3x 3x 3x 3x     1x       1x      
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
 
import { WithdrawalFacade } from 'ish-core/facades/withdrawal.facade';
import { Withdrawal } from 'ish-core/models/withdrawal/withdrawal.model';
 
/**
 * Page component for the right-of-withdrawal request flow.
 *
 * Orchestrates the two-step withdrawal process:
 * 1. The customer enters the order number and email to look up the order (`createWithdrawal`).
 * 2. The customer confirms and submits the full withdrawal request (`submitWithdrawal`).
 */
@Component({
  selector: 'ish-withdrawal-request-page',
  templateUrl: './withdrawal-request-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
  providers: [WithdrawalFacade],
})
export class WithdrawalRequestPageComponent {
  private withdrawalFacade = inject(WithdrawalFacade);
 
  withdrawal = this.withdrawalFacade.withdrawal;
  loading = this.withdrawalFacade.loading;
  error = this.withdrawalFacade.error;
  initialized = this.withdrawalFacade.initialized;
 
  createWithdrawal(data: Withdrawal) {
    this.withdrawalFacade.createWithdrawal(data);
  }
 
  submitWithdrawal(data: Withdrawal) {
    this.withdrawalFacade.sendWithdrawal(data);
  }
}