1.3.2 • Published 2 years ago

@inject_dev/qiwi-p2p-nestjs v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.5

2 years ago