Skip to content

Commit

Permalink
Update item struct to match paypal model (#129)
Browse files Browse the repository at this point in the history
* Update item struct to match paypal model

* test
  • Loading branch information
Shadonra authored and roopakv committed Nov 21, 2019
1 parent 5feda2c commit 16c52d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 4 additions & 6 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
8 changes: 2 additions & 6 deletions unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 16c52d3

Please sign in to comment.