-
Notifications
You must be signed in to change notification settings - Fork 58
/
customer.go
51 lines (43 loc) · 1.06 KB
/
customer.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
package main
import (
"fmt"
"log"
"time"
"github.com/xendit/xendit-go"
"github.com/xendit/xendit-go/customer"
)
func customerTest() {
customerAddress := xendit.CustomerAddress{
Country: "ID",
StreetLine1: "Jl. 123",
StreetLine2: "Jl. 456",
City: "Jakarta Selatan",
Province: "DKI Jakarta",
State: "-",
PostalCode: "12345",
}
metadata := map[string]interface{}{
"meta": "data",
}
createCustomerData := customer.CreateCustomerParams{
ReferenceID: time.Now().String(),
Email: "tes@tes.com",
GivenNames: "Given Names",
Nationality: "ID",
DateOfBirth: "1995-12-30",
Addresses: []xendit.CustomerAddress{customerAddress},
Metadata: metadata,
}
resp, err := customer.CreateCustomer(&createCustomerData)
if err != nil {
log.Panic(err)
}
getCustomerByReferenceIDData := customer.GetCustomerByReferenceIDParams{
ReferenceID: resp.ReferenceID,
}
_, err = customer.GetCustomerByReferenceID(&getCustomerByReferenceIDData)
if err != nil {
log.Panic(err)
}
fmt.Println("Customer integration tests done!")
}