-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features/lamnv/ahamove integration (#68)
* feat: get ahamove token, estimate fee, webhook and ws api * fix: update migrations and update ahamove api * fix: update script migrations * fix: update on wheel api * integration with momo * fix: update integration with momo * update momo webhook * update configuration for momo * fix: momo integration * fix: momo integration * minor modify * fix: update momo invoice check and ahamove webhook * adjust some logic * fix comment from Tuan (#72) * fix comment from Tuan * change input from orderId into invoiceId * hotfix --------- Co-authored-by: lamnv <[email protected]> Co-authored-by: NHT <[email protected]> --------- Co-authored-by: lamnv <[email protected]> Co-authored-by: NHT <[email protected]> Co-authored-by: nfesta2023 <[email protected]>
- Loading branch information
1 parent
2add72d
commit e3011b1
Showing
30 changed files
with
1,102 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 80 | ||
"printWidth": 80, | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/database/migrations/1709005940772-add-momo-transactions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddMomoTransactions1709005940772 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE \`MomoTransaction\` (\`id\` int NOT NULL AUTO_INCREMENT, \`partnerCode\` varchar(50) NOT NULL, \`requestId\` varchar(50) NOT NULL, \`amount\` decimal(10,2) NOT NULL, \`orderId\` varchar(50) NOT NULL, \`transId\` bigint NOT NULL, \`responseTime\` bigint NOT NULL, \`orderInfo\` varchar(255) NOT NULL, \`type\` varchar(10) NOT NULL, \`resultCode\` int NOT NULL, \`redirectUrl\` varchar(255) NOT NULL, \`ipnUrl\` varchar(255) NOT NULL, \`extraData\` text NOT NULL, \`requestType\` varchar(50) NOT NULL, \`signature\` varchar(255) NOT NULL, \`lang\` varchar(2) NOT NULL DEFAULT 'en', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`, | ||
); | ||
await queryRunner.query(`ALTER TABLE \`MomoTransaction\` | ||
ADD COLUMN \`payUrl\` TEXT NULL AFTER \`lang\`, | ||
ADD COLUMN \`message\` TEXT NULL AFTER \`payUrl\`;`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE \`MomoTransaction\``); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Controller, Logger } from '@nestjs/common'; | ||
import { MomoService } from './momo.service'; | ||
import { MessagePattern } from '@nestjs/microservices'; | ||
import { MomoRequestDTO } from './momo.dto'; | ||
|
||
@Controller('momo') | ||
export class MomoController { | ||
private readonly logger = new Logger(MomoController.name); | ||
|
||
constructor(private readonly momoService: MomoService) {} | ||
|
||
@MessagePattern({ cmd: 'create_momo_payment' }) | ||
async sendMomoPaymentRequest(payload: MomoRequestDTO) { | ||
return this.momoService.sendMomoPaymentRequest(payload); | ||
} | ||
|
||
@MessagePattern({ cmd: 'momo_payment_ipn_callback' }) | ||
async handleMomoCallback(payload: any) { | ||
return this.momoService.handleMoMoIpnCallBack(payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface MomoRequestDTO { | ||
invoiceId: number; | ||
} | ||
|
||
export interface MomoRequest { | ||
accessKey: string; | ||
amount: string; | ||
extraData: string; | ||
ipnUrl: string; | ||
orderId: string; | ||
orderInfo: string; | ||
partnerCode: string; | ||
redirectUrl: string; | ||
requestId: string; | ||
requestType: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { MomoService } from './momo.service'; | ||
import { MomoController } from './momo.controller'; | ||
import { ConfigModule } from '@nestjs/config'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { MomoTransaction } from 'src/entity/momo-transaction.entity'; | ||
import { InvoiceStatusHistoryModule } from 'src/feature/invoice-status-history/invoice-status-history.module'; | ||
import { Invoice } from 'src/entity/invoice.entity'; | ||
import { InvoiceStatusHistory } from 'src/entity/invoice-history-status.entity'; | ||
import { OrderModule } from 'src/feature/order/order.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
ConfigModule, | ||
TypeOrmModule.forFeature([MomoTransaction, Invoice, InvoiceStatusHistory]), | ||
InvoiceStatusHistoryModule, | ||
OrderModule, | ||
], | ||
providers: [MomoService], | ||
controllers: [MomoController], | ||
}) | ||
export class MomoModule {} |
Oops, something went wrong.