-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_transaction_display_example.go
58 lines (49 loc) · 1.28 KB
/
update_transaction_display_example.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
54
55
56
57
58
package main
import (
"fmt"
"log"
blockchyp "github.com/blockchyp/blockchyp-go/v2"
)
func updateTransactionDisplayExample() {
// sample credentials
creds := blockchyp.APICredentials{
APIKey: "ZDSMMZLGRPBPRTJUBTAFBYZ33Q",
BearerToken: "ZLBW5NR4U5PKD5PNP3ZP3OZS5U",
SigningKey: "9c6a5e8e763df1c9256e3d72bd7f53dfbd07312938131c75b3bfd254da787947",
}
// instantiate the client
client := blockchyp.NewClient(creds)
// setup request object
request := blockchyp.TransactionDisplayRequest{
Test: true,
TerminalName: "Test Terminal",
Transaction: &blockchyp.TransactionDisplayTransaction{
Subtotal: "60.00",
Tax: "5.00",
Total: "65.00",
Items: []*blockchyp.TransactionDisplayItem{
&blockchyp.TransactionDisplayItem{
Description: "Leki Trekking Poles",
Price: "35.00",
Quantity: 2,
Extended: "70.00",
Discounts: []*blockchyp.TransactionDisplayDiscount{
&blockchyp.TransactionDisplayDiscount{
Description: "memberDiscount",
Amount: "10.00",
},
},
},
},
},
}
response, err := client.UpdateTransactionDisplay(request)
if err != nil {
log.Fatal(err)
}
//process the result
if response.Success {
fmt.Println("Success")
}
fmt.Printf("Response: %+v\n", response)
}