Skip to content

Commit baf6f42

Browse files
authored
Merge pull request #27 from topcoder-platform/PM-1033_add-BA-to-payments
PM-1033 - add BA field for payments
2 parents 38db4b5 + 0bae5dc commit baf6f42

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Add the "billing_account" field to the "payment" table
2+
ALTER TABLE "payment"
3+
ADD COLUMN "billing_account" VARCHAR(80);
4+
5+
-- Set a value of "0" for the existing records in the "billing_account" column
6+
UPDATE "payment"
7+
SET billing_account = '0';
8+
9+
-- Alter the "billing_account" column to make it NOT NULL
10+
ALTER TABLE "payment"
11+
ALTER COLUMN "billing_account" SET NOT NULL;

prisma/schema.prisma

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ model payment {
6363
version Int? @default(1)
6464
release_date DateTime? @default(dbgenerated("(CURRENT_TIMESTAMP + '15 days'::interval)")) @db.Timestamp(6)
6565
payment_status payment_status?
66+
billing_account String @db.VarChar(80)
6667
payment_method payment_method? @relation(fields: [payment_method_id], references: [payment_method_id], onDelete: NoAction, onUpdate: NoAction)
6768
winnings winnings @relation(fields: [winnings_id], references: [winning_id], onDelete: NoAction, onUpdate: NoAction)
6869
payment_release_associations payment_release_associations[]

src/api/admin-winning/adminWinning.controller.ts

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export class AdminWinningController {
122122
createdAt: item.createdAt.toISOString(),
123123
updatedAt: item.updatedAt?.toISOString() ?? '',
124124
releaseDate: item.releaseDate?.toISOString() ?? '',
125+
billingAccount: payment?.billingAccount,
125126
};
126127
});
127128

@@ -142,6 +143,7 @@ export class AdminWinningController {
142143
{ key: 'createdAt', header: 'Created At' },
143144
{ key: 'updatedAt', header: 'Updated At' },
144145
{ key: 'releaseDate', header: 'Release Date' },
146+
{ key: 'billingAccount', header: 'Billing Account' },
145147
],
146148
});
147149

src/api/admin-winning/adminWinning.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export class AdminWinningService {
110110
currency: paymentItem.currency,
111111
releaseDate: paymentItem.release_date,
112112
category: item.category,
113+
billingAccount: paymentItem.billing_account,
113114
})),
114115
createdAt: item.created_at,
115116
updatedAt:

src/api/winning/winning.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export class WinningService {
8888
net_amount: Prisma.Decimal(0),
8989
payment_status: '' as payment_status,
9090
created_by: userId,
91+
billing_account: detail.billingAccount,
9192
};
9293
if (taxForms.length > 0) {
9394
let netAmount = detail.grossAmount;

src/dto/adminWinning.dto.ts

+9
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,14 @@ export class PaymentCreateRequestDto {
386386
@IsString()
387387
@IsNotEmpty()
388388
currency: string;
389+
390+
@ApiProperty({
391+
description: 'Billing Account number for the payment',
392+
example: '1231231',
393+
})
394+
@IsString()
395+
@IsNotEmpty()
396+
billingAccount: string;
389397
}
390398

391399
export class WinningCreateRequestDto {
@@ -490,6 +498,7 @@ export class PaymentDetailDto {
490498
currency: string;
491499
releaseDate: Date;
492500
category: string;
501+
billingAccount: string;
493502
}
494503

495504
export class WinningDto {

0 commit comments

Comments
 (0)