Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gofmt the _examples/new_transaction #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
53 changes: 26 additions & 27 deletions _examples/new_transaction/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"fmt"
auth "github.com/hunterlong/authorizecim"
"os"
"fmt"
)

var newTransactionId string
Expand All @@ -13,7 +13,7 @@ func main() {
apiName := os.Getenv("apiName")
apiKey := os.Getenv("apiKey")

auth.SetAPIInfo(apiName,apiKey,"test")
auth.SetAPIInfo(apiName, apiKey, "test")

if auth.IsConnected() {
fmt.Println("Connected to Authorize.net!")
Expand All @@ -26,33 +26,32 @@ func main() {

func ChargeCustomer() {

newTransaction := auth.NewTransaction{
Amount: "13.75",
CreditCard: auth.CreditCard{
CardNumber: "4012888818888",
ExpirationDate: "08/25",
CardCode: "393",
},
BillTo: &auth.BillTo{
FirstName: "Timmy",
LastName: "Jimmy",
Address: "1111 green ct",
City: "los angeles",
State: "CA",
Zip: "43534",
Country: "USA",
PhoneNumber: "8885555555",
},
}
response := newTransaction.Charge()
newTransaction := auth.NewTransaction{
Amount: "13.75",
CreditCard: auth.CreditCard{
CardNumber: "4012888818888",
ExpirationDate: "08/25",
CardCode: "393",
},
BillTo: &auth.BillTo{
FirstName: "Timmy",
LastName: "Jimmy",
Address: "1111 green ct",
City: "los angeles",
State: "CA",
Zip: "43534",
Country: "USA",
PhoneNumber: "8885555555",
},
}
response := newTransaction.Charge()

if response.Approved() {
newTransactionId = response.TransactionID()
fmt.Println("Transaction was Approved! #",response.TransactionID())
}
if response.Approved() {
newTransactionId = response.TransactionID()
fmt.Println("Transaction was Approved! #", response.TransactionID())
}
}


func VoidTransaction() {

newTransaction := auth.PreviousTransaction{
Expand All @@ -63,4 +62,4 @@ func VoidTransaction() {
fmt.Println("Transaction was Voided!")
}

}
}