Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hayato24s committed Mar 15, 2024
1 parent 4566471 commit 783c855
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module/donation/domain/payment_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 6 additions & 2 deletions module/donation/gateway/payment_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions module/donation/usecase/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 783c855

Please sign in to comment.