kopa-connector-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.9.9 • Public • Published

Nestjs Köpa connector SDK

Features

  • Configure and connect to Köpa connector instance

Installation

Yarn

yarn add kopa-connector-sdk

NPM

npm install kopa-connector-sdk --save

Getting Started

To use Köpa connector SDK we need to register module for example in app.module.ts

import { Module } from '@nestjs/common';
import { KopaModule } from 'kopa-connector-sdk';

@Module({
imports: [
    KopaModule.register({
      password: 'connector_password',
      username: 'connector_username',
      resource: 'connector_resource',
    })
})

export class AppModule {}

After the registration connection to Köpa connector instance should be completed and ready for usage.

Example usage in service.

import { Injectable } from '@nestjs/common';
import { KopaService } from 'kopa-connector-sdk';
import { OnEvent } from '@nestjs/event-emitter';

@Injectable()
export class ContentService {
  constructor(private readonly kopaService: KopaService) {}

  @OnEvent('merchant.get')
  handleGetMerchantRequest(payload) {
    const message = {
      to: payload.from,
      sagaId: payload.sagaId,
      payload: {
        companyName: 'Company name',
        companyAddress: 'Company address',
        companyPib: 'Company pib',
      },
    };
    this.kopaService.sendGetMerchantResponse(message);
  }
}

Readme

Keywords

Package Sidebar

Install

npm i kopa-connector-sdk

Weekly Downloads

179

Version

1.9.9

License

MIT

Unpacked Size

74.8 kB

Total Files

44

Last publish

Collaborators

  • marijatrbojevic