feat: add per-provider allow_user_refund control and align wildcard matching
allow_user_refund: - Add allow_user_refund field to PaymentProviderInstance ent schema - Migration 103: ALTER TABLE payment_provider_instances ADD COLUMN - Cascade logic: disabling refund_enabled auto-disables allow_user_refund - User refund validation: check provider instance allows user refund - Admin refund validation: check provider instance allows admin refund - Subscription refund: deduct days on refund, rollback on failure - New endpoint: GET /payment/orders/refund-eligible-providers - Frontend: ToggleSwitch in ProviderCard/Dialog, cascade in SettingsView Wildcard matching: - Change findPricingForModel from "longest prefix wins" to "config order priority (first match wins)", aligning with channel service behavior
This commit is contained in:
@@ -99,6 +99,11 @@ func RefundEnabled(v bool) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldEQ(FieldRefundEnabled, v))
|
||||
}
|
||||
|
||||
// AllowUserRefund applies equality check predicate on the "allow_user_refund" field. It's identical to AllowUserRefundEQ.
|
||||
func AllowUserRefund(v bool) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldEQ(FieldAllowUserRefund, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldEQ(FieldCreatedAt, v))
|
||||
@@ -559,6 +564,16 @@ func RefundEnabledNEQ(v bool) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldNEQ(FieldRefundEnabled, v))
|
||||
}
|
||||
|
||||
// AllowUserRefundEQ applies the EQ predicate on the "allow_user_refund" field.
|
||||
func AllowUserRefundEQ(v bool) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldEQ(FieldAllowUserRefund, v))
|
||||
}
|
||||
|
||||
// AllowUserRefundNEQ applies the NEQ predicate on the "allow_user_refund" field.
|
||||
func AllowUserRefundNEQ(v bool) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldNEQ(FieldAllowUserRefund, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.PaymentProviderInstance {
|
||||
return predicate.PaymentProviderInstance(sql.FieldEQ(FieldCreatedAt, v))
|
||||
|
||||
Reference in New Issue
Block a user