feat: implement payment verification error component and update checkout flow
This commit is contained in:
@@ -189,7 +189,7 @@ describe('CheckoutPageComponent payment validation', () => {
|
|||||||
expect(checkoutServiceStub.getPurchase).not.toHaveBeenCalled();
|
expect(checkoutServiceStub.getPurchase).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks a transfer once and redirects to purchase status while pending', async () => {
|
it('shows the verification error without redirecting while a transfer is pending', async () => {
|
||||||
const { component } = createComponent();
|
const { component } = createComponent();
|
||||||
component.selectedPaymentMethod.set('transfer');
|
component.selectedPaymentMethod.set('transfer');
|
||||||
|
|
||||||
@@ -197,13 +197,13 @@ describe('CheckoutPageComponent payment validation', () => {
|
|||||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||||
expect(component.transferValidationStatus()).toBe('pending');
|
expect(component.transferValidationStatus()).toBe('pending');
|
||||||
expect(cartServiceStub.clearCart).not.toHaveBeenCalled();
|
expect(cartServiceStub.clearCart).not.toHaveBeenCalled();
|
||||||
expect(routerStub.navigate).toHaveBeenCalledWith(['/checkout/status', 25]);
|
expect(routerStub.navigate).not.toHaveBeenCalled();
|
||||||
|
|
||||||
await vi.advanceTimersByTimeAsync(30_000);
|
await vi.advanceTimersByTimeAsync(30_000);
|
||||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
await component.onComplete();
|
await component.onComplete();
|
||||||
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(1);
|
expect(checkoutServiceStub.getPurchase).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigates after a transfer is confirmed as paid', async () => {
|
it('navigates after a transfer is confirmed as paid', async () => {
|
||||||
@@ -360,11 +360,7 @@ describe('CheckoutPageComponent payment validation', () => {
|
|||||||
|
|
||||||
expect(component.checkoutStepIndex()).toBe(1);
|
expect(component.checkoutStepIndex()).toBe(1);
|
||||||
expect(component.selectedPaymentMethod()).toBe('qr');
|
expect(component.selectedPaymentMethod()).toBe('qr');
|
||||||
expect(checkoutServiceStub.generatePaymentIntent).toHaveBeenCalledWith(
|
expect(checkoutServiceStub.generatePaymentIntent).toHaveBeenCalledWith('tenant-test', 25, 'qr');
|
||||||
'tenant-test',
|
|
||||||
25,
|
|
||||||
'qr',
|
|
||||||
);
|
|
||||||
expect(component.qrData()).toBe('qr-value');
|
expect(component.qrData()).toBe('qr-value');
|
||||||
expect(component.qrPaymentStatus()).toBe('waiting');
|
expect(component.qrPaymentStatus()).toBe('waiting');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -447,7 +447,6 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (purchase.status === 'pending_payment') {
|
if (purchase.status === 'pending_payment') {
|
||||||
this.transferValidationStatus.set('pending');
|
this.transferValidationStatus.set('pending');
|
||||||
this.navigateToPurchaseStatus(purchaseId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
<div class="checkout-payment">
|
<div class="checkout-payment">
|
||||||
<div class="checkout-payment__content">
|
<div class="checkout-payment__content">
|
||||||
<section class="payment-methods" aria-labelledby="payment-methods-title">
|
<section class="payment-methods" aria-labelledby="payment-methods-title">
|
||||||
<h2 id="payment-methods-title" class="payment-methods__title">Selecciona el metodo de pago</h2>
|
<h2 id="payment-methods-title" class="payment-methods__title">
|
||||||
|
Selecciona el metodo de pago
|
||||||
|
</h2>
|
||||||
|
|
||||||
<div class="payment-methods__list" role="radiogroup" aria-label="Metodo de pago">
|
<div class="payment-methods__list" role="radiogroup" aria-label="Metodo de pago">
|
||||||
@for (method of paymentMethods(); track method.id) {
|
@for (method of paymentMethods(); track method.id) {
|
||||||
<label
|
<label class="payment-method" [class.is-selected]="selectedPaymentMethod() === method.id">
|
||||||
class="payment-method"
|
|
||||||
[class.is-selected]="selectedPaymentMethod() === method.id"
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
class="payment-method__radio"
|
class="payment-method__radio"
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -21,7 +20,8 @@
|
|||||||
<span class="payment-method__label">
|
<span class="payment-method__label">
|
||||||
@if (method.id === 'telepagos') {
|
@if (method.id === 'telepagos') {
|
||||||
<span class="telepagos-logo" aria-label="TelePagos">
|
<span class="telepagos-logo" aria-label="TelePagos">
|
||||||
<span class="telepagos-logo__tele">tele</span><span class="telepagos-logo__pagos">pagos</span>
|
<span class="telepagos-logo__tele">tele</span
|
||||||
|
><span class="telepagos-logo__pagos">pagos</span>
|
||||||
</span>
|
</span>
|
||||||
} @else {
|
} @else {
|
||||||
{{ method.label }}
|
{{ method.label }}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<section class="payment-panel d-flex justify-content-end" aria-live="polite">
|
<section class="payment-panel d-flex justify-content-end" aria-live="polite">
|
||||||
@if (isGeneratingIntent()) {
|
@if (isGeneratingIntent()) {
|
||||||
<div class="payment-panel__card" style="text-align: center; padding: 2rem;">
|
<div class="payment-panel__card" style="text-align: center; padding: 2rem">
|
||||||
<h3 class="payment-panel__title">Cargando información de pago...</h3>
|
<h3 class="payment-panel__title">Cargando información de pago...</h3>
|
||||||
</div>
|
</div>
|
||||||
} @else if (selectedPaymentMethod() === 'qr') {
|
} @else if (selectedPaymentMethod() === 'qr') {
|
||||||
@@ -53,6 +53,8 @@
|
|||||||
[transferDni]="transferDni()"
|
[transferDni]="transferDni()"
|
||||||
[copiedTransferField]="copiedTransferField()"
|
[copiedTransferField]="copiedTransferField()"
|
||||||
[validationStatus]="transferValidationStatus()"
|
[validationStatus]="transferValidationStatus()"
|
||||||
|
[paymentAmount]="qrPaymentAmount()"
|
||||||
|
[whatsappUrl]="whatsappUrl()"
|
||||||
(copyTransferValue)="requestCopy($event.field, $event.value)"
|
(copyTransferValue)="requestCopy($event.field, $event.value)"
|
||||||
(submitDni)="generateTransferIntent.emit($event)"
|
(submitDni)="generateTransferIntent.emit($event)"
|
||||||
(completePurchase)="complete.emit()"
|
(completePurchase)="complete.emit()"
|
||||||
@@ -63,4 +65,3 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,9 @@
|
|||||||
<div class="payment-panel__card">
|
<div class="payment-panel__card">
|
||||||
@if (paymentStatus() === 'timed_out') {
|
@if (paymentStatus() === 'timed_out') {
|
||||||
<div class="payment-timeout" role="alert">
|
<app-payment-verification-error
|
||||||
<div class="payment-timeout__icon" aria-hidden="true">
|
[paymentAmount]="paymentAmount()"
|
||||||
<i class="fa-solid fa-xmark"></i>
|
[whatsappUrl]="whatsappUrl()"
|
||||||
</div>
|
/>
|
||||||
<h4 class="payment-timeout__title">No pudimos verificar el pago de {{ formattedAmount() }}.</h4>
|
|
||||||
<p class="payment-timeout__message">Por favor contactate con nosotros para resolverlo.</p>
|
|
||||||
@if (whatsappUrl()) {
|
|
||||||
<app-button
|
|
||||||
type="button"
|
|
||||||
variant="primary"
|
|
||||||
buttonClass="d-inline-flex align-items-center justify-content-center gap-2"
|
|
||||||
(click)="openWhatsApp()"
|
|
||||||
>
|
|
||||||
<span>WhatsApp</span>
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
} @else {
|
} @else {
|
||||||
<h3 class="payment-panel__title">Ingresa a tu billetera y escanea el siguiente QR</h3>
|
<h3 class="payment-panel__title">Ingresa a tu billetera y escanea el siguiente QR</h3>
|
||||||
<div class="payment-panel__divider"></div>
|
<div class="payment-panel__divider"></div>
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
rgba(17, 17, 17, 0.95) 84% 100%
|
rgba(17, 17, 17, 0.95) 84% 100%
|
||||||
);
|
);
|
||||||
background-size: 18px 18px;
|
background-size: 18px 18px;
|
||||||
background-position: 0 0, 9px 9px;
|
background-position:
|
||||||
|
0 0,
|
||||||
|
9px 9px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -86,7 +88,9 @@
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
border: 5px solid #111111;
|
border: 5px solid #111111;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
box-shadow: inset 0 0 0 8px #ffffff, inset 0 0 0 14px #111111;
|
box-shadow:
|
||||||
|
inset 0 0 0 8px #ffffff,
|
||||||
|
inset 0 0 0 14px #111111;
|
||||||
|
|
||||||
&--tl {
|
&--tl {
|
||||||
top: 10px;
|
top: 10px;
|
||||||
@@ -116,43 +120,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-timeout {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
padding-top: 0.85rem;
|
|
||||||
|
|
||||||
&__icon {
|
|
||||||
display: grid;
|
|
||||||
width: 84px;
|
|
||||||
height: 84px;
|
|
||||||
place-items: center;
|
|
||||||
border: 1px solid var(--tenant-danger, #dc3545);
|
|
||||||
border-radius: 50%;
|
|
||||||
color: var(--tenant-danger, #dc3545);
|
|
||||||
font-size: 2.7rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__title {
|
|
||||||
max-width: 250px;
|
|
||||||
margin: 1.35rem 0 0;
|
|
||||||
color: var(--tenant-danger, #dc3545);
|
|
||||||
font-size: 1.05rem;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.3;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__message {
|
|
||||||
max-width: 250px;
|
|
||||||
margin: 2rem 0 1.75rem;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 1rem;
|
|
||||||
line-height: 1.25;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-verification {
|
.payment-verification {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
|
|||||||
@@ -40,10 +40,12 @@ describe('CheckoutPaymentQrComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const element = fixture.nativeElement as HTMLElement;
|
const element = fixture.nativeElement as HTMLElement;
|
||||||
const whatsapp = element.querySelector<HTMLAnchorElement>('.payment-timeout__whatsapp');
|
const whatsapp = Array.from(element.querySelectorAll('button')).find((button) =>
|
||||||
|
button.textContent?.includes('WhatsApp'),
|
||||||
|
);
|
||||||
expect(element.textContent).toMatch(/No pudimos verificar el pago de \$\s*300\.000\./);
|
expect(element.textContent).toMatch(/No pudimos verificar el pago de \$\s*300\.000\./);
|
||||||
expect(element.textContent).toContain('Por favor contactate con nosotros para resolverlo.');
|
expect(element.textContent).toContain('Por favor contactate con nosotros para resolverlo.');
|
||||||
expect(whatsapp?.href).toBe('https://wa.me/543412602222');
|
expect(whatsapp).toBeDefined();
|
||||||
expect(element.textContent).not.toContain('Volver a verificar');
|
expect(element.textContent).not.toContain('Volver a verificar');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||||
import { ButtonComponent } from '../../../../../../shared/components/button/button.component';
|
|
||||||
import { QRCodeComponent } from '../../../../../../shared/components/qrcode/qrcode.component';
|
import { QRCodeComponent } from '../../../../../../shared/components/qrcode/qrcode.component';
|
||||||
import { QrPaymentStatus } from '../../checkout-page.models';
|
import { QrPaymentStatus } from '../../checkout-page.models';
|
||||||
|
import { PaymentVerificationErrorComponent } from '../payment-verification-error/payment-verification-error.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-checkout-payment-qr',
|
selector: 'app-checkout-payment-qr',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ButtonComponent, QRCodeComponent],
|
imports: [PaymentVerificationErrorComponent, QRCodeComponent],
|
||||||
templateUrl: './checkout-payment-qr.component.html',
|
templateUrl: './checkout-payment-qr.component.html',
|
||||||
styleUrl: './checkout-payment-qr.component.scss',
|
styleUrl: './checkout-payment-qr.component.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CheckoutPaymentQrComponent {
|
export class CheckoutPaymentQrComponent {
|
||||||
readonly qrData = input<string | null>(null);
|
readonly qrData = input<string | null>(null);
|
||||||
@@ -17,19 +17,4 @@ export class CheckoutPaymentQrComponent {
|
|||||||
readonly isCheckingPayment = input<boolean>(false);
|
readonly isCheckingPayment = input<boolean>(false);
|
||||||
readonly paymentAmount = input<number>(0);
|
readonly paymentAmount = input<number>(0);
|
||||||
readonly whatsappUrl = input<string | null>(null);
|
readonly whatsappUrl = input<string | null>(null);
|
||||||
protected readonly formattedAmount = computed(() =>
|
|
||||||
new Intl.NumberFormat('es-AR', {
|
|
||||||
style: 'currency',
|
|
||||||
currency: 'ARS',
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
}).format(this.paymentAmount()),
|
|
||||||
);
|
|
||||||
|
|
||||||
protected openWhatsApp(): void {
|
|
||||||
const url = this.whatsappUrl();
|
|
||||||
|
|
||||||
if (url) {
|
|
||||||
window.open(url, '_blank', 'noopener,noreferrer');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,105 +1,106 @@
|
|||||||
<div class="payment-panel__card">
|
<div class="payment-panel__card">
|
||||||
<div class="dni-form-container">
|
@if (validationStatus() === 'pending' || validationStatus() === 'error') {
|
||||||
<h3 class="dni-form-title">Ingresá DNI de quién va a transferir</h3>
|
<app-payment-verification-error
|
||||||
<form class="dni-form row gx-2" (submit)="$event.preventDefault(); onSubmitDni()">
|
[paymentAmount]="paymentAmount()"
|
||||||
<div class="col-8">
|
[whatsappUrl]="whatsappUrl()"
|
||||||
<app-input
|
/>
|
||||||
type="text"
|
} @else {
|
||||||
[value]="dniControl.value"
|
<div class="dni-form-container">
|
||||||
(valueChange)="dniControl.setValue($event.toString()); dniControl.markAsDirty()"
|
<h3 class="dni-form-title">Ingresá DNI de quién va a transferir</h3>
|
||||||
[disabled]="isDniDisabled()"
|
<form class="dni-form row gx-2" (submit)="$event.preventDefault(); onSubmitDni()">
|
||||||
[invalid]="dniControl.invalid && (dniControl.dirty || dniControl.touched)"
|
<div class="col-8">
|
||||||
/>
|
<app-input
|
||||||
</div>
|
type="text"
|
||||||
<div class="col-4">
|
[value]="dniControl.value"
|
||||||
@if (isDniDisabled()) {
|
(valueChange)="dniControl.setValue($event.toString()); dniControl.markAsDirty()"
|
||||||
<app-button
|
[disabled]="isDniDisabled()"
|
||||||
type="button"
|
[invalid]="dniControl.invalid && (dniControl.dirty || dniControl.touched)"
|
||||||
variant="secondary"
|
/>
|
||||||
hostClass="w-100 h-100"
|
</div>
|
||||||
buttonClass="w-100 h-100 px-0"
|
<div class="col-4">
|
||||||
(click)="enableEditing()"
|
@if (isDniDisabled()) {
|
||||||
>
|
<app-button
|
||||||
Modificar
|
type="button"
|
||||||
</app-button>
|
variant="secondary"
|
||||||
} @else {
|
hostClass="w-100 h-100"
|
||||||
<app-button
|
buttonClass="w-100 h-100 px-0"
|
||||||
type="submit"
|
(click)="enableEditing()"
|
||||||
variant="primary"
|
>
|
||||||
hostClass="w-100 h-100"
|
Modificar
|
||||||
buttonClass="w-100 h-100 px-0"
|
</app-button>
|
||||||
[disabled]="dniControl.invalid"
|
} @else {
|
||||||
>
|
<app-button
|
||||||
Continuar
|
type="submit"
|
||||||
</app-button>
|
variant="primary"
|
||||||
}
|
hostClass="w-100 h-100"
|
||||||
</div>
|
buttonClass="w-100 h-100 px-0"
|
||||||
</form>
|
[disabled]="dniControl.invalid"
|
||||||
</div>
|
>
|
||||||
|
Continuar
|
||||||
@if (transferAccount() && !isEditing()) {
|
</app-button>
|
||||||
<div class="payment-panel__divider"></div>
|
}
|
||||||
<div class="payment-panel__account">
|
</div>
|
||||||
<p class="payment-panel__eyebrow">DATOS DE CUENTA:</p>
|
</form>
|
||||||
|
|
||||||
<div class="payment-detail">
|
|
||||||
<span class="payment-detail__label">Titular:</span>
|
|
||||||
<span class="payment-detail__value">{{ transferAccount()?.titular }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="payment-detail">
|
|
||||||
<span class="payment-detail__label">Entidad:</span>
|
|
||||||
<span class="payment-detail__value">{{ transferAccount()?.entidad }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="payment-detail payment-detail--copy">
|
|
||||||
<span class="payment-detail__label">CVU:</span>
|
|
||||||
<span class="payment-detail__value">{{ transferAccount()?.cvu }}</span>
|
|
||||||
<app-icon-button
|
|
||||||
variant="copy"
|
|
||||||
ariaLabel="Copiar CVU"
|
|
||||||
(click)="requestCopy('cvu', transferAccount()!.cvu)"
|
|
||||||
/>
|
|
||||||
@if (copiedTransferField() === 'cvu') {
|
|
||||||
<span class="payment-detail__feedback" style="grid-column: 1 / -1; text-align: center;">¡Copiado!</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="payment-detail payment-detail--copy">
|
|
||||||
<span class="payment-detail__label">Alias:</span>
|
|
||||||
<span class="payment-detail__value">{{ transferAccount()?.alias }}</span>
|
|
||||||
<app-icon-button
|
|
||||||
variant="copy"
|
|
||||||
ariaLabel="Copiar Alias"
|
|
||||||
(click)="requestCopy('alias', transferAccount()!.alias)"
|
|
||||||
/>
|
|
||||||
@if (copiedTransferField() === 'alias') {
|
|
||||||
<span class="payment-detail__feedback" style="grid-column: 1 / -1; text-align: center;">¡Copiado!</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
@if (transferAccount() && !isEditing()) {
|
||||||
<app-button
|
<div class="payment-panel__divider"></div>
|
||||||
type="button"
|
<div class="payment-panel__account">
|
||||||
variant="primary"
|
<p class="payment-panel__eyebrow">DATOS DE CUENTA:</p>
|
||||||
hostClass="w-100"
|
|
||||||
buttonClass="w-100"
|
|
||||||
[disabled]="validationStatus() === 'checking'"
|
|
||||||
(click)="completePurchase.emit()"
|
|
||||||
>
|
|
||||||
{{ validationStatus() === 'checking' ? 'Validando pago...' : 'Ya transferí' }}
|
|
||||||
</app-button>
|
|
||||||
|
|
||||||
@if (validationStatus() === 'pending') {
|
<div class="payment-detail">
|
||||||
<p class="payment-validation payment-validation--pending" role="status">
|
<span class="payment-detail__label">Titular:</span>
|
||||||
Todavía no recibimos la transferencia. Podés volver a verificar.
|
<span class="payment-detail__value">{{ transferAccount()?.titular }}</span>
|
||||||
</p>
|
</div>
|
||||||
} @else if (validationStatus() === 'error') {
|
|
||||||
<p class="payment-validation payment-validation--error" role="alert">
|
<div class="payment-detail">
|
||||||
No pudimos validar la transferencia. Intentá nuevamente.
|
<span class="payment-detail__label">Entidad:</span>
|
||||||
</p>
|
<span class="payment-detail__value">{{ transferAccount()?.entidad }}</span>
|
||||||
}
|
</div>
|
||||||
</div>
|
|
||||||
|
<div class="payment-detail payment-detail--copy">
|
||||||
|
<span class="payment-detail__label">CVU:</span>
|
||||||
|
<span class="payment-detail__value">{{ transferAccount()?.cvu }}</span>
|
||||||
|
<app-icon-button
|
||||||
|
variant="copy"
|
||||||
|
ariaLabel="Copiar CVU"
|
||||||
|
(click)="requestCopy('cvu', transferAccount()!.cvu)"
|
||||||
|
/>
|
||||||
|
@if (copiedTransferField() === 'cvu') {
|
||||||
|
<span class="payment-detail__feedback" style="grid-column: 1 / -1; text-align: center"
|
||||||
|
>¡Copiado!</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="payment-detail payment-detail--copy">
|
||||||
|
<span class="payment-detail__label">Alias:</span>
|
||||||
|
<span class="payment-detail__value">{{ transferAccount()?.alias }}</span>
|
||||||
|
<app-icon-button
|
||||||
|
variant="copy"
|
||||||
|
ariaLabel="Copiar Alias"
|
||||||
|
(click)="requestCopy('alias', transferAccount()!.alias)"
|
||||||
|
/>
|
||||||
|
@if (copiedTransferField() === 'alias') {
|
||||||
|
<span class="payment-detail__feedback" style="grid-column: 1 / -1; text-align: center"
|
||||||
|
>¡Copiado!</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
<app-button
|
||||||
|
type="button"
|
||||||
|
variant="primary"
|
||||||
|
hostClass="w-100"
|
||||||
|
buttonClass="w-100"
|
||||||
|
[disabled]="validationStatus() === 'checking'"
|
||||||
|
(click)="completePurchase.emit()"
|
||||||
|
>
|
||||||
|
{{ validationStatus() === 'checking' ? 'Validando pago...' : 'Ya transferí' }}
|
||||||
|
</app-button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -115,17 +115,3 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-validation {
|
|
||||||
margin: 0.75rem 0 0;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
line-height: 1.35;
|
|
||||||
|
|
||||||
&--pending {
|
|
||||||
color: #8a681d;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--error {
|
|
||||||
color: #b42318;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,23 +1,46 @@
|
|||||||
import { ChangeDetectionStrategy, Component, computed, input, output, signal, OnInit, effect, untracked } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
computed,
|
||||||
|
input,
|
||||||
|
output,
|
||||||
|
signal,
|
||||||
|
OnInit,
|
||||||
|
effect,
|
||||||
|
untracked,
|
||||||
|
} from '@angular/core';
|
||||||
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { IconButtonComponent } from '../../../../../../shared/components/icon-button/icon-button.component';
|
import { IconButtonComponent } from '../../../../../../shared/components/icon-button/icon-button.component';
|
||||||
import { ButtonComponent } from '../../../../../../shared/components/button/button.component';
|
import { ButtonComponent } from '../../../../../../shared/components/button/button.component';
|
||||||
import { InputComponent } from '../../../../../../shared/components/input/input.component';
|
import { InputComponent } from '../../../../../../shared/components/input/input.component';
|
||||||
import { TransferAccount, TransferField, TransferValidationStatus } from '../../checkout-page.models';
|
import {
|
||||||
|
TransferAccount,
|
||||||
|
TransferField,
|
||||||
|
TransferValidationStatus,
|
||||||
|
} from '../../checkout-page.models';
|
||||||
|
import { PaymentVerificationErrorComponent } from '../payment-verification-error/payment-verification-error.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-checkout-payment-transfer',
|
selector: 'app-checkout-payment-transfer',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [IconButtonComponent, ButtonComponent, InputComponent, ReactiveFormsModule],
|
imports: [
|
||||||
|
IconButtonComponent,
|
||||||
|
ButtonComponent,
|
||||||
|
InputComponent,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
PaymentVerificationErrorComponent,
|
||||||
|
],
|
||||||
templateUrl: './checkout-payment-transfer.component.html',
|
templateUrl: './checkout-payment-transfer.component.html',
|
||||||
styleUrl: './checkout-payment-transfer.component.scss',
|
styleUrl: './checkout-payment-transfer.component.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class CheckoutPaymentTransferComponent implements OnInit {
|
export class CheckoutPaymentTransferComponent implements OnInit {
|
||||||
readonly transferAccount = input<TransferAccount | null>(null);
|
readonly transferAccount = input<TransferAccount | null>(null);
|
||||||
readonly transferDni = input<string>('');
|
readonly transferDni = input<string>('');
|
||||||
readonly copiedTransferField = input<TransferField | null>(null);
|
readonly copiedTransferField = input<TransferField | null>(null);
|
||||||
readonly validationStatus = input<TransferValidationStatus>('idle');
|
readonly validationStatus = input<TransferValidationStatus>('idle');
|
||||||
|
readonly paymentAmount = input<number>(0);
|
||||||
|
readonly whatsappUrl = input<string | null>(null);
|
||||||
|
|
||||||
readonly copyTransferValue = output<{ field: TransferField; value: string }>();
|
readonly copyTransferValue = output<{ field: TransferField; value: string }>();
|
||||||
readonly submitDni = output<string>();
|
readonly submitDni = output<string>();
|
||||||
@@ -25,7 +48,7 @@ export class CheckoutPaymentTransferComponent implements OnInit {
|
|||||||
|
|
||||||
protected readonly dniControl = new FormControl('', {
|
protected readonly dniControl = new FormControl('', {
|
||||||
nonNullable: true,
|
nonNullable: true,
|
||||||
validators: [Validators.required, Validators.pattern(/^\d{7,8}$/)]
|
validators: [Validators.required, Validators.pattern(/^\d{7,8}$/)],
|
||||||
});
|
});
|
||||||
|
|
||||||
protected readonly isEditing = signal<boolean>(false);
|
protected readonly isEditing = signal<boolean>(false);
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<div class="payment-timeout" role="alert">
|
||||||
|
<div class="payment-timeout__icon" aria-hidden="true">
|
||||||
|
<i class="fa-solid fa-xmark"></i>
|
||||||
|
</div>
|
||||||
|
<h4 class="payment-timeout__title">No pudimos verificar el pago de {{ formattedAmount() }}.</h4>
|
||||||
|
<p class="payment-timeout__message">Por favor contactate con nosotros para resolverlo.</p>
|
||||||
|
@if (whatsappUrl()) {
|
||||||
|
<app-button
|
||||||
|
type="button"
|
||||||
|
variant="primary"
|
||||||
|
buttonClass="d-inline-flex align-items-center justify-content-center gap-2"
|
||||||
|
(click)="openWhatsApp()"
|
||||||
|
>
|
||||||
|
<span>WhatsApp</span>
|
||||||
|
</app-button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
.payment-timeout {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 0.85rem;
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
display: grid;
|
||||||
|
width: 84px;
|
||||||
|
height: 84px;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--tenant-danger, #dc3545);
|
||||||
|
border-radius: 50%;
|
||||||
|
color: var(--tenant-danger, #dc3545);
|
||||||
|
font-size: 2.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
max-width: 250px;
|
||||||
|
margin: 1.35rem 0 0;
|
||||||
|
color: var(--tenant-danger, #dc3545);
|
||||||
|
font-size: 1.05rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__message {
|
||||||
|
max-width: 250px;
|
||||||
|
margin: 2rem 0 1.75rem;
|
||||||
|
color: #666666;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||||
|
|
||||||
|
import { ButtonComponent } from '../../../../../../shared/components/button/button.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-payment-verification-error',
|
||||||
|
standalone: true,
|
||||||
|
imports: [ButtonComponent],
|
||||||
|
templateUrl: './payment-verification-error.component.html',
|
||||||
|
styleUrl: './payment-verification-error.component.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
})
|
||||||
|
export class PaymentVerificationErrorComponent {
|
||||||
|
readonly paymentAmount = input<number>(0);
|
||||||
|
readonly whatsappUrl = input<string | null>(null);
|
||||||
|
|
||||||
|
protected readonly formattedAmount = computed(() =>
|
||||||
|
new Intl.NumberFormat('es-AR', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'ARS',
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
}).format(this.paymentAmount()),
|
||||||
|
);
|
||||||
|
|
||||||
|
protected openWhatsApp(): void {
|
||||||
|
const url = this.whatsappUrl();
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
window.open(url, '_blank', 'noopener,noreferrer');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user