mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +01:00
Merge pull request #68 from logpacker/fix-quantity-type
#66: fix item.quantity type
This commit is contained in:
commit
f7201fdd87
|
@ -188,7 +188,7 @@ func TestCreatePayment(t *testing.T) {
|
||||||
ItemList: &ItemList{
|
ItemList: &ItemList{
|
||||||
Items: []Item{
|
Items: []Item{
|
||||||
Item{
|
Item{
|
||||||
Quantity: 2,
|
Quantity: "2",
|
||||||
Price: "3.50",
|
Price: "3.50",
|
||||||
Currency: "USD",
|
Currency: "USD",
|
||||||
Name: "Product 1",
|
Name: "Product 1",
|
||||||
|
@ -251,7 +251,7 @@ func TestPatchPayment(t *testing.T) {
|
||||||
ItemList: &ItemList{
|
ItemList: &ItemList{
|
||||||
Items: []Item{
|
Items: []Item{
|
||||||
Item{
|
Item{
|
||||||
Quantity: 2,
|
Quantity: "2",
|
||||||
Price: "3.50",
|
Price: "3.50",
|
||||||
Currency: "USD",
|
Currency: "USD",
|
||||||
Name: "Product 1",
|
Name: "Product 1",
|
||||||
|
|
2
types.go
2
types.go
|
@ -288,7 +288,7 @@ type (
|
||||||
|
|
||||||
// Item struct
|
// Item struct
|
||||||
Item struct {
|
Item struct {
|
||||||
Quantity int `json:"quantity"`
|
Quantity string `json:"quantity"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Price string `json:"price"`
|
Price string `json:"price"`
|
||||||
Currency string `json:"currency"`
|
Currency string `json:"currency"`
|
||||||
|
|
|
@ -59,7 +59,7 @@ func TestTypeItem(t *testing.T) {
|
||||||
"name":"Item",
|
"name":"Item",
|
||||||
"price":"22.99",
|
"price":"22.99",
|
||||||
"currency":"GBP",
|
"currency":"GBP",
|
||||||
"quantity":1
|
"quantity":"1"
|
||||||
}`
|
}`
|
||||||
|
|
||||||
i := &Item{}
|
i := &Item{}
|
||||||
|
@ -71,7 +71,7 @@ func TestTypeItem(t *testing.T) {
|
||||||
if i.Name != "Item" ||
|
if i.Name != "Item" ||
|
||||||
i.Price != "22.99" ||
|
i.Price != "22.99" ||
|
||||||
i.Currency != "GBP" ||
|
i.Currency != "GBP" ||
|
||||||
i.Quantity != 1 {
|
i.Quantity != "1" {
|
||||||
t.Errorf("Item decoded result is incorrect, Given: %v", i)
|
t.Errorf("Item decoded result is incorrect, Given: %v", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user