Skip to content

Commit 1a488ff

Browse files
committed
PM-1111 - process & store the challenge fee & markup for each payment
1 parent 9827b18 commit 1a488ff

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "payment" ADD COLUMN "challenge_fee" DECIMAL(12,2),
3+
ADD COLUMN "challenge_markup" DECIMAL(12,2);

prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ model payment {
5555
release_date DateTime? @default(dbgenerated("(CURRENT_TIMESTAMP + '15 days'::interval)")) @db.Timestamp(6)
5656
payment_status payment_status?
5757
billing_account String @db.VarChar(80)
58+
challenge_markup Decimal? @db.Decimal(12, 2)
59+
challenge_fee Decimal? @db.Decimal(12, 2)
5860
payment_method payment_method? @relation(fields: [payment_method_id], references: [payment_method_id], onDelete: NoAction, onUpdate: NoAction)
5961
winnings winnings @relation(fields: [winnings_id], references: [winning_id], onDelete: NoAction, onUpdate: NoAction)
6062
payment_release_associations payment_release_associations[]

src/api/winnings/winnings.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ export class WinningsService {
193193
payment_status: '' as payment_status,
194194
created_by: userId,
195195
billing_account: detail.billingAccount,
196+
challenge_markup: detail.challengeMarkup,
197+
challenge_fee: Prisma.Decimal(
198+
detail.challengeMarkup * Number(detail.grossAmount),
199+
),
196200
};
197201

198202
paymentModel.net_amount = Prisma.Decimal(detail.grossAmount);

src/dto/payment.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,12 @@ export class PaymentCreateRequestDto {
6666
@IsString()
6767
@IsNotEmpty()
6868
billingAccount: string;
69+
70+
@ApiProperty({
71+
description: 'Challenge markup for the payment',
72+
example: '0.5',
73+
})
74+
@IsNumber()
75+
@IsNotEmpty()
76+
challengeMarkup: number;
6977
}

0 commit comments

Comments
 (0)