Update item struct to match paypal model (#129)

* Update item struct to match paypal model

* test
This commit is contained in:
Eric Lee 2019-11-20 22:12:36 -08:00 committed by Roopak Venkatakrishnan
parent 5feda2cf5e
commit 16c52d39ba
2 changed files with 6 additions and 12 deletions

View File

@ -416,14 +416,12 @@ type (
// Item struct
Item struct {
Quantity uint32 `json:"quantity"`
Name string `json:"name"`
Price string `json:"price"`
Currency string `json:"currency"`
SKU string `json:"sku,omitempty"`
Description string `json:"description,omitempty"`
Tax string `json:"tax,omitempty"`
UnitAmount *Money `json:"unit_amount,omitempty"`
Tax *Money `json:"tax,omitempty"`
Quantity string `json:"quantity"`
Description string `json:"description,omitempty"`
SKU string `json:"sku,omitempty"`
Category string `json:"category,omitempty"`
}

View File

@ -57,9 +57,7 @@ func TestTypeUserInfo(t *testing.T) {
func TestTypeItem(t *testing.T) {
response := `{
"name":"Item",
"price":"22.99",
"currency":"GBP",
"quantity":1
"quantity":"1"
}`
i := &Item{}
@ -69,9 +67,7 @@ func TestTypeItem(t *testing.T) {
}
if i.Name != "Item" ||
i.Price != "22.99" ||
i.Currency != "GBP" ||
i.Quantity != 1 {
i.Quantity != "1" {
t.Errorf("Item decoded result is incorrect, Given: %v", i)
}
}