@inject_dev/qiwi-p2p-nestjs
v1.3.2
Published
Dynamic module qiwi p2p for nestjs
Downloads
6
Readme
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.
- Fork the repository
- Create your branch (git checkout -b my-branch)
- Commit any changes to your branch
- Push your changes to your remote branch
- Open a pull request
License
Distributed under the MIT License. See LICENSE for more information.