ashinzekene / angular4-paystack

💵 An angular2+ module for paystack transactions
https://ashinzekene.github.io/angular4-paystack/
MIT License
59 stars 37 forks source link

callback function not working #6

Closed ajanieniolasolomon closed 5 years ago

ajanieniolasolomon commented 5 years ago

The angular4paystack callback function is not working.pls help me check it out

ashinzekene commented 5 years ago

Working now?

ajanieniolasolomon commented 5 years ago

Thanks am I too uninstall and install

On Fri, 7 Dec 2018, 14:05 Ashinze Ekene, notifications@github.com wrote:

Working now?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445226946, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-fxgbfoiAAT_3ReUTQPNmjHjlHAPks5u2meYgaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

What version of Angular and angular-paystack are you using?

ajanieniolasolomon commented 5 years ago

2.2.0

On Fri, 7 Dec 2018, 14:09 Ashinze Ekene, notifications@github.com wrote:

What version of Angular and angular-paystack are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445228060, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-YC8LkgoFB0LUNE3vggjVCzSNHpFks5u2miggaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

Angular?

ajanieniolasolomon commented 5 years ago

Angular 7

On Fri, 7 Dec 2018, 14:16 Ashinze Ekene, notifications@github.com wrote:

Angular?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445229715, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-eMpxSFSBhfYO0PBUaqL84tuPVfuks5u2mpBgaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

It should work can you paste what you did

ajanieniolasolomon commented 5 years ago

import { Component, OnInit, Output } from '@angular/core'; import { Router, ActivatedRoute, ParamMap } from '@angular/router'; import { switchMap } from 'rxjs/operators'; import { PaymentService } from '../../share/payment.service'; import { EventEmitter } from 'events';

@Component({ selector: 'app-pay', templateUrl: './pay.component.html', styleUrls: ['./pay.component.css'] }) export class PayComponent implements OnInit {

show= false; email; ref; number; constructor( private route: ActivatedRoute, private router: Router, private service: PaymentService ) {}

ngOnInit() {

this.hero$ = this.route.paramMap.pipe( switchMap((params: ParamMap) => this.service.makepayment2(params.get('id')))

).subscribe((res:any) => { this.show = true; const {email, _id, mobile} = res.fulfillmentText; this.email = email; this.ref = _id; this.number = mobile;

}, err => console.log(err));

} paymentDone(event) { console.log('done'); console.log(event); await this.service.update(this.ref, this.number).subscribe(res => { console.log("res"); }); } paymentCancel() { console.log("close"); } } <angular4-paystack-embed *ngIf="show" key= "pk_test_33c2437bd12c2e1c5358c7701791c02" email="{{email}}" amount="5000000" ref="{{ref}}" class="'btn btn-primary'" (close)="paymentCancel($event)" ( callback)="paymentDone($event)"> Loading... Loading.

On Fri, Dec 7, 2018 at 2:19 PM Ashinze Ekene notifications@github.com wrote:

It should work can you paste what you did

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445230489, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-SRGHWeExK2ih4qoyNP7M9MSWy4Oks5u2mr4gaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

Try testing with the angular4-component, or listening for the paymentInit event, like:

<angular4-paystack-embed *ngIf="show" key=
  "pk_test_33c2437bd12c2e1c5358c7701791c02" email="{{email}}" amount="5000000"
  ref="{{ref}}" class="'btn btn-primary'"
  (paymentInit)="listenForInit()" <-----
  (close)="paymentCancel($event)" 
  (callback)="paymentDone($event)">
  <span class="spinner spinner-inline">
    Loading...
  </span>
  <span>Loading.</span>
</angular4-paystack-embed>
ajanieniolasolomon commented 5 years ago

The paymentInit is work but the callback still not working is there a way to track the success of the transaction with the paymentInit option

On Fri, 7 Dec 2018, 14:36 Ashinze Ekene, notifications@github.com wrote:

Try testing with the angular4-component, or listening for the paymentInit event, like:

<angular4-paystack-embed *ngIf="show" key= "pk_test_33c2437bd12c2e1c5358c7701791c02" email="{{email}}" amount="5000000" ref="{{ref}}" class="'btn btn-primary'" (paymentInit)="listenForInit()" (close)="paymentCancel($event)" (callback)="paymentDone($event)"> Loading... Loading.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445234676, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-YH-ZT7GeQnp1sQGzFRCHgX_bAxOks5u2m7igaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

No. I'd check and confirm.

ajanieniolasolomon commented 5 years ago

Thanks for the help

On Fri, 7 Dec 2018, 16:30 Ashinze Ekene, notifications@github.com wrote:

No. I'd check and confirm.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445267854, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-cefF1UUKBRlOrPetJYQYhJojerOks5u2ol8gaJpZM4Y9ZFd .

ashinzekene commented 5 years ago

I have checked it and verified it works. Please be sure you're not doing anything wrong

ajanieniolasolomon commented 5 years ago

Is it the callback function

On Sun, 9 Dec 2018, 01:44 Ashinze Ekene, notifications@github.com wrote:

I have checked it and verified it works. Please be sure you're not doing anything wrong

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashinzekene/angular4-paystack/issues/6#issuecomment-445501089, or mute the thread https://github.com/notifications/unsubscribe-auth/AVlX-QZ4ykBxiZ3UNId5JZdeDDx2eY_dks5u3FzRgaJpZM4Y9ZFd .

ajanieniolasolomon commented 5 years ago

I have found problem it is the if statement

ashinzekene commented 5 years ago

Okay