Skip to content

Commit

Permalink
fix: transaction status
Browse files Browse the repository at this point in the history
  • Loading branch information
okjodom committed Dec 2, 2024
1 parent 8892a72 commit d1fa639
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/solowallet/src/db/solowallet.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export class SolowalletDocument extends AbstractDocument {
@Prop({ type: Number, required: true })
amountMsats: number;

@Prop({ type: Number, required: true })
amountFiat: number;
@Prop({ type: Number, required: false })
amountFiat?: number;

@Prop({
type: String,
enum: Object.values(TransactionStatus),
required: true,
enum: Object.values(TransactionStatus),
})
status: TransactionStatus;

Expand Down
9 changes: 8 additions & 1 deletion apps/solowallet/src/solowallet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,19 @@ export class SolowalletService {
};
}

let status = TransactionStatus.UNRECOGNIZED;
try {
status = Number(deposit.status) as TransactionStatus;
} catch (error) {
this.logger.warn('Error parsing deposit status', error);
}

return {
...deposit,
status,
lightning,
paymentTracker: lightning.operationId,
id: deposit._id,
status: deposit.status,
createdAt: deposit.createdAt.toDateString(),
updatedAt: deposit.updatedAt.toDateString(),
};
Expand Down

0 comments on commit d1fa639

Please sign in to comment.