add credit
This commit is contained in:
@@ -182,6 +182,7 @@
|
||||
<ion-col>
|
||||
<ion-input
|
||||
(ionChange)="veriyEntry()"
|
||||
[(ngModel)]="cardnumber"
|
||||
type="number"
|
||||
placeholder="Card Number"
|
||||
maxlength="16"
|
||||
@@ -193,6 +194,7 @@
|
||||
<ion-col>
|
||||
<ion-select
|
||||
(ionChange)="veriyEntry()"
|
||||
[(ngModel)]="exp_year"
|
||||
placeholder="Expiry Year"
|
||||
size="block"
|
||||
>
|
||||
@@ -207,6 +209,7 @@
|
||||
<ion-col>
|
||||
<ion-select
|
||||
(ionChange)="veriyEntry()"
|
||||
[(ngModel)]="exp_month"
|
||||
placeholder="Expiry Month"
|
||||
size="block"
|
||||
>
|
||||
@@ -220,6 +223,7 @@
|
||||
<ion-col>
|
||||
<ion-input
|
||||
(ionChange)="veriyEntry()"
|
||||
[(ngModel)]="cvc"
|
||||
maxlength="3"
|
||||
type="number"
|
||||
placeholder="CVV"></ion-input>
|
||||
@@ -262,6 +266,9 @@
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <ion-card>-->
|
||||
<!-- <ion-card-header>-->
|
||||
<!-- <ion-card-title class="top-text">Payment</ion-card-title>-->
|
||||
|
||||
@@ -308,6 +308,11 @@ export class AddcreditPage implements OnInit {
|
||||
payment_card: string = "";
|
||||
selPaymentCard: any;
|
||||
|
||||
cardnumber:string='';
|
||||
cvc:string='';
|
||||
exp_month:string='';
|
||||
exp_year:string='';
|
||||
|
||||
feeReturn: any;
|
||||
|
||||
veriyEntry(){
|
||||
@@ -338,23 +343,46 @@ export class AddcreditPage implements OnInit {
|
||||
if (this.total > 100 && this.processor == 3030) {
|
||||
this.isDisabled = false;
|
||||
}
|
||||
if (this.total > 5 && this.processor == 5000 && this.payment_card != "") {
|
||||
|
||||
if ( this.card_level == 200 && this.total > 5 && this.processor == 5000 && this.payment_card != "") {
|
||||
this.selPaymentCard = this.usersCardsData.filter(
|
||||
(item) => item.card_uid == this.payment_card
|
||||
)[0];
|
||||
this.isDisabled = false;
|
||||
}
|
||||
|
||||
if ( this.card_level == 400 && this.total > 5
|
||||
&& this.processor == 5000
|
||||
&& this.cardnumber.toString().length == 16
|
||||
&& this.cvc.toString().length == 3
|
||||
&& this.exp_month.toString() !=''
|
||||
&& this.exp_year.toString() != ''
|
||||
) {
|
||||
this.isDisabled = false;
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
// this.total = this.fee + this.amount;
|
||||
}
|
||||
myWallet() {
|
||||
this.router.navigate(["tabs/tab4"]);
|
||||
}
|
||||
|
||||
|
||||
credit_confirmation: string = "";
|
||||
|
||||
creditResult: any;
|
||||
async processPayment(processor) {
|
||||
if (this.card_level == 200){
|
||||
return this.processPaymentPreviousCard(processor);
|
||||
}
|
||||
if (this.card_level == 400){
|
||||
return this.processPaymentNewCard(processor);
|
||||
}
|
||||
}
|
||||
|
||||
async processPaymentNewCard(processor) {
|
||||
this.credit_confirmation = "";
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: "Processing...",
|
||||
@@ -382,29 +410,95 @@ export class AddcreditPage implements OnInit {
|
||||
|
||||
loading.present();
|
||||
this.wrenchService
|
||||
.payPrevCard(this.payPevCreditData)
|
||||
.subscribe((creditResult) => {
|
||||
loading.dismiss();
|
||||
console.log("creditResult TOTAL RETURN->", this.creditResult);
|
||||
if (
|
||||
creditResult != undefined &&
|
||||
creditResult.internal_return > 0 &&
|
||||
creditResult.confirmation != ""
|
||||
) {
|
||||
this.userWalletService.getWalletData(); // refresh the wallet
|
||||
this.credit_confirmation = creditResult.confirmation;
|
||||
this.showCrediAlert("Credit Processing", "Completed");
|
||||
.payPrevCard(this.payPevCreditData)
|
||||
.subscribe((creditResult) => {
|
||||
loading.dismiss();
|
||||
console.log("creditResult TOTAL RETURN->", this.creditResult);
|
||||
if (
|
||||
creditResult != undefined &&
|
||||
creditResult.internal_return > 0 &&
|
||||
creditResult.confirmation != ""
|
||||
) {
|
||||
this.userWalletService.getWalletData(); // refresh the wallet
|
||||
this.credit_confirmation = creditResult.confirmation;
|
||||
this.showCrediAlert("Credit Processing", "Completed");
|
||||
|
||||
setTimeout(() => {
|
||||
// this.setCloseModal();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
// this.setCloseModal();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
myWallet() {
|
||||
this.router.navigate(["tabs/tab4"]);
|
||||
|
||||
payNewCreditData: {
|
||||
member_id: number;
|
||||
sessionid: string;
|
||||
uid: string;
|
||||
currency: string;
|
||||
amount: number;
|
||||
credit_reference: string;
|
||||
cardnumber: string,
|
||||
cvc: string,
|
||||
exp_month: string,
|
||||
exp_year: string,
|
||||
paymenttype: string,
|
||||
description: string,
|
||||
action: number;
|
||||
};
|
||||
async processPaymentPreviousCard(processor) {
|
||||
this.credit_confirmation = "";
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: "Processing...",
|
||||
duration: 3500,
|
||||
});
|
||||
|
||||
if (this.processor == 3030) {
|
||||
// debugger;
|
||||
loading.present();
|
||||
this.payViaPromise();
|
||||
return 0;
|
||||
}
|
||||
if (this.processor == 5000) {
|
||||
this.isProcessDisabled = true;
|
||||
this.payNewCreditData = {
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
sessionid: this.sessionDataProviderService.session,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
currency: this.currency_code,
|
||||
amount: this.startCreditResult.amount,
|
||||
credit_reference: this.startCreditResult.credit_reference,
|
||||
cardnumber: this.cardnumber,
|
||||
cvc: this.cvc,
|
||||
exp_month: this.exp_month,
|
||||
exp_year: this.exp_year,
|
||||
paymenttype: '100',
|
||||
description:'',
|
||||
action: 11056,
|
||||
};
|
||||
|
||||
loading.present();
|
||||
this.wrenchService
|
||||
.payPrevCard(this.payNewCreditData)
|
||||
.subscribe((creditResult) => {
|
||||
loading.dismiss();
|
||||
console.log("creditResult TOTAL RETURN->", this.creditResult);
|
||||
if (
|
||||
creditResult != undefined &&
|
||||
creditResult.internal_return > 0 &&
|
||||
creditResult.confirmation != ""
|
||||
) {
|
||||
this.userWalletService.getWalletData(); // refresh the wallet
|
||||
this.credit_confirmation = creditResult.confirmation;
|
||||
this.showCrediAlert("Credit Processing", "Completed");
|
||||
|
||||
setTimeout(() => {
|
||||
// this.setCloseModal();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
payPevCreditData: {
|
||||
|
||||
Reference in New Issue
Block a user