-
Notifications
You must be signed in to change notification settings - Fork 3
/
auth_data.go
53 lines (49 loc) · 1.97 KB
/
auth_data.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// History: Mar 12 14 tcolar Creation
package authorize
import (
"net/url"
)
// Data structure for authorization request
type AuthData struct {
InvoiceNumber string
Amount string
Description string
FirstName, LastName string
Company string
Address, City, State, Zip, Country string // billing
Phone, Email string
CustomerId, CustomerIp string
ShipToFirstName, ShipToLastName, ShipToCompany, ShipToAddress string
ShipToCity, ShipToState, ShipToZip, ShipToCountry string
}
// AddToUrlValues : Add the AuthData values to the given url.Values map for authorize.net
func (a AuthData) AddToUrlValues(vals url.Values) {
v := map[string][]string{
"x_invoice_num": {a.InvoiceNumber},
"x_amount": {a.Amount},
"x_description": {a.Description},
"x_first_name": {a.FirstName},
"x_last_name": {a.LastName},
"x_company": {a.Company},
"x_address": {a.Address},
"x_city": {a.City},
"x_state": {a.State},
"x_zip": {a.Zip},
"x_country": {a.Country},
"x_phone": {a.Phone},
"x_email": {a.Email},
"x_cust_id": {a.CustomerId},
"x_customer_ip": {a.CustomerIp},
"x_ship_to_first_name": {a.ShipToFirstName},
"x_ship_to_last_name": {a.ShipToLastName},
"x_ship_to_company": {a.ShipToCompany},
"x_ship_to_address": {a.ShipToAddress},
"x_ship_to_city": {a.ShipToCity},
"x_ship_to_state": {a.ShipToState},
"x_ship_to_zip": {a.ShipToZip},
"x_ship_to_country": {a.ShipToCountry},
}
for k, v := range v {
vals[k] = v
}
}