feat(dashboard,core-flows,js-sdk,types,link-modules,payment): ability to copy payment link (#8630)

what: 

- enables a button to create a payment link when a payment delta is present
- api to delete order payment collection
- adds a pending amount to payment collections

Note: Not the happiest with the decision on when to create a payment collection and when not to. The code should programatically create or delete payment collections currently to generate the right collection for the payment delta. Adding a more specific flow to create and manage a payment collection will help reduce this burden from the code path and onto CX/merchant.

Another issue I found is that the payment collection status doesn't get updated when payment is complete as it still gets stuck to "authorized" state

https://github.com/user-attachments/assets/037a10f9-3621-43c2-94ba-1ada4b0a041b
This commit is contained in:
Riqwan Thamir
2024-08-20 12:30:17 +02:00
committed by GitHub
parent 69830ca89c
commit fa44e3f5a8
35 changed files with 631 additions and 94 deletions

View File

@@ -103,12 +103,12 @@ export default class PaymentCollection {
payment_providers = new Collection<Rel<PaymentProvider>>(this)
@OneToMany(() => PaymentSession, (ps) => ps.payment_collection, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
cascade: [Cascade.PERSIST] as any,
})
payment_sessions = new Collection<Rel<PaymentSession>>(this)
@OneToMany(() => Payment, (payment) => payment.payment_collection, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
cascade: [Cascade.PERSIST] as any,
})
payments = new Collection<Rel<Payment>>(this)

View File

@@ -107,10 +107,14 @@ export default class PaymentSession {
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "payses")
this.payment_collection_id ??=
this.payment_collection_id ?? this.payment_collection?.id
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "payses")
this.payment_collection_id ??=
this.payment_collection_id ?? this.payment_collection?.id
}
}

View File

@@ -144,10 +144,14 @@ export default class Payment {
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "pay")
this.payment_collection_id ??=
this.payment_collection_id ?? this.payment_collection?.id
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "pay")
this.payment_collection_id ??=
this.payment_collection_id ?? this.payment_collection?.id
}
}