0.0.2 • Published 3 years ago

bech-angular-k3a-functions v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Banco Estado de Chile - Angular K3A Functions Library

How to use this package?

  1. Import package module in your App Module.
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BechAngularK3aFunctionsModule } from 'bech-angular-k3a-functions'; // -> Add this line

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [BechAngularK3aFunctionsModule], // -> Add this line
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Inject the package service in your application
import { Component } from '@angular/core';
import { K3AGlobals, K3APinpadService } from 'bech-angular-k3a-functions'; // -> Add this line

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'k3a-webapp-testing';

  // -> Inject services
  constructor(private k3aGlobals: K3AGlobals, private k3aPinpadService: K3APinpadService) {}

  // -> Try Global functions
  tryK3aGlobals() {
    return this.k3aGlobals.activateComunication()
  }

  // -> Try Pinpad functions
  tryK3aPinpad() {
    return this.k3aPinpadService.getStatus()
  }
}

Functions/Methods

Globals

  1. activateComunication()
  2. fromK3ACommandEvent(): Observable<K3ACommandDetail>
  3. fromConnectEvent(): Observable<boolean>
  4. sendInput(command: string | number): void
  5. getProperty(propertyName: any): Promise<any>
  6. setScratchPad(e: ScratchPad): void
  7. getScratchPad(idScratchPad: any): Promise<any>
  8. async waitForConnect(): Promise<boolean>

Pinpad

  1. init()
  2. getStatus(): Promise<PinpadStatus>
  3. fromAllEvents(): Observable<K3ACommandDetail>
  4. fromEvent(targetEvent:keyof typeof PinpadEvents): Observable<K3ACommandDetail>
  5. readPinpad(): Promise<string>
  6. readAllPinpadEntry(): Promise<string>