-
Notifications
You must be signed in to change notification settings - Fork 0
/
packages_test.go
110 lines (105 loc) · 3.63 KB
/
packages_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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package ebct
import (
"encoding/json"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
"testing"
)
const PackageList = `{
"packageList": [
{
"customerControlCode": "FOX-IC21080001",
"senderName": "SHANGHAI TANGKE E-TRADE CO.,LTD",
"senderAddress": "HUMIN RD",
"senderAddressNumber": "1399",
"senderAddressComplement": "SHANGHAI",
"senderZipCode": "200125",
"senderCityName": "Exterior",
"senderState": "",
"senderCountryCode": "CH",
"senderEmail": "",
"senderWebsite": "www.teste.com",
"recipientName": "ELIDE FIORAVANTI NOVAES",
"recipientDocumentType": "CPF",
"recipientDocumentNumber": "27186582826",
"recipientAddress": "RUA DAS PALMEIRAS",
"recipientAddressNumber": "215",
"recipientAddressComplement": "",
"recipientCityName": "SAO PAULO",
"recipientState": "SP",
"recipientZipCode": "07022000",
"recipientEmail": "",
"recipientPhoneNumber": "",
"totalWeight": 1,
"packagingLength": 16,
"packagingWidth": 11,
"packagingHeight": 2,
"distributionModality": 33162,
"taxPaymentMethod": "DDU",
"currency": "USD",
"freightPaidValue": 30.00,
"insurancePaidValue": 0,
"items": [
{
"hsCode": "392490",
"description": "COPO / GARRAFA",
"quantity": 1,
"value": 10.65
}
]
},
{
"customerControlCode": "100052203",
"senderName": "BODYBUILDING.COM ",
"senderAddress": "S. SILVERSTONE WAY ",
"senderAddressNumber": "201654",
"senderAddressComplement": "comp ",
"senderZipCode": "83642555887858953222",
"senderCityName": "MERIDIAN",
"senderState": "",
"senderCountryCode": "US",
"senderEmail": "sdfsdfsdfsdf@fsdsdf.com",
"senderWebsite": "www.bodybuilding.comdsgas",
"recipientName": "Jean Albuquerque",
"recipientDocumentType": "CPF",
"recipientDocumentNumber": "44517000001",
"recipientAddress": "QMSW 5 LOTE 2 BLOCO B",
"recipientAddressNumber": "4565456sad",
"recipientAddressComplement": "ED. SAN JUAN, APTO 600",
"recipientCityName": "SAO PAULO",
"recipientState": "SP",
"recipientZipCode": "17270001",
"recipientEmail": "JEANCS@CORREIOS.COM.BR",
"recipientPhoneNumber": "1499999999",
"totalWeight": 120,
"packagingLength": 16,
"packagingWidth": 11,
"packagingHeight": 2,
"distributionModality": 33170,
"taxPaymentMethod": "DDU",
"currency": "USD",
"freightPaidValue": 7.54,
"insurancePaidValue": 0,
"items": [
{
"hsCode": "401120",
"description": "TOYS, GAMES AND SPORTS REQUISITES",
"quantity": 1,
"value": 140.61
}
]
}
]
}`
func TestPackageRquest(t *testing.T) {
aPackageList := &PackageRequestList{}
var bPack = []byte(PackageList)
var err error
err = json.Unmarshal(bPack, aPackageList)
if err != nil {
spew.Dump(err)
}
packList, err := client.PostPackage(aPackageList)
spew.Dump(packList)
assert.NoError(t, err)
}