Code cleanup
This commit is contained in:
1 parent
dcc9754d43
commit
1307c7bc6e
18 files changed
+129
-459
No files matched your search
@@ -1,16 +0,0 @@
|
||||
package stripe
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"payment-poc/state"
|
||||
)
|
||||
|
||||
type StripeDb struct {
|
||||
Id uuid.UUID `db:"id"`
|
||||
TotalAmount int64 `db:"total_amount"`
|
||||
Lang string `db:"lang"`
|
||||
|
||||
PaymentIntentId string `db:"payment_intent_id"`
|
||||
|
||||
State state.PaymentState `db:"payment_state"`
|
||||
}
|
||||
+2
-2
@@ -19,7 +19,7 @@ type Service struct {
|
||||
|
||||
func (s *Service) CreatePaymentUrl(amount int64) (url string, err error) {
|
||||
entry, err := s.Provider.CreateEntry(database.PaymentEntry{
|
||||
Gateway: state.GatewayVivaWallet,
|
||||
Gateway: state.GatewayStripe,
|
||||
State: state.StateInitialized,
|
||||
TotalAmount: amount,
|
||||
})
|
||||
@@ -83,7 +83,7 @@ func (s *Service) CompleteTransaction(entry database.PaymentEntry, amount int64)
|
||||
}
|
||||
log.Printf("received state on completion: %v", pi.Status)
|
||||
if pi.Status == stripe.PaymentIntentStatusSucceeded || pi.Status == stripe.PaymentIntentStatusProcessing {
|
||||
entry.TotalAmount = pi.Amount
|
||||
entry.Amount = &pi.AmountReceived
|
||||
entry.State = state.StateCompleted
|
||||
}
|
||||
return entry, nil
|
||||
|
||||
Reference in new issue
Block a user