
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@ruraim/nestjs-midtrans
Advanced tools
Midtrans API Wrapper for Nest JS, with this package you can easily integrate your Nest JS application with Midtrans Payment Gateway. Using zod for schema validation so you can import the schema and use it for validation in your application.
This package is still under development, so there are still many features that are not available yet. Will be stable on version 1.0.0
Using NPM
$ npm i --save @ruraim/nestjs-midtrans
Using Yarn
$ yarn add @ruraim/nestjs-midtrans
import { Module } from '@nestjs/common';
import { MidtransModule } from '@ruraim/nestjs-midtrans';
// using register method
@Module({
imports: [
MidtransModule.register({
clientKey: 'client-key',
serverKey: 'server-key',
merchantId: 'merchant-id',
sandbox: true, // default: false,
isGlobal: true // default: false, register module globally
})
],
})
// using registerAsync with dependencies
@Module({
imports: [
MidtransModule.registerAsync({
useFactory: (config: ConfigService) => ({
clientKey: config.get<string>('MIDTRANS_CLIENT_KEY'),
serverKey: config.get<string>('MIDTRANS_SERVER_KEY'),
merchantId: config.get<string>('MIDTRANS_MERCHANT_ID'),
sandbox: config.get<string>('MIDTRANS_MODE') === 'sandbox',
}),
// using ConfigService from @nestjs/config to get .env value
inject: [ConfigService],
imports: [ConfigModule],
isGlobal: true // default: false, register module globally
})
],
})
export class AppModule {}
import { MidtransService } from '@ruraim/nestjs-midtrans';
@Injectable()
export class AppService {
constructor(
private readonly midtransService: MidtransService
) {}
}
You can refer to Midtrans - Charge Transaction for more information about the payload or see Charge Schema file in the source code.
const result = await this.midtransService.charge({
payment_type: 'bank_transfer',
transaction_details: {
order_id: 'ORDER-ID-123',
gross_amount: 200000
},
customer_details: {
email: 'customer@gmail.com',
first_name: 'John Doe',
phone: '081234567890'
},
item_details: [
{
id: 'Item1',
price: 100000,
quantity: 1,
name: 'Item 1'
},
{
id: 'Item2',
price: 50000,
quantity: 2,
name: 'Item 2'
}
],
bank_transfer: {
bank: 'bca'
}
})
console.log(result)
const result = await this.midtransService.getStatus('ORDER-ID-123')
console.log(result)
const result = await this.midtransService.expireTransaction('ORDER-ID-123')
console.log(result)
You can refer to Midtrans - Create Subscription for more information about the payload or see Create Subscription Schema file in the source code.
const result = await this.midtransService.createSubscription({
name: 'Langganan bulanan',
amount: 10000,
currency: 'IDR',
payment_type: 'credit_card',
schedule: {
interval: 1,
interval_unit: 'month',
max_interval: 12,
start_time: '2023-07-15 00:00:00'
},
token: 'dummy_credit_card_token',
})
console.log(result)
const result = await this.midtransService.getSubscription('SUBSCRIPTION-ID-123')
console.log(result)
const result = await this.midtransService.disableSubscription('SUBSCRIPTION-ID-123')
console.log(result)
const result = await this.midtransService.enableSubscription('SUBSCRIPTION-ID-123')
console.log(result)
const result = await this.midtransService.updateSubscription('4b9273ae-8bfa-4400-94fe-ba4b2b4af70f', {
name: 'Langganan bulanan',
amount: 50000,
currency: 'IDR',
token: 'dummy_credit_card_token'
})
console.log(result)
If you like this package, you can support me by:
If you have any question, feel free to contact me on:
FAQs
NestJS Midtrans SDK Module
We found that @ruraim/nestjs-midtrans demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.