From 561690178b516af510311caba2b35c17e1bdb45c Mon Sep 17 00:00:00 2001 From: tungquach Date: Sun, 21 Apr 2019 11:43:53 +0700 Subject: [PATCH] update order struct, add purchase units --- types.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/types.go b/types.go index c9fcf66..345862a 100644 --- a/types.go +++ b/types.go @@ -94,12 +94,6 @@ type ( Value string `json:"value"` } - // GrossTotalAmount struct - GrossTotalAmount struct { - Value string `json:"value"` - Currency string `json:"currency"` - } - // ApplicationContext struct ApplicationContext struct { BrandName string `json:"brand_name"` @@ -319,6 +313,18 @@ type ( Enctype string `json:"enctype,omitempty"` } + // PurchaseUnitAmount struct + PurchaseUnitAmount struct { + Currency string `json:"currency_code"` + Value string `json:"value"` + } + + // PurchaseUnit struct + PurchaseUnit struct { + ReferenceID string `json:"reference_id"` + Amount *PurchaseUnitAmount `json:"amount,omitempty"` + } + // MerchantPreferences struct MerchantPreferences struct { SetupFee *AmountPayout `json:"setup_fee,omitempty"` @@ -331,13 +337,13 @@ type ( // Order struct Order struct { - ID string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - Intent string `json:"intent,omitempty"` - GrossTotalAmount *GrossTotalAmount `json:"gross_total_amount,omitempty"` - Links []Link `json:"links,omitempty"` - CreateTime *time.Time `json:"create_time,omitempty"` - UpdateTime *time.Time `json:"update_time,omitempty"` + ID string `json:"id,omitempty"` + Status string `json:"status,omitempty"` + Intent string `json:"intent,omitempty"` + PurchaseUnits []PurchaseUnit `json:"purchase_units,omitempty"` + Links []Link `json:"links,omitempty"` + CreateTime *time.Time `json:"create_time,omitempty"` + UpdateTime *time.Time `json:"update_time,omitempty"` } // Payer struct