mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
Update item struct to match paypal model (#129)
* Update item struct to match paypal model * test
This commit is contained in:
parent
5feda2cf5e
commit
16c52d39ba
10
types.go
10
types.go
|
@ -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"`
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user