diff --git a/module/donation/domain/payment_history.go b/module/donation/domain/payment_history.go index 18601c6..a36798e 100644 --- a/module/donation/domain/payment_history.go +++ b/module/donation/domain/payment_history.go @@ -45,7 +45,7 @@ func ConstructPaymentHistory(fn func(ph *PaymentHistory) (err error)) (*PaymentH return nil, err } - if ph.ID.IsZero() || ph.PaymentUserID.IsZero() || ph.Type.IsZero() || ph.Status.IsZero() || ph.Amount == 0 || ph.CreatedAt.IsZero() { + if ph.ID.IsZero() || ph.Type.IsZero() || ph.Status.IsZero() || ph.Amount == 0 || ph.CreatedAt.IsZero() { return nil, fmt.Errorf("failed to construct %+v", ph) } diff --git a/module/donation/gateway/payment_history.go b/module/donation/gateway/payment_history.go index 4f87d98..bd12c93 100644 --- a/module/donation/gateway/payment_history.go +++ b/module/donation/gateway/payment_history.go @@ -14,7 +14,11 @@ import ( func (g *impl) ListPaymentHistories(ctx context.Context, paymentUserID *idtype.PaymentUserID) ([]*donationdomain.PaymentHistory, error) { var startingAfter *string - customer := lo.Ternary(paymentUserID == nil, nil, stripe.String(paymentUserID.String())) + + var customer *string + if paymentUserID != nil { + customer = stripe.String(paymentUserID.String()) + } paymentIntents := make([]*stripe.PaymentIntent, 0) @@ -26,7 +30,7 @@ func (g *impl) ListPaymentHistories(ctx context.Context, paymentUserID *idtype.P StartingAfter: startingAfter, }, Customer: customer, - Expand: stripe.StringSlice([]string{"invoice"}), + Expand: stripe.StringSlice([]string{"data.invoice"}), }) if err := iter.Err(); err != nil { diff --git a/module/donation/usecase/impl.go b/module/donation/usecase/impl.go index 308951b..9423ea9 100644 --- a/module/donation/usecase/impl.go +++ b/module/donation/usecase/impl.go @@ -34,6 +34,7 @@ func New(a authmodule.AccessController, f donationport.Factory, g donationport.G go func() { for { + log.Println("update contributors cache") if err := uc.updateContributorsCache(context.Background()); err != nil { log.Printf("failed to update contributors cache, %v", err) } @@ -43,6 +44,7 @@ func New(a authmodule.AccessController, f donationport.Factory, g donationport.G go func() { for { + log.Println("update total amount cache") if err := uc.updateTotalAmountCache(context.Background()); err != nil { log.Printf("failed to update total amount cache, %v", err) }