@inject_dev/qiwi-p2p-nestjs
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published


MIT License Built with NestJS Built with @nestjsplus/dyn-schematics


About

The module is a wrapper api for the Qiwi P2P.


Installation

npm i @inject_dev/qiwi-p2p-nestjs

Quick Start

Import the module and pass your api keys to it

// app.module.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { QiwiP2PModule } from '@inject_dev/qiwi-p2p-nestjs';

@Module({
  imports: [QiwiP2PModule.forRoot({
    secretKey: "apiSecretKey",
    publicKey: "apiPublicKey",
  })],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

..or use forRootAsync({ })

// app.module.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { QiwiP2PModule } from '@inject_dev/qiwi-p2p-nestjs';

@Module({
  imports: [
    QiwiP2PModule.forRootAsync({
      imports: [/* ConfigModule */]
      /* 
        useExisting 
        useFactory 
        useClass 
      */
      useFactory: async () => /* API_KEYS */, 
      inject: [/* ConfigService */]
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Use library in your service

// app.service.ts
import { QiwiP2PService } from '@inject_dev/qiwi-p2p-nestjs'
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
  constructor(
    private readonly p2pService: QiwiP2PService
  ) {}
  
  async createBill(paymentInfo): Promise<any> {
    // paymentInfo: ICreateBillParams
    return this.p2pService.createBill(paymentInfo);
  }
}

FEATURES

Create bill

// app.service.ts
import { QiwiP2PService, IBillInfoSuccessResponce } from '@inject_dev/qiwi-p2p-nestjs'
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
  constructor(
    private readonly p2pService: QiwiP2PService
  ) {}
  
  async createBill(paymentInfo): Promise<IBillInfoSuccessResponce> {
    // paymentInfo: ICreateBillParams
    return this.p2pService.createBill(paymentInfo);
  }
}

Get bill info

// app.service.ts
import { QiwiP2PService, IBillInfoSuccessResponce, IRecipient } from '@inject_dev/qiwi-p2p-nestjs'
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
  constructor(
    private readonly p2pService: QiwiP2PService
  ) {}
  
  async createBill(id): Promise<IBillInfoSuccessResponce & IRecipient> {
    return this.p2pService.getBillInfo(id /* bill id */)
  }
}

Contributing

Any suggestions for improving the project are welcome.

  1. Fork the repository
  2. Create your branch (git checkout -b my-branch)
  3. Commit any changes to your branch
  4. Push your changes to your remote branch
  5. Open a pull request

License

Distributed under the MIT License. See LICENSE for more information.


Acknowledgements

Readme

Keywords

Package Sidebar

Install

npm i @inject_dev/qiwi-p2p-nestjs

Weekly Downloads

0

Version

1.3.2

License

MIT

Unpacked Size

28.9 kB

Total Files

23

Last publish

Collaborators

  • inject_dev