@miden-npm/angular 0.0.18 → 0.0.19
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.
- package/buzapay-checkout/index.d.ts +12 -12
- package/fesm2022/miden-npm-angular-buzapay-checkout.mjs +118 -50
- package/fesm2022/miden-npm-angular-buzapay-checkout.mjs.map +1 -1
- package/fesm2022/miden-npm-angular.mjs +44 -14
- package/fesm2022/miden-npm-angular.mjs.map +1 -1
- package/index.d.ts +126 -114
- package/package.json +1 -1
- package/styles.css +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { EventEmitter, OnInit, ChangeDetectorRef, OnDestroy, AfterViewInit, Renderer2, ElementRef } from '@angular/core';
|
|
3
|
-
import { IPaymentObject, ISelectOption, ResourceService, CheckoutService, EncryptService, IPaymentAccountResponse, IPaymentReferenceDetail, IGenerateStableCoinAddress, IGenerateStableCoinAddressResponse } from '@miden-npm/angular';
|
|
3
|
+
import { IPaymentObject, ISuccessObject, ISelectOption, ResourceService, CheckoutService, EncryptService, IPaymentAccountResponse, IPaymentReferenceDetail, IGenerateStableCoinAddress, IGenerateStableCoinAddressResponse } from '@miden-npm/angular';
|
|
4
4
|
import { FormGroup, FormControl } from '@angular/forms';
|
|
5
5
|
|
|
6
6
|
interface CheckoutIframeStyle {
|
|
@@ -33,14 +33,15 @@ declare class CheckoutCardComponent {
|
|
|
33
33
|
field?: string;
|
|
34
34
|
}>;
|
|
35
35
|
tokenize: EventEmitter<TokenizeResult>;
|
|
36
|
-
|
|
36
|
+
successObject: ISuccessObject;
|
|
37
|
+
checkoutState: 'SUCCESS' | 'PENDING' | 'USED';
|
|
37
38
|
countryOptions: ISelectOption[];
|
|
38
39
|
paymentTypeOptions: ISelectOption[];
|
|
39
40
|
paymentType: string;
|
|
40
41
|
get filteredPaymentTypeOptions(): ISelectOption[];
|
|
41
42
|
get formatAmountHandler(): string;
|
|
42
43
|
paymentTypeHandler(event: string): void;
|
|
43
|
-
|
|
44
|
+
setSuccess(event: ISuccessObject): void;
|
|
44
45
|
static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutCardComponent, never>;
|
|
45
46
|
static ɵcmp: i0.ɵɵComponentDeclaration<CheckoutCardComponent, "bzp-checkout-card", never, { "options": { "alias": "options"; "required": false; }; "secretKey": { "alias": "secretKey"; "required": false; }; "environment": { "alias": "environment"; "required": false; }; "paymentObject": { "alias": "paymentObject"; "required": false; }; }, { "ready": "ready"; "validityChange": "validityChange"; "tokenize": "tokenize"; }, never, never, true, never>;
|
|
46
47
|
}
|
|
@@ -54,7 +55,7 @@ declare class PayByCardComponent implements OnInit {
|
|
|
54
55
|
secretKey: string;
|
|
55
56
|
environment: string;
|
|
56
57
|
paymentObject: IPaymentObject;
|
|
57
|
-
paymentAuthorized: EventEmitter<
|
|
58
|
+
paymentAuthorized: EventEmitter<ISuccessObject>;
|
|
58
59
|
loading: boolean;
|
|
59
60
|
loadingCountries: boolean;
|
|
60
61
|
loadingStates: boolean;
|
|
@@ -102,8 +103,7 @@ declare class PayByTransferComponent implements OnInit, OnDestroy {
|
|
|
102
103
|
secretKey: string;
|
|
103
104
|
environment: string;
|
|
104
105
|
paymentObject: IPaymentObject;
|
|
105
|
-
paymentAuthorized: EventEmitter<
|
|
106
|
-
paymentUsed: EventEmitter<string>;
|
|
106
|
+
paymentAuthorized: EventEmitter<ISuccessObject>;
|
|
107
107
|
message: string;
|
|
108
108
|
generatingLink: boolean;
|
|
109
109
|
isMakingPayment: boolean;
|
|
@@ -128,10 +128,10 @@ declare class PayByTransferComponent implements OnInit, OnDestroy {
|
|
|
128
128
|
generatePaymentLinkHandler(): Promise<void | string>;
|
|
129
129
|
payHandler(): Promise<void>;
|
|
130
130
|
getReferenceDetails(): Promise<void>;
|
|
131
|
-
ngOnInit(): void
|
|
131
|
+
ngOnInit(): Promise<void>;
|
|
132
132
|
ngOnDestroy(): void;
|
|
133
133
|
static ɵfac: i0.ɵɵFactoryDeclaration<PayByTransferComponent, never>;
|
|
134
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PayByTransferComponent, "pay-by-transfer", never, { "secretKey": { "alias": "secretKey"; "required": false; }; "environment": { "alias": "environment"; "required": false; }; "paymentObject": { "alias": "paymentObject"; "required": false; }; }, { "paymentAuthorized": "paymentAuthorized";
|
|
134
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PayByTransferComponent, "pay-by-transfer", never, { "secretKey": { "alias": "secretKey"; "required": false; }; "environment": { "alias": "environment"; "required": false; }; "paymentObject": { "alias": "paymentObject"; "required": false; }; }, { "paymentAuthorized": "paymentAuthorized"; }, never, never, true, never>;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
declare class PayByStableCoinComponent implements OnInit {
|
|
@@ -142,8 +142,7 @@ declare class PayByStableCoinComponent implements OnInit {
|
|
|
142
142
|
secretKey: string;
|
|
143
143
|
environment: string;
|
|
144
144
|
paymentObject: IPaymentObject;
|
|
145
|
-
paymentAuthorized: EventEmitter<
|
|
146
|
-
paymentUsed: EventEmitter<string>;
|
|
145
|
+
paymentAuthorized: EventEmitter<ISuccessObject>;
|
|
147
146
|
message: string;
|
|
148
147
|
transactionReference: string;
|
|
149
148
|
paymentReferenceStatus: string;
|
|
@@ -164,15 +163,16 @@ declare class PayByStableCoinComponent implements OnInit {
|
|
|
164
163
|
network: FormControl<string | null>;
|
|
165
164
|
}>;
|
|
166
165
|
getError(controlName: string, label?: string): string | null;
|
|
166
|
+
get amountPlusNetworkFee(): number;
|
|
167
167
|
generatePaymentLinkHandler(): Promise<void | string>;
|
|
168
|
-
generateAddress():
|
|
168
|
+
generateAddress(): void;
|
|
169
169
|
payHandler(): Promise<void>;
|
|
170
170
|
getStableCoins(): Promise<void>;
|
|
171
171
|
getStableCoinNetworks(): Promise<void>;
|
|
172
172
|
confirmPaymentHandler(): Promise<void>;
|
|
173
173
|
ngOnInit(): Promise<void>;
|
|
174
174
|
static ɵfac: i0.ɵɵFactoryDeclaration<PayByStableCoinComponent, never>;
|
|
175
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PayByStableCoinComponent, "pay-by-stable-coin", never, { "secretKey": { "alias": "secretKey"; "required": false; }; "environment": { "alias": "environment"; "required": false; }; "paymentObject": { "alias": "paymentObject"; "required": false; }; }, { "paymentAuthorized": "paymentAuthorized";
|
|
175
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PayByStableCoinComponent, "pay-by-stable-coin", never, { "secretKey": { "alias": "secretKey"; "required": false; }; "environment": { "alias": "environment"; "required": false; }; "paymentObject": { "alias": "paymentObject"; "required": false; }; }, { "paymentAuthorized": "paymentAuthorized"; }, never, never, true, never>;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
interface IIframeStyle {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { EventEmitter, Output, Input, ChangeDetectionStrategy, Component, ViewChild } from '@angular/core';
|
|
3
3
|
import * as i1 from '@miden-npm/angular';
|
|
4
|
-
import { getValidationErrorMessage, cardType, checkObjectTruthy, ButtonComponent, InputComponent, SelectComponent, formatAmount, LabelInfoComponent, CopyComponent,
|
|
4
|
+
import { getValidationErrorMessage, cardType, checkObjectTruthy, getQueryParams, ButtonComponent, InputComponent, SelectComponent, formatAmount, LabelInfoComponent, CopyComponent, CurrencyAmountComponent, IconArrowSwapComponent, RadioGroupComponent, ImageComponent, SuccessComponent, CardComponent, IconLoaderComponent, InputErrorComponent } from '@miden-npm/angular';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import { tap, finalize } from 'rxjs';
|
|
@@ -127,7 +127,8 @@ class PayByCardComponent {
|
|
|
127
127
|
.pipe(tap((res) => {
|
|
128
128
|
if (res?.isSuccessful) {
|
|
129
129
|
this.message = 'Payment link created successfully';
|
|
130
|
-
|
|
130
|
+
const queryParams = getQueryParams(res.launchUrl ?? '');
|
|
131
|
+
this.transactionReference = queryParams['paymentReference'];
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
134
|
this.message = 'Failed to create payment link';
|
|
@@ -255,7 +256,11 @@ class PayByCardComponent {
|
|
|
255
256
|
// Emit the transaction reference to parent component
|
|
256
257
|
if (processedResponse.transactionReference &&
|
|
257
258
|
processedResponse.transactionReference.trim() !== '') {
|
|
258
|
-
this.paymentAuthorized.emit(
|
|
259
|
+
this.paymentAuthorized.emit({
|
|
260
|
+
paymentId: processedResponse.transactionReference,
|
|
261
|
+
paymentDate: response.data.updatedAt,
|
|
262
|
+
paymentStatus: 'Authorized',
|
|
263
|
+
});
|
|
259
264
|
}
|
|
260
265
|
this.message = 'Card payment authorized successfully';
|
|
261
266
|
// Handle legacy 3DS logic for backward compatibility
|
|
@@ -280,6 +285,11 @@ class PayByCardComponent {
|
|
|
280
285
|
else {
|
|
281
286
|
this.isMakingPayment = false;
|
|
282
287
|
this.message = processedResponse.responseMessage || 'Payment failed';
|
|
288
|
+
this.paymentAuthorized.emit({
|
|
289
|
+
paymentId: processedResponse.transactionReference,
|
|
290
|
+
paymentDate: response.data.updatedAt,
|
|
291
|
+
paymentStatus: 'Payment failed',
|
|
292
|
+
});
|
|
283
293
|
}
|
|
284
294
|
},
|
|
285
295
|
error: (err) => {
|
|
@@ -344,7 +354,6 @@ class PayByTransferComponent {
|
|
|
344
354
|
redirectUrl: '',
|
|
345
355
|
};
|
|
346
356
|
paymentAuthorized = new EventEmitter();
|
|
347
|
-
paymentUsed = new EventEmitter();
|
|
348
357
|
message = '';
|
|
349
358
|
generatingLink = false;
|
|
350
359
|
isMakingPayment = false;
|
|
@@ -376,14 +385,16 @@ class PayByTransferComponent {
|
|
|
376
385
|
return formatAmount(this.paymentObject.amount, this.paymentObject.currency);
|
|
377
386
|
}
|
|
378
387
|
startTimer() {
|
|
388
|
+
if (this.intervalId) {
|
|
389
|
+
clearInterval(this.intervalId);
|
|
390
|
+
this.intervalId = null;
|
|
391
|
+
}
|
|
379
392
|
this.updateDisplay();
|
|
380
393
|
this.intervalId = setInterval(() => {
|
|
381
394
|
this.remainingSeconds--;
|
|
382
395
|
if (this.remainingSeconds < 0) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.intervalId = null;
|
|
386
|
-
}
|
|
396
|
+
clearInterval(this.intervalId);
|
|
397
|
+
this.intervalId = null;
|
|
387
398
|
this.countDownTime = '00:00';
|
|
388
399
|
this.cdr.markForCheck();
|
|
389
400
|
return;
|
|
@@ -405,7 +416,8 @@ class PayByTransferComponent {
|
|
|
405
416
|
.pipe(tap((res) => {
|
|
406
417
|
if (res?.isSuccessful) {
|
|
407
418
|
this.message = 'Payment link created successfully';
|
|
408
|
-
|
|
419
|
+
const queryParams = getQueryParams(res.launchUrl ?? '');
|
|
420
|
+
this.transactionReference = queryParams['paymentReference'];
|
|
409
421
|
}
|
|
410
422
|
else {
|
|
411
423
|
this.message = 'Failed to create payment link';
|
|
@@ -464,25 +476,42 @@ class PayByTransferComponent {
|
|
|
464
476
|
// Only set to pending if payment hasn't been confirmed locally or made locally
|
|
465
477
|
if (!this.isPaymentConfirmed && !this.paymentMade) {
|
|
466
478
|
this.paymentReferenceStatus = 'pending';
|
|
479
|
+
this.paymentAuthorized.emit({
|
|
480
|
+
paymentId: this.transactionReference,
|
|
481
|
+
paymentDate: response.data.updatedAt,
|
|
482
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
483
|
+
});
|
|
467
484
|
}
|
|
468
485
|
else {
|
|
469
|
-
this.paymentAuthorized.emit(this.transactionReference);
|
|
470
486
|
this.paymentReferenceStatus = 'confirmed';
|
|
487
|
+
this.paymentAuthorized.emit({
|
|
488
|
+
paymentId: this.transactionReference,
|
|
489
|
+
paymentDate: response.data.updatedAt,
|
|
490
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
491
|
+
});
|
|
471
492
|
}
|
|
472
493
|
}
|
|
473
494
|
else if (response.data?.finalTransactionStatus === 'Success' ||
|
|
474
495
|
response.data?.paymentStatus === 'Received' ||
|
|
475
496
|
response.data?.paymentStatus === 'Payment Received') {
|
|
476
|
-
this.paymentAuthorized.emit(
|
|
497
|
+
this.paymentAuthorized.emit({
|
|
498
|
+
paymentId: this.transactionReference,
|
|
499
|
+
paymentDate: response.data.updatedAt,
|
|
500
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
501
|
+
});
|
|
477
502
|
this.message = 'Transaction confirmed !!';
|
|
478
503
|
this.paymentReferenceStatus = 'confirmed';
|
|
479
504
|
this.isPaymentConfirmed = true;
|
|
480
505
|
}
|
|
481
506
|
}
|
|
482
507
|
else if (!response?.isSuccessful && response?.responseCode === '119') {
|
|
483
|
-
this.paymentUsed.emit(this.transactionReference);
|
|
484
508
|
this.paymentReferenceStatus = 'used';
|
|
485
509
|
this.message = response.responseMessage;
|
|
510
|
+
this.paymentAuthorized.emit({
|
|
511
|
+
paymentId: this.transactionReference,
|
|
512
|
+
paymentDate: null,
|
|
513
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
514
|
+
});
|
|
486
515
|
}
|
|
487
516
|
this.isFetchingPaymentDetails = false;
|
|
488
517
|
},
|
|
@@ -493,8 +522,9 @@ class PayByTransferComponent {
|
|
|
493
522
|
},
|
|
494
523
|
});
|
|
495
524
|
}
|
|
496
|
-
ngOnInit() {
|
|
525
|
+
async ngOnInit() {
|
|
497
526
|
this.startTimer();
|
|
527
|
+
await this.generatePaymentLinkHandler();
|
|
498
528
|
}
|
|
499
529
|
ngOnDestroy() {
|
|
500
530
|
if (this.intervalId) {
|
|
@@ -503,11 +533,17 @@ class PayByTransferComponent {
|
|
|
503
533
|
}
|
|
504
534
|
}
|
|
505
535
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PayByTransferComponent, deps: [{ token: i1.CheckoutService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
506
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: PayByTransferComponent, isStandalone: true, selector: "pay-by-transfer", inputs: { secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { paymentAuthorized: "paymentAuthorized"
|
|
536
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: PayByTransferComponent, isStandalone: true, selector: "pay-by-transfer", inputs: { secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { paymentAuthorized: "paymentAuthorized" }, ngImport: i0, template: "<div class=\"flex flex-col gap-10\">\n @if (!paymentAccountDetails) {\n <form [formGroup]=\"transferForm\">\n <div class=\"flex flex-col gap-10\">\n <base-input\n formControlName=\"customerName\"\n label=\"Card Name\"\n [required]=\"true\"\n [validationError]=\"getError('customerName', 'Customer Name') || ''\"\n ></base-input>\n\n <base-button\n [label]=\"'Pay ' + formatAmountHandler\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isMakingPayment\"\n (onClick)=\"payHandler()\"\n ></base-button>\n </div>\n </form>\n }\n\n @if (paymentAccountDetails) {\n <div class=\"flex flex-col gap-10\">\n <div class=\"bg-[#EFF7FF] p-4 rounded-lg flex flex-col gap-6\">\n <base-label-info\n label=\"Bank Name\"\n [value]=\"paymentAccountDetails.bank + ' - ' + paymentAccountDetails.accountName\"\n ></base-label-info>\n <div class=\"flex items-center justify-between\">\n <base-label-info\n label=\"Account Number\"\n [value]=\"paymentAccountDetails.accountNumber\"\n ></base-label-info>\n <base-copy color=\"#9DBFDE\" [copyText]=\"paymentAccountDetails.accountNumber\"></base-copy>\n </div>\n <div class=\"flex items-center justify-between\">\n <base-label-info label=\"Amount\" [value]=\"formatAmountHandler\"></base-label-info>\n <base-copy color=\"#9DBFDE\" [copyText]=\"formatAmountHandler\"></base-copy>\n </div>\n </div>\n\n <p class=\"w-2/3 mx-auto text-center text-body-2xs font-medium text-sub-copy\">\n This account is for this transaction only and expires in\n <span class=\"text-orange-500\">{{ countDownTime }}</span>\n </p>\n\n <div class=\"flex flex-col gap-4\">\n <base-button\n label=\"I have paid the money\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isFetchingPaymentDetails\"\n (onClick)=\"getReferenceDetails()\"\n ></base-button>\n <p class=\"text-heading-text text-body-2xs font-medium text-center py-2 cursor-pointer\">\n Cancel Payment\n </p>\n </div>\n </div>\n }\n</div>\n", dependencies: [{ kind: "component", type: LabelInfoComponent, selector: "base-label-info", inputs: ["type", "label", "labelCustomClass", "valueImageSrc", "valueImageCustomClass", "valueImagePosition", "hasValueCopy", "value", "valueCustomClass", "alignRight"] }, { kind: "component", type: CopyComponent, selector: "base-copy", inputs: ["copyText", "color"] }, { kind: "component", type: ButtonComponent, selector: "base-button", inputs: ["label", "type", "size", "paddingClassX", "disabled", "loading", "customClass"], outputs: ["onClick"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: InputComponent, selector: "base-input", inputs: ["label", "type", "placeholder", "validationError", "hint", "mask", "rules", "isAmountInput", "required", "disabled", "loading", "showCopyIcon"], outputs: ["onInputChange", "onInputBlur"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
507
537
|
}
|
|
508
538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PayByTransferComponent, decorators: [{
|
|
509
539
|
type: Component,
|
|
510
|
-
args: [{ selector: 'pay-by-transfer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
540
|
+
args: [{ selector: 'pay-by-transfer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
541
|
+
LabelInfoComponent,
|
|
542
|
+
CopyComponent,
|
|
543
|
+
ButtonComponent,
|
|
544
|
+
ReactiveFormsModule,
|
|
545
|
+
InputComponent,
|
|
546
|
+
], template: "<div class=\"flex flex-col gap-10\">\n @if (!paymentAccountDetails) {\n <form [formGroup]=\"transferForm\">\n <div class=\"flex flex-col gap-10\">\n <base-input\n formControlName=\"customerName\"\n label=\"Card Name\"\n [required]=\"true\"\n [validationError]=\"getError('customerName', 'Customer Name') || ''\"\n ></base-input>\n\n <base-button\n [label]=\"'Pay ' + formatAmountHandler\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isMakingPayment\"\n (onClick)=\"payHandler()\"\n ></base-button>\n </div>\n </form>\n }\n\n @if (paymentAccountDetails) {\n <div class=\"flex flex-col gap-10\">\n <div class=\"bg-[#EFF7FF] p-4 rounded-lg flex flex-col gap-6\">\n <base-label-info\n label=\"Bank Name\"\n [value]=\"paymentAccountDetails.bank + ' - ' + paymentAccountDetails.accountName\"\n ></base-label-info>\n <div class=\"flex items-center justify-between\">\n <base-label-info\n label=\"Account Number\"\n [value]=\"paymentAccountDetails.accountNumber\"\n ></base-label-info>\n <base-copy color=\"#9DBFDE\" [copyText]=\"paymentAccountDetails.accountNumber\"></base-copy>\n </div>\n <div class=\"flex items-center justify-between\">\n <base-label-info label=\"Amount\" [value]=\"formatAmountHandler\"></base-label-info>\n <base-copy color=\"#9DBFDE\" [copyText]=\"formatAmountHandler\"></base-copy>\n </div>\n </div>\n\n <p class=\"w-2/3 mx-auto text-center text-body-2xs font-medium text-sub-copy\">\n This account is for this transaction only and expires in\n <span class=\"text-orange-500\">{{ countDownTime }}</span>\n </p>\n\n <div class=\"flex flex-col gap-4\">\n <base-button\n label=\"I have paid the money\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isFetchingPaymentDetails\"\n (onClick)=\"getReferenceDetails()\"\n ></base-button>\n <p class=\"text-heading-text text-body-2xs font-medium text-center py-2 cursor-pointer\">\n Cancel Payment\n </p>\n </div>\n </div>\n }\n</div>\n" }]
|
|
511
547
|
}], ctorParameters: () => [{ type: i1.CheckoutService }, { type: i0.ChangeDetectorRef }], propDecorators: { secretKey: [{
|
|
512
548
|
type: Input
|
|
513
549
|
}], environment: [{
|
|
@@ -516,8 +552,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
516
552
|
type: Input
|
|
517
553
|
}], paymentAuthorized: [{
|
|
518
554
|
type: Output
|
|
519
|
-
}], paymentUsed: [{
|
|
520
|
-
type: Output
|
|
521
555
|
}] } });
|
|
522
556
|
|
|
523
557
|
class PayByStableCoinComponent {
|
|
@@ -541,7 +575,6 @@ class PayByStableCoinComponent {
|
|
|
541
575
|
redirectUrl: '',
|
|
542
576
|
};
|
|
543
577
|
paymentAuthorized = new EventEmitter();
|
|
544
|
-
paymentUsed = new EventEmitter();
|
|
545
578
|
message = '';
|
|
546
579
|
transactionReference = '';
|
|
547
580
|
paymentReferenceStatus = '';
|
|
@@ -567,6 +600,11 @@ class PayByStableCoinComponent {
|
|
|
567
600
|
const control = this.stableCoinForm.get(controlName);
|
|
568
601
|
return getValidationErrorMessage(control, label);
|
|
569
602
|
}
|
|
603
|
+
get amountPlusNetworkFee() {
|
|
604
|
+
return this.addressDetails
|
|
605
|
+
? Number(this.addressDetails.transactionAmount) + this.addressDetails.networkFee
|
|
606
|
+
: 0;
|
|
607
|
+
}
|
|
570
608
|
async generatePaymentLinkHandler() {
|
|
571
609
|
if (!this.secretKey) {
|
|
572
610
|
return (this.message = 'Secret key is required.');
|
|
@@ -581,7 +619,8 @@ class PayByStableCoinComponent {
|
|
|
581
619
|
.pipe(tap((res) => {
|
|
582
620
|
if (res?.isSuccessful) {
|
|
583
621
|
this.message = 'Payment link created successfully';
|
|
584
|
-
|
|
622
|
+
const queryParams = getQueryParams(res.launchUrl ?? '');
|
|
623
|
+
this.transactionReference = queryParams['paymentReference'];
|
|
585
624
|
}
|
|
586
625
|
else {
|
|
587
626
|
this.message = 'Failed to create payment link';
|
|
@@ -592,25 +631,27 @@ class PayByStableCoinComponent {
|
|
|
592
631
|
}))
|
|
593
632
|
.subscribe();
|
|
594
633
|
}
|
|
595
|
-
|
|
596
|
-
if (this.generateAddressPayload)
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
634
|
+
generateAddress() {
|
|
635
|
+
if (!this.generateAddressPayload)
|
|
636
|
+
return;
|
|
637
|
+
this.generatingAddress = true;
|
|
638
|
+
this.cdr.markForCheck();
|
|
639
|
+
this.checkout
|
|
640
|
+
.generateStableCoinAddress(this.environment, this.generateAddressPayload)
|
|
641
|
+
.pipe(tap((response) => {
|
|
642
|
+
if (response?.isSuccessful) {
|
|
643
|
+
this.addressDetails = response.data;
|
|
644
|
+
this.setFormIndex(1);
|
|
645
|
+
}
|
|
646
|
+
}), finalize(() => {
|
|
647
|
+
this.generatingAddress = false;
|
|
648
|
+
this.cdr.markForCheck();
|
|
649
|
+
}))
|
|
650
|
+
.subscribe({
|
|
651
|
+
error: (err) => {
|
|
652
|
+
this.message = err.error.responseMessage || err.error.message;
|
|
653
|
+
},
|
|
654
|
+
});
|
|
614
655
|
}
|
|
615
656
|
async payHandler() {
|
|
616
657
|
if (this.stableCoinForm && this.stableCoinForm.valid) {
|
|
@@ -678,18 +719,31 @@ class PayByStableCoinComponent {
|
|
|
678
719
|
response.data?.paymentStatus === null) {
|
|
679
720
|
this.message = 'Transaction not confirmed !!';
|
|
680
721
|
this.paymentReferenceStatus = 'pending';
|
|
722
|
+
this.paymentAuthorized.emit({
|
|
723
|
+
paymentId: this.transactionReference,
|
|
724
|
+
paymentDate: response.data.updatedAt,
|
|
725
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
726
|
+
});
|
|
681
727
|
}
|
|
682
728
|
else if (response.data?.finalTransactionStatus === 'Success' ||
|
|
683
729
|
response.data?.paymentStatus === 'Payment Received') {
|
|
684
730
|
this.message = 'Transaction confirmed !!';
|
|
685
731
|
this.paymentReferenceStatus = 'confirmed';
|
|
686
|
-
this.paymentAuthorized.emit(
|
|
732
|
+
this.paymentAuthorized.emit({
|
|
733
|
+
paymentId: this.transactionReference,
|
|
734
|
+
paymentDate: response.data.updatedAt,
|
|
735
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
736
|
+
});
|
|
687
737
|
}
|
|
688
738
|
}
|
|
689
739
|
else if (!response?.isSuccessful && response?.responseCode === '119') {
|
|
690
740
|
this.paymentReferenceStatus = 'used';
|
|
691
741
|
this.message = response.responseMessage;
|
|
692
|
-
this.
|
|
742
|
+
this.paymentAuthorized.emit({
|
|
743
|
+
paymentId: this.transactionReference,
|
|
744
|
+
paymentDate: null,
|
|
745
|
+
paymentStatus: this.paymentReferenceStatus,
|
|
746
|
+
});
|
|
693
747
|
}
|
|
694
748
|
this.isConfirmingPayment = false;
|
|
695
749
|
},
|
|
@@ -705,19 +759,21 @@ class PayByStableCoinComponent {
|
|
|
705
759
|
await this.getStableCoins();
|
|
706
760
|
}
|
|
707
761
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PayByStableCoinComponent, deps: [{ token: i1.ResourceService }, { token: i1.CheckoutService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
708
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: PayByStableCoinComponent, isStandalone: true, selector: "pay-by-stable-coin", inputs: { secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { paymentAuthorized: "paymentAuthorized"
|
|
762
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: PayByStableCoinComponent, isStandalone: true, selector: "pay-by-stable-coin", inputs: { secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { paymentAuthorized: "paymentAuthorized" }, ngImport: i0, template: "<div class=\"flex flex-col gap-6\">\n @if (formIndex === 0) {\n <form [formGroup]=\"stableCoinForm\" class=\"grid grid-cols-1 gap-6\">\n <div class=\"grid grid-cols-1 gap-6\">\n <base-select\n formControlName=\"stableCoin\"\n label=\"Select Crypto\"\n [required]=\"true\"\n [options]=\"stableCoins\"\n [validationError]=\"getError('stableCoin', 'Select Crypto') ?? ''\"\n [loading]=\"loadingStableCoins\"\n (onSelectChange)=\"getStableCoinNetworks()\"\n ></base-select>\n <base-select\n formControlName=\"network\"\n label=\"Select Network\"\n [required]=\"true\"\n [options]=\"networkList\"\n [validationError]=\"getError('network', 'Network') ?? ''\"\n [loading]=\"loadingStableCoinNetworks\"\n ></base-select>\n </div>\n\n <base-button\n label=\"Pay\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"generatingAddress\"\n (onClick)=\"payHandler()\"\n ></base-button>\n </form>\n }\n\n @if (formIndex === 1) {\n <div class=\"flex flex-col gap-6\">\n <div class=\"mx-auto\">\n <!-- <base-image\n src=\"../../../assets/images/stable-coin-qr-code.png\"\n alt=\"QR Code\"\n [width]=\"122\"\n [height]=\"122\"\n class=\"mb-1\"\n ></base-image> -->\n <p class=\"mb-0 text-body-4xs text-light-copy font-normal text-center\">USDC</p>\n </div>\n\n <div class=\"flex flex-col gap-6 border-c border-grey-100 p-4 rounded-2xl bg-light-white-50\">\n <div class=\"border-b border-grey-border pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Network</p>\n <div class=\"flex justify-between\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"mb-0 text-body-2xs font-medium text-sub-copy\">\n {{ addressDetails?.chain }}\n </p>\n <div class=\"flex items-center gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">*Est. arrival = 3 mins</p>\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">|</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"addressDetails?.networkFee ?? 0\"\n textClass=\"mb-0 text-body-3xs text-light-copy font-normal\"\n iconColorClass=\"#557591\"\n iconWidth=\"12\"\n iconHeight=\"12\"\n ></base-currency-amount>\n </div>\n </div>\n <icon-arrow-swap></icon-arrow-swap>\n </div>\n </div>\n\n <div class=\"pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Deposit Address ></p>\n <div class=\"flex justify-between\">\n <p class=\"mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words\">\n {{ addressDetails?.walletAddress }}\n </p>\n <base-copy [copyText]=\"addressDetails?.walletAddress ?? ''\"></base-copy>\n </div>\n </div>\n\n <!-- <div class=\"pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Memo ></p>\n <div class=\"flex justify-between\">\n <p\n class=\"mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words\"\n >\n 0j8938ysheeee8333c162883a4d4f5g6t111nhk8uey37777yt6\n </p>\n <app-copy\n [isCopyIcon]=\"true\"\n [copyText]=\"'0j8938ysheeee8333c162883a4d4f5g6t111nhk8uey37777yt6'\"\n ></app-copy>\n </div>\n </div> -->\n </div>\n\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between border-b border-grey-border py-3\">\n <p class=\"mb-0 text-body-2xs font-medium text-primary-black\">Network fee</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"addressDetails?.networkFee ?? 0\"\n textClass=\"mb-0 text-body-2xs font-extrabold text-primary-black\"\n iconColorClass=\"#231F20\"\n ></base-currency-amount>\n </div>\n\n <div class=\"flex items-center justify-between py-4\">\n <p class=\"mb-0 text-body-lg font-semibold text-primary-black\">Pay</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"amountPlusNetworkFee\"\n textClass=\"mb-0 text-body-lg font-extrabold text-primary-black\"\n iconColorClass=\"#231F20\"\n iconWidth=\"20\"\n iconHeight=\"20\"\n ></base-currency-amount>\n </div>\n </div>\n\n <div class=\"flex flex-col gap-6\">\n <base-button\n label=\"Confirm Payment\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isConfirmingPayment\"\n (onClick)=\"confirmPaymentHandler()\"\n ></base-button>\n </div>\n </div>\n }\n</div>\n", dependencies: [{ kind: "component", type: SelectComponent, selector: "base-select", inputs: ["options", "placeholder", "hasSearch", "disabled", "loading", "validationError", "label", "hint", "required", "itemImageType"], outputs: ["onSelectChange"] }, { kind: "component", type: ButtonComponent, selector: "base-button", inputs: ["label", "type", "size", "paddingClassX", "disabled", "loading", "customClass"], outputs: ["onClick"] }, { kind: "component", type:
|
|
763
|
+
// ImageComponent,
|
|
764
|
+
CurrencyAmountComponent, selector: "base-currency-amount", inputs: ["currency", "amount", "textClass", "iconColorClass", "iconWidth", "iconHeight"] }, { kind: "component", type: CopyComponent, selector: "base-copy", inputs: ["copyText", "color"] }, { kind: "component", type: IconArrowSwapComponent, selector: "icon-arrow-swap", inputs: ["color", "width", "height"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
709
765
|
}
|
|
710
766
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PayByStableCoinComponent, decorators: [{
|
|
711
767
|
type: Component,
|
|
712
768
|
args: [{ selector: 'pay-by-stable-coin', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
713
769
|
SelectComponent,
|
|
714
770
|
ButtonComponent,
|
|
715
|
-
ImageComponent,
|
|
771
|
+
// ImageComponent,
|
|
716
772
|
CurrencyAmountComponent,
|
|
717
773
|
CopyComponent,
|
|
718
774
|
IconArrowSwapComponent,
|
|
719
775
|
ReactiveFormsModule,
|
|
720
|
-
], template: "<div class=\"flex flex-col gap-6\">\n @if (formIndex === 0) {\n <form [formGroup]=\"stableCoinForm\">\n <div class=\"grid grid-cols-1 gap-6\">\n <base-select\n formControlName=\"stableCoin\"\n label=\"Select Crypto\"\n [required]=\"true\"\n [options]=\"stableCoins\"\n [validationError]=\"getError('stableCoin', 'Select Crypto') ?? ''\"\n [loading]=\"loadingStableCoins\"\n (onSelectChange)=\"getStableCoinNetworks()\"\n ></base-select>\n <base-select\n formControlName=\"network\"\n label=\"Select Network\"\n [required]=\"true\"\n [options]=\"networkList\"\n [validationError]=\"getError('network', 'Network') ?? ''\"\n [loading]=\"loadingStableCoinNetworks\"\n ></base-select>\n </div>\n\n <base-button\n label=\"Pay\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"generatingAddress\"\n (onClick)=\"payHandler()\"\n ></base-button>\n </form>\n }\n\n @if (formIndex === 1) {\n <div class=\"flex flex-col gap-6\">\n <div class=\"mx-auto\">\n <base-image\n src=\"../../../assets/images/stable-coin-qr-code.png\"\n alt=\"QR Code\"\n [width]=\"122\"\n [height]=\"122\"\n class=\"mb-1\"\n ></base-image
|
|
776
|
+
], template: "<div class=\"flex flex-col gap-6\">\n @if (formIndex === 0) {\n <form [formGroup]=\"stableCoinForm\" class=\"grid grid-cols-1 gap-6\">\n <div class=\"grid grid-cols-1 gap-6\">\n <base-select\n formControlName=\"stableCoin\"\n label=\"Select Crypto\"\n [required]=\"true\"\n [options]=\"stableCoins\"\n [validationError]=\"getError('stableCoin', 'Select Crypto') ?? ''\"\n [loading]=\"loadingStableCoins\"\n (onSelectChange)=\"getStableCoinNetworks()\"\n ></base-select>\n <base-select\n formControlName=\"network\"\n label=\"Select Network\"\n [required]=\"true\"\n [options]=\"networkList\"\n [validationError]=\"getError('network', 'Network') ?? ''\"\n [loading]=\"loadingStableCoinNetworks\"\n ></base-select>\n </div>\n\n <base-button\n label=\"Pay\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"generatingAddress\"\n (onClick)=\"payHandler()\"\n ></base-button>\n </form>\n }\n\n @if (formIndex === 1) {\n <div class=\"flex flex-col gap-6\">\n <div class=\"mx-auto\">\n <!-- <base-image\n src=\"../../../assets/images/stable-coin-qr-code.png\"\n alt=\"QR Code\"\n [width]=\"122\"\n [height]=\"122\"\n class=\"mb-1\"\n ></base-image> -->\n <p class=\"mb-0 text-body-4xs text-light-copy font-normal text-center\">USDC</p>\n </div>\n\n <div class=\"flex flex-col gap-6 border-c border-grey-100 p-4 rounded-2xl bg-light-white-50\">\n <div class=\"border-b border-grey-border pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Network</p>\n <div class=\"flex justify-between\">\n <div class=\"flex flex-col gap-1\">\n <p class=\"mb-0 text-body-2xs font-medium text-sub-copy\">\n {{ addressDetails?.chain }}\n </p>\n <div class=\"flex items-center gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">*Est. arrival = 3 mins</p>\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">|</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"addressDetails?.networkFee ?? 0\"\n textClass=\"mb-0 text-body-3xs text-light-copy font-normal\"\n iconColorClass=\"#557591\"\n iconWidth=\"12\"\n iconHeight=\"12\"\n ></base-currency-amount>\n </div>\n </div>\n <icon-arrow-swap></icon-arrow-swap>\n </div>\n </div>\n\n <div class=\"pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Deposit Address ></p>\n <div class=\"flex justify-between\">\n <p class=\"mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words\">\n {{ addressDetails?.walletAddress }}\n </p>\n <base-copy [copyText]=\"addressDetails?.walletAddress ?? ''\"></base-copy>\n </div>\n </div>\n\n <!-- <div class=\"pb-4 flex flex-col gap-2\">\n <p class=\"mb-0 text-body-3xs text-light-copy font-normal\">Memo ></p>\n <div class=\"flex justify-between\">\n <p\n class=\"mb-0 text-body-2xs font-medium text-sub-copy w-2/3 break-words\"\n >\n 0j8938ysheeee8333c162883a4d4f5g6t111nhk8uey37777yt6\n </p>\n <app-copy\n [isCopyIcon]=\"true\"\n [copyText]=\"'0j8938ysheeee8333c162883a4d4f5g6t111nhk8uey37777yt6'\"\n ></app-copy>\n </div>\n </div> -->\n </div>\n\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between border-b border-grey-border py-3\">\n <p class=\"mb-0 text-body-2xs font-medium text-primary-black\">Network fee</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"addressDetails?.networkFee ?? 0\"\n textClass=\"mb-0 text-body-2xs font-extrabold text-primary-black\"\n iconColorClass=\"#231F20\"\n ></base-currency-amount>\n </div>\n\n <div class=\"flex items-center justify-between py-4\">\n <p class=\"mb-0 text-body-lg font-semibold text-primary-black\">Pay</p>\n <base-currency-amount\n [currency]=\"generateAddressPayload?.currency ?? ''\"\n [amount]=\"amountPlusNetworkFee\"\n textClass=\"mb-0 text-body-lg font-extrabold text-primary-black\"\n iconColorClass=\"#231F20\"\n iconWidth=\"20\"\n iconHeight=\"20\"\n ></base-currency-amount>\n </div>\n </div>\n\n <div class=\"flex flex-col gap-6\">\n <base-button\n label=\"Confirm Payment\"\n type=\"primary\"\n customClass=\"w-full\"\n [loading]=\"isConfirmingPayment\"\n (onClick)=\"confirmPaymentHandler()\"\n ></base-button>\n </div>\n </div>\n }\n</div>\n" }]
|
|
721
777
|
}], ctorParameters: () => [{ type: i1.ResourceService }, { type: i1.CheckoutService }, { type: i0.ChangeDetectorRef }], propDecorators: { secretKey: [{
|
|
722
778
|
type: Input
|
|
723
779
|
}], environment: [{
|
|
@@ -726,8 +782,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
726
782
|
type: Input
|
|
727
783
|
}], paymentAuthorized: [{
|
|
728
784
|
type: Output
|
|
729
|
-
}], paymentUsed: [{
|
|
730
|
-
type: Output
|
|
731
785
|
}] } });
|
|
732
786
|
|
|
733
787
|
class CheckoutCardComponent {
|
|
@@ -746,7 +800,12 @@ class CheckoutCardComponent {
|
|
|
746
800
|
ready = new EventEmitter();
|
|
747
801
|
validityChange = new EventEmitter();
|
|
748
802
|
tokenize = new EventEmitter();
|
|
749
|
-
|
|
803
|
+
successObject = {
|
|
804
|
+
paymentDate: '',
|
|
805
|
+
paymentId: '',
|
|
806
|
+
paymentStatus: '',
|
|
807
|
+
};
|
|
808
|
+
checkoutState = 'PENDING';
|
|
750
809
|
countryOptions = [
|
|
751
810
|
{
|
|
752
811
|
label: 'Nigeria',
|
|
@@ -775,11 +834,20 @@ class CheckoutCardComponent {
|
|
|
775
834
|
paymentTypeHandler(event) {
|
|
776
835
|
this.paymentType = event;
|
|
777
836
|
}
|
|
778
|
-
|
|
779
|
-
this.
|
|
837
|
+
setSuccess(event) {
|
|
838
|
+
this.successObject = { ...event };
|
|
839
|
+
if (this.successObject.paymentStatus === 'pending') {
|
|
840
|
+
this.checkoutState = 'PENDING';
|
|
841
|
+
}
|
|
842
|
+
else if (this.successObject.paymentStatus === 'used') {
|
|
843
|
+
this.checkoutState = 'USED';
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
this.checkoutState = 'SUCCESS';
|
|
847
|
+
}
|
|
780
848
|
}
|
|
781
849
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: CheckoutCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
782
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: CheckoutCardComponent, isStandalone: true, selector: "bzp-checkout-card", inputs: { options: "options", secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { ready: "ready", validityChange: "validityChange", tokenize: "tokenize" }, ngImport: i0, template: "<base-card
|
|
850
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: CheckoutCardComponent, isStandalone: true, selector: "bzp-checkout-card", inputs: { options: "options", secretKey: "secretKey", environment: "environment", paymentObject: "paymentObject" }, outputs: { ready: "ready", validityChange: "validityChange", tokenize: "tokenize" }, ngImport: i0, template: "<base-card>\n <div class=\"grid grid-cols-3\">\n @if (checkoutState === 'PENDING') {\n <div class=\"bg-[#EFF7FF] px-6 py-8 flex flex-col gap-5 col-span-1 rounded-l-xl\">\n <p class=\"text-heading-text text-body-xs font-semibold\">Pay with</p>\n <base-radio-group\n [options]=\"filteredPaymentTypeOptions\"\n (selectedChange)=\"paymentTypeHandler($event)\"\n ></base-radio-group>\n </div>\n }\n\n <div [class]=\"checkoutState === 'SUCCESS' ? 'col-span-3' : 'col-span-2'\">\n @if (checkoutState === 'PENDING') {\n <div class=\"flex items-center justify-between px-12 py-8\">\n @if (options?.imageUrl) {\n <base-image\n [src]=\"options?.imageUrl ?? ''\"\n alt=\"Merchant Logo\"\n [width]=\"52\"\n [height]=\"52\"\n class=\"rounded-lg\"\n ></base-image>\n } @else {\n <div\n class=\"bg-heading-text rounded flex flex-col justify-center\"\n style=\"width: 52px; height: 52px\"\n >\n <p class=\"text-white text-center text-body-2xs font-medium\">Logo</p>\n </div>\n }\n\n <div class=\"flex flex-col gap-1\">\n <p class=\"text-body-2xs font-regular text-sub-copy text-right\">\n {{ paymentObject.merchantName }}\n </p>\n <p class=\"text-body-2xs font-regular text-sub-copy text-right\">\n Pay:\n <span class=\"text-orange-500 font-extrabold\">{{ formatAmountHandler }}</span>\n </p>\n </div>\n </div>\n\n <div class=\"overflow-y-scroll px-10 pb-10 pt-2\">\n @if (paymentType === 'CARD') {\n <pay-by-card\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-card>\n } @else if (paymentType === 'BANK_TRANSFER') {\n <pay-by-transfer\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-transfer>\n } @else {\n <pay-by-stable-coin\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-stable-coin>\n }\n </div>\n } @else if (checkoutState === 'SUCCESS') {\n <base-success\n [amount]=\"paymentObject.amount\"\n [currency]=\"paymentObject.currency\"\n [redirectUrl]=\"paymentObject.redirectUrl\"\n [successObject]=\"successObject\"\n ></base-success>\n }\n </div>\n </div>\n</base-card>\n", dependencies: [{ kind: "component", type: RadioGroupComponent, selector: "base-radio-group", inputs: ["options", "type"], outputs: ["selectedChange"] }, { kind: "component", type: ImageComponent, selector: "base-image", inputs: ["src", "alt", "isFullWidth", "width", "height", "customClass"], outputs: ["onClick"] }, { kind: "component", type: PayByCardComponent, selector: "pay-by-card", inputs: ["secretKey", "environment", "paymentObject"], outputs: ["paymentAuthorized"] }, { kind: "component", type: PayByTransferComponent, selector: "pay-by-transfer", inputs: ["secretKey", "environment", "paymentObject"], outputs: ["paymentAuthorized"] }, { kind: "component", type: PayByStableCoinComponent, selector: "pay-by-stable-coin", inputs: ["secretKey", "environment", "paymentObject"], outputs: ["paymentAuthorized"] }, { kind: "component", type: SuccessComponent, selector: "base-success", inputs: ["successObject", "amount", "currency", "redirectUrl"] }, { kind: "component", type: CardComponent, selector: "base-card", inputs: ["showBackButton"], outputs: ["back"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
783
851
|
}
|
|
784
852
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: CheckoutCardComponent, decorators: [{
|
|
785
853
|
type: Component,
|
|
@@ -791,7 +859,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
791
859
|
PayByStableCoinComponent,
|
|
792
860
|
SuccessComponent,
|
|
793
861
|
CardComponent,
|
|
794
|
-
], template: "<base-card
|
|
862
|
+
], template: "<base-card>\n <div class=\"grid grid-cols-3\">\n @if (checkoutState === 'PENDING') {\n <div class=\"bg-[#EFF7FF] px-6 py-8 flex flex-col gap-5 col-span-1 rounded-l-xl\">\n <p class=\"text-heading-text text-body-xs font-semibold\">Pay with</p>\n <base-radio-group\n [options]=\"filteredPaymentTypeOptions\"\n (selectedChange)=\"paymentTypeHandler($event)\"\n ></base-radio-group>\n </div>\n }\n\n <div [class]=\"checkoutState === 'SUCCESS' ? 'col-span-3' : 'col-span-2'\">\n @if (checkoutState === 'PENDING') {\n <div class=\"flex items-center justify-between px-12 py-8\">\n @if (options?.imageUrl) {\n <base-image\n [src]=\"options?.imageUrl ?? ''\"\n alt=\"Merchant Logo\"\n [width]=\"52\"\n [height]=\"52\"\n class=\"rounded-lg\"\n ></base-image>\n } @else {\n <div\n class=\"bg-heading-text rounded flex flex-col justify-center\"\n style=\"width: 52px; height: 52px\"\n >\n <p class=\"text-white text-center text-body-2xs font-medium\">Logo</p>\n </div>\n }\n\n <div class=\"flex flex-col gap-1\">\n <p class=\"text-body-2xs font-regular text-sub-copy text-right\">\n {{ paymentObject.merchantName }}\n </p>\n <p class=\"text-body-2xs font-regular text-sub-copy text-right\">\n Pay:\n <span class=\"text-orange-500 font-extrabold\">{{ formatAmountHandler }}</span>\n </p>\n </div>\n </div>\n\n <div class=\"overflow-y-scroll px-10 pb-10 pt-2\">\n @if (paymentType === 'CARD') {\n <pay-by-card\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-card>\n } @else if (paymentType === 'BANK_TRANSFER') {\n <pay-by-transfer\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-transfer>\n } @else {\n <pay-by-stable-coin\n [environment]=\"environment\"\n [secretKey]=\"secretKey\"\n [paymentObject]=\"paymentObject\"\n (paymentAuthorized)=\"setSuccess($event)\"\n ></pay-by-stable-coin>\n }\n </div>\n } @else if (checkoutState === 'SUCCESS') {\n <base-success\n [amount]=\"paymentObject.amount\"\n [currency]=\"paymentObject.currency\"\n [redirectUrl]=\"paymentObject.redirectUrl\"\n [successObject]=\"successObject\"\n ></base-success>\n }\n </div>\n </div>\n</base-card>\n" }]
|
|
795
863
|
}], propDecorators: { options: [{
|
|
796
864
|
type: Input
|
|
797
865
|
}], secretKey: [{
|