File

src/app/components/payments/payment-create/payment-create.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(paymentService: PaymentService, templateService: TemplateService, app: AppStateStore, router: Router)
Parameters :
Name Type Optional
paymentService PaymentService No
templateService TemplateService No
app AppStateStore No
router Router No

Methods

ngOnInit
ngOnInit()
Returns : void
submitPayment
submitPayment()
Returns : void

Properties

model
Default value : new PaymentCreateVm()
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { PaymentService, TemplateService } from '../../../providers';
import { AppStateStore } from '../../../providers/stores/app-state.store';
import { PaymentCreateVm } from './payment-create.vm';

@Component({
  selector: 'app-payment-create',
  templateUrl: './payment-create.component.html',
  styleUrls: ['./payment-create.component.css']
})
export class PaymentCreateComponent implements OnInit {
  model = new PaymentCreateVm();
  constructor(
    private paymentService: PaymentService,
    private templateService: TemplateService,
    private app: AppStateStore,
    private router: Router
  ) {}

  ngOnInit() {
    if (!this.app.amount) {
      this.router.navigate(['/start']);
    }
    return this.submitPayment();
  }

  submitPayment() {
    console.log('submit payment started');
    this.paymentService
      .createPayment(
        this.app.amount,
        this.app.memo,
        this.app.debitTemplate,
        this.app.creditTemplate
      )
      .subscribe(payment => {
        if (!payment) {
          return console.log('Failed to create payment!');
        }
        this.templateService
          .loadTemplates()
          .subscribe(() => console.log('Templates refreshed'));
        this.app.hasPassedMfa = false;
        this.app.payment = payment;
        this.router.navigate(['/success-screen']);
      });
  }
}
<div class="scroller">
  <app-loader [header]="model.loaderHeader" [message]="model.message"></app-loader>
</div>

./payment-create.component.css

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""