1
0
mirror of synced 2024-11-28 16:06:04 +03:00

Merge pull request #28 from gwinn/master

Add delivery & payment data for order struct
This commit is contained in:
Alex Lushpai 2018-09-20 11:43:35 +03:00 committed by GitHub
commit ef758f6199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 6 deletions

View File

@ -41,6 +41,14 @@ func main() {
Quoting: ChannelFeatureReceive, Quoting: ChannelFeatureReceive,
Deleting: ChannelFeatureBoth, Deleting: ChannelFeatureBoth,
}, },
Product: Product{
Creating: ChannelFeatureSend,
Deleting: ChannelFeatureSend,
},
Order: Order{
Creating: ChannelFeatureBoth,
Deleting: ChannelFeatureSend,
},
}, },
} }

View File

@ -39,6 +39,14 @@ func New(url string, token string) *MgClient {
// Quoting: ChannelFeatureReceive, // Quoting: ChannelFeatureReceive,
// Deleting: ChannelFeatureSend, // Deleting: ChannelFeatureSend,
// }, // },
// Product: Product{
// Creating: ChannelFeatureSend,
// Deleting: ChannelFeatureSend,
// },
// Order: Order{
// Creating: ChannelFeatureBoth,
// Deleting: ChannelFeatureSend,
// },
// }, // },
// } // }
// //
@ -91,6 +99,14 @@ func (c *MgClient) ActivateTransportChannel(request Channel) (ActivateResponse,
// Quoting: ChannelFeatureReceive, // Quoting: ChannelFeatureReceive,
// Deleting: ChannelFeatureBoth, // Deleting: ChannelFeatureBoth,
// }, // },
// Product: Product{
// Creating: ChannelFeatureSend,
// Deleting: ChannelFeatureSend,
// },
// Order: Order{
// Creating: ChannelFeatureBoth,
// Deleting: ChannelFeatureSend,
// },
// }, // },
// } // }
// //

View File

@ -37,6 +37,14 @@ func TestMgClient_ActivateTransportChannel(t *testing.T) {
Quoting: ChannelFeatureReceive, Quoting: ChannelFeatureReceive,
Deleting: ChannelFeatureBoth, Deleting: ChannelFeatureBoth,
}, },
Product: Product{
Creating: ChannelFeatureSend,
Deleting: ChannelFeatureSend,
},
Order: Order{
Creating: ChannelFeatureBoth,
Deleting: ChannelFeatureSend,
},
}, },
} }
@ -66,6 +74,14 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
Quoting: ChannelFeatureBoth, Quoting: ChannelFeatureBoth,
Deleting: ChannelFeatureSend, Deleting: ChannelFeatureSend,
}, },
Product: Product{
Creating: ChannelFeatureSend,
Deleting: ChannelFeatureSend,
},
Order: Order{
Creating: ChannelFeatureBoth,
Deleting: ChannelFeatureSend,
},
}, },
} }
@ -107,6 +123,14 @@ func TestMgClient_UpdateTransportChannel(t *testing.T) {
Quoting: ChannelFeatureBoth, Quoting: ChannelFeatureBoth,
Deleting: ChannelFeatureBoth, Deleting: ChannelFeatureBoth,
}, },
Product: Product{
Creating: ChannelFeatureSend,
Deleting: ChannelFeatureSend,
},
Order: Order{
Creating: ChannelFeatureBoth,
Deleting: ChannelFeatureSend,
},
}, },
} }

View File

@ -20,6 +20,20 @@ const (
MsgTypeCommand string = "command" MsgTypeCommand string = "command"
MsgTypeOrder string = "order" MsgTypeOrder string = "order"
MsgTypeProduct string = "product" MsgTypeProduct string = "product"
MsgOrderStatusCodeNew = "new"
MsgOrderStatusCodeApproval = "approval"
MsgOrderStatusCodeAssembling = "assembling"
MsgOrderStatusCodeDelivery = "delivery"
MsgOrderStatusCodeComplete = "complete"
MsgOrderStatusCodeCancel = "cancel"
MsgCurrencyRub = "rub"
MsgCurrencyUah = "uah"
MsgCurrencyByr = "byr"
MsgCurrencyKzt = "kzt"
MsgCurrencyUsd = "usd"
MsgCurrencyEur = "eur"
) )
// MgClient type // MgClient type
@ -209,6 +223,8 @@ type MessageDataOrder struct {
Date string `json:"date,omitempty"` Date string `json:"date,omitempty"`
Cost *MessageDataOrderCost `json:"cost,omitempty"` Cost *MessageDataOrderCost `json:"cost,omitempty"`
Status *MessageDataOrderStatus `json:"status,omitempty"` Status *MessageDataOrderStatus `json:"status,omitempty"`
Delivery *MessageDataOrderDelivery `json:"delivery"`
Payments []MessageDataOrderPayment `json:"payment"`
Items []MessageDataOrderItem `json:"items,omitempty"` Items []MessageDataOrderItem `json:"items,omitempty"`
} }
@ -234,6 +250,23 @@ type MessageDataOrderQuantity struct {
Unit string `json:"unit"` Unit string `json:"unit"`
} }
type MessageDataOrderPayment struct {
Name string `json:"name"`
Status *MessageDataOrderPaymentStatus `json:"status"`
Amount *MessageDataOrderCost `json:"amount"`
}
type MessageDataOrderPaymentStatus struct {
Name string `json:"name"`
Payed bool `json:"payed"`
}
type MessageDataOrderDelivery struct {
Name string `json:"name"`
Amount *MessageDataOrderCost `json:"amount"`
Address string `json:"address"`
}
// TransportRequestMeta request metadata // TransportRequestMeta request metadata
type TransportRequestMeta struct { type TransportRequestMeta struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`