-
Notifications
You must be signed in to change notification settings - Fork 0
/
cn38_test.go
82 lines (64 loc) · 1.73 KB
/
cn38_test.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package ebct
import (
"encoding/json"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
"testing"
)
const Cn38UnitCode = `{"unitList": [
{
"unitCode": "CNTICPBRSAODAIX12374001000030",
"trackingNumbers": [
"IX000682851BR","IX000682865BR"
] },
{
"unitCode": "CNTICPBRSAODAIX12375001000030",
"trackingNumbers": [
"IX000682879BR"
]
}]}`
func TestCn38Request(t *testing.T) {
aCn38Request := &Cn38RequestAsyncInput{
DispatchNumbers: []int{953},
}
requestReturn, err := client.PostCn38Request(aCn38Request)
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38AsyncGetRequest(t *testing.T) {
requestReturn, err := client.GetCn38Async("7934ea61-e450-44b5-b4ea-61e45094b57d")
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38UnitCode(t *testing.T) {
aCn38Request := &Cn38UnitList{}
var bPack = []byte(Cn38UnitCode)
var err error
err = json.Unmarshal(bPack, aCn38Request)
if err != nil {
spew.Dump(err)
}
requestReturn, err := client.PostCn38UnitCode(aCn38Request)
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38ListPendingDepartureGet(t *testing.T) {
requestReturn, err := client.GetCn38ListPending(0)
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38ListConfirmedDepartureGet(t *testing.T) {
requestReturn, err := client.GetCn38ListConfirmed(0)
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38ListGeneratedDepartureGet(t *testing.T) {
requestReturn, err := client.GetCn38ListGenerated(0)
spew.Dump(requestReturn)
assert.NoError(t, err)
}
func TestCn38ListGeneratedByInvoiceGet(t *testing.T) {
requestReturn, err := client.GetCn38ListGeneratedByInvoice("9002021")
spew.Dump(requestReturn)
assert.NoError(t, err)
}