@@ -70,26 +70,27 @@ func AuthorizeCharge(p transactionProcessingData) (transactionProcessingData, er
70
70
71
71
var paymentTokenId string
72
72
if common .IsLocalEnv () {
73
- // Generate a payment token ID in case we don't yet have one in the front end
74
- // For testing purposes only
75
- card := tokens.Card {
76
- Type : checkoutCommon .Card ,
77
- Number : "4242424242424242" , // Success
78
- // Number: "4273149019799094", // succeed authorize, fail capture
79
- // Number: "4544249167673670", // Declined - Insufficient funds
80
- // Number: "5148447461737269", // Invalid transaction (debit card)
81
- ExpiryMonth : 2 ,
82
- ExpiryYear : 2024 ,
83
- Name : "Customer Name" ,
84
- CVV : "100" ,
85
- }
86
- paymentToken , err := CreateToken (& card )
87
- if err != nil {
88
- return p , common .StringError (err )
89
- }
90
- paymentTokenId = paymentToken .Created .Token
91
73
if p .executionRequest .CardToken != "" {
92
74
paymentTokenId = p .executionRequest .CardToken
75
+ } else {
76
+ // Generate a payment token ID in case we don't yet have one in the front end
77
+ // For testing purposes only
78
+ card := tokens.Card {
79
+ Type : checkoutCommon .Card ,
80
+ Number : "4242424242424242" , // Success
81
+ // Number: "4273149019799094", // succeed authorize, fail capture
82
+ // Number: "4544249167673670", // Declined - Insufficient funds
83
+ // Number: "5148447461737269", // Invalid transaction (debit card)
84
+ ExpiryMonth : 2 ,
85
+ ExpiryYear : 2024 ,
86
+ Name : "Customer Name" ,
87
+ CVV : "100" ,
88
+ }
89
+ paymentToken , err := CreateToken (& card )
90
+ if err != nil {
91
+ return p , common .StringError (err )
92
+ }
93
+ paymentTokenId = paymentToken .Created .Token
93
94
}
94
95
} else {
95
96
paymentTokenId = p .executionRequest .CardToken
0 commit comments