Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions pkg/service/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,27 @@ func AuthorizeCharge(amount float64, userWallet string, tokenId string) (auth Au
}
client := payments.NewClient(*config)

// Generate a payment token ID in case we don't yet have one in the front end
// For testing purposes only
card := tokens.Card{
Type: checkoutCommon.Card,
Number: "4242424242424242",
ExpiryMonth: 2,
ExpiryYear: 2024,
Name: "Customer Name",
CVV: "100",
}
paymentToken, err := CreateToken(&card)
if err != nil {
return auth, common.StringError(err)
}
paymentTokenID := paymentToken.Created.Token
if tokenId != "" {
var paymentTokenID string
if common.IsLocalEnv() {
// Generate a payment token ID in case we don't yet have one in the front end
// For testing purposes only
card := tokens.Card{
Type: checkoutCommon.Card,
Number: "4242424242424242",
ExpiryMonth: 2,
ExpiryYear: 2024,
Name: "Customer Name",
CVV: "100",
}
paymentToken, err := CreateToken(&card)
if err != nil {
return auth, common.StringError(err)
}
paymentTokenID = paymentToken.Created.Token
if tokenId != "" {
paymentTokenID = tokenId
}
} else {
paymentTokenID = tokenId
}

Expand Down