diff --git a/src/app/accounts/addcredit/addcredit.page.ts b/src/app/accounts/addcredit/addcredit.page.ts index 23666e7..2eb978b 100644 --- a/src/app/accounts/addcredit/addcredit.page.ts +++ b/src/app/accounts/addcredit/addcredit.page.ts @@ -38,8 +38,8 @@ export class AddcreditPage implements OnInit { flutterwave_key: string = ""; card_count: number = 0; - max_card:number = 0; - card_name:string=''; + max_card: number = 0; + card_name: string = ""; publicKey = "FLWPUBK_TEST-XXXXXXXXX"; @@ -68,8 +68,8 @@ export class AddcreditPage implements OnInit { customizations: this.customizations, }; - monthsData:any; - cardExpirationYears:any; + monthsData: any; + cardExpirationYears: any; constructor( private navctr: NavController, @@ -85,9 +85,13 @@ export class AddcreditPage implements OnInit { this.walletData = this.router.getCurrentNavigation().extras.state; this.monthsData = this.sessionDataProviderService.getMonths(); - this.cardExpirationYears = this.sessionDataProviderService.getCardExpirationYears(); + this.cardExpirationYears = + this.sessionDataProviderService.getCardExpirationYears(); this.max_card = this.sessionDataProviderService.max_card; - this.card_name = this.sessionDataProviderService.firstname + ' ' + this.sessionDataProviderService.lastname; + this.card_name = + this.sessionDataProviderService.firstname + + " " + + this.sessionDataProviderService.lastname; if (this.walletData != undefined) { this.curr_balance = this.walletData.amount * 0.01; @@ -312,15 +316,15 @@ export class AddcreditPage implements OnInit { payment_card: string = ""; selPaymentCard: any; - cardnumber:string=''; - cvc:string=''; - exp_month:string=''; - exp_year:string=''; + cardnumber: string = ""; + cvc: string = ""; + exp_month: string = ""; + exp_year: string = ""; feeReturn: any; - veriyEntry(){ - this.refreshFee(); + veriyEntry() { + this.refreshFee(); } refreshFee() { this.isDisabled = true; @@ -348,19 +352,26 @@ export class AddcreditPage implements OnInit { this.isDisabled = false; } - if ( this.card_level == 200 && 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() != '' + 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; } @@ -374,14 +385,13 @@ export class AddcreditPage implements OnInit { this.router.navigate(["tabs/tab4"]); } - credit_confirmation: string = ""; creditResult: any; async processPayment(processor) { - if (this.card_level == 200){ + if (this.card_level == 200) { return this.processPaymentPreviousCard(processor); } - if (this.card_level == 400){ + if (this.card_level == 400) { return this.processPaymentNewCard(processor); } } @@ -402,6 +412,10 @@ export class AddcreditPage implements OnInit { if (this.processor == 5000) { this.isProcessDisabled = true; + var exp_month_f = this.exp_month; + if (this.exp_month.length == 1) { + exp_month_f = "0" + this.exp_month; + } this.payNewCreditData = { member_id: this.sessionDataProviderService.member_id, @@ -412,37 +426,36 @@ export class AddcreditPage implements OnInit { credit_reference: this.startCreditResult.credit_reference, cardnumber: this.cardnumber, cvc: this.cvc, - exp_month: this.exp_month, + exp_month: exp_month_f, exp_year: this.exp_year, - paymenttype: '100', - description:'', + paymenttype: "100", + description: "", action: 11056, }; loading.present(); this.wrenchService - .payNewCard(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"); + .payNewCard(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); - } - }); + setTimeout(() => { + // this.setCloseModal(); + }, 5000); + } + }); } } - payNewCreditData: { member_id: number; sessionid: string; @@ -450,12 +463,12 @@ export class AddcreditPage implements OnInit { currency: string; amount: number; credit_reference: string; - cardnumber: string, - cvc: string, - exp_month: string, - exp_year: string, - paymenttype: string, - description: string, + cardnumber: string; + cvc: string; + exp_month: string; + exp_year: string; + paymenttype: string; + description: string; action: number; }; async processPaymentPreviousCard(processor) { @@ -486,24 +499,24 @@ 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); + } + }); } } diff --git a/src/app/pages/family/family.page.ts b/src/app/pages/family/family.page.ts index 179eba2..ead1c13 100644 --- a/src/app/pages/family/family.page.ts +++ b/src/app/pages/family/family.page.ts @@ -124,7 +124,9 @@ export class FamilyPage implements OnInit { itemData: item, startPage: "TASK", }; - this.router.navigate(["familymember"], { state: famItem }); + + this.router.navigate(["familyaddtask"], { state: famItem }); + // this.router.navigate(["familymember"], { state: famItem }); } usrData: {