feat(*): 模型协议 - 升级声明式协议、扩充官方插件并完善生成任务恢复
This commit is contained in:
1 parent
3f4a9ea3d0
commit
4724f0767b
132 files changed
+4576
-1420
No files matched your search
@@ -11,6 +11,7 @@ import (
|
||||
type taskBillingRepositoryStub struct {
|
||||
runningCalls []string
|
||||
settleCalls []string
|
||||
restoreCalls []string
|
||||
refundCalls []string
|
||||
uncertainCalls []string
|
||||
order *model.BillingOrder
|
||||
@@ -29,6 +30,11 @@ func (r *taskBillingRepositoryStub) SettleBillingOrder(orderID string, providerR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *taskBillingRepositoryStub) RestoreRefundedBillingOrder(orderID string, providerRequestID string) error {
|
||||
r.restoreCalls = append(r.restoreCalls, orderID+":"+providerRequestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *taskBillingRepositoryStub) RefundBillingOrder(orderID string, errorText string) error {
|
||||
r.refundCalls = append(r.refundCalls, orderID+":"+errorText)
|
||||
return nil
|
||||
@@ -57,6 +63,9 @@ func TestTaskBillingCoordinatorEmptyOrderIsNoOp(t *testing.T) {
|
||||
if err := billing.SettleBilling("", "provider-1"); err != nil {
|
||||
t.Fatalf("SettleBilling() error = %v", err)
|
||||
}
|
||||
if err := billing.RestoreRefundedBilling("", "provider-1"); err != nil {
|
||||
t.Fatalf("RestoreRefundedBilling() error = %v", err)
|
||||
}
|
||||
if err := billing.RefundBilling("", "refund"); err != nil {
|
||||
t.Fatalf("RefundBilling() error = %v", err)
|
||||
}
|
||||
@@ -66,7 +75,7 @@ func TestTaskBillingCoordinatorEmptyOrderIsNoOp(t *testing.T) {
|
||||
if billing.BillingFailureRequiresReview("", "task-1", errors.New("timeout")) {
|
||||
t.Fatal("BillingFailureRequiresReview() = true for empty order")
|
||||
}
|
||||
if len(repo.runningCalls)+len(repo.settleCalls)+len(repo.refundCalls)+len(repo.uncertainCalls) != 0 {
|
||||
if len(repo.runningCalls)+len(repo.settleCalls)+len(repo.restoreCalls)+len(repo.refundCalls)+len(repo.uncertainCalls) != 0 {
|
||||
t.Fatalf("empty order should not reach repository: %#v", repo)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user