From 40533e180544950fcb43b0d72c6f570ee821d455 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Thu, 15 Sep 2022 14:09:54 +0700 Subject: [PATCH 01/13] seller by id --- client/seller.go | 40 ++++++++++++++++++++++++++++++++++++++++ model/seller_request.go | 8 ++++++++ model/seller_response.go | 8 ++++++++ subject/config.go | 2 ++ subject/seller.go | 14 ++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 client/seller.go create mode 100644 model/seller_request.go create mode 100644 model/seller_response.go create mode 100644 subject/seller.go diff --git a/client/seller.go b/client/seller.go new file mode 100644 index 0000000..ec3ab83 --- /dev/null +++ b/client/seller.go @@ -0,0 +1,40 @@ +package client + +import ( + "encoding/json" + "errors" + "github.com/Selly-Modules/natsio" + "github.com/Selly-Modules/natsio/model" + "github.com/Selly-Modules/natsio/subject" +) + +// Seller ... +type Seller struct{} + +// GetSeller ... +func GetSeller() Seller { + return Seller{} +} + +// GetSellerInfoByID ... +func (s Seller) GetSellerInfoByID(p model.GetSellerByIDRequest) (*model.ResponseSellerInfo, error) { + msg, err := natsio.GetServer().Request(subject.Seller.GetSellerInfoByID, toBytes(p)) + if err != nil { + return nil, err + } + + var r struct { + Data *model.ResponseSellerInfo `json:"data"` + Error string `json:"error"` + } + + if err := json.Unmarshal(msg.Data, &r); err != nil { + return nil, err + } + + if r.Error != "" { + return nil, errors.New(r.Error) + } + + return r.Data, nil +} diff --git a/model/seller_request.go b/model/seller_request.go new file mode 100644 index 0000000..997cd97 --- /dev/null +++ b/model/seller_request.go @@ -0,0 +1,8 @@ +package model + +import "go.mongodb.org/mongo-driver/bson/primitive" + +// GetSellerByIDRequest ... +type GetSellerByIDRequest struct { + SellerID primitive.ObjectID `json:"sellerId"` +} diff --git a/model/seller_response.go b/model/seller_response.go new file mode 100644 index 0000000..6b7d698 --- /dev/null +++ b/model/seller_response.go @@ -0,0 +1,8 @@ +package model + +// ResponseSellerInfo ... +type ResponseSellerInfo struct { + ID string `json:"id"` + Name string `json:"name"` + Code string `json:"code"` +} diff --git a/subject/config.go b/subject/config.go index dfeea56..cb215bc 100644 --- a/subject/config.go +++ b/subject/config.go @@ -6,10 +6,12 @@ var prefixes = struct { Warehouse string Location string Supplier string + Seller string }{ Communication: "communication", Order: "order", Warehouse: "warehouse", Location: "location", Supplier: "supplier", + Seller: "seller", } diff --git a/subject/seller.go b/subject/seller.go new file mode 100644 index 0000000..033f993 --- /dev/null +++ b/subject/seller.go @@ -0,0 +1,14 @@ +package subject + +import "fmt" + +func getSellerValue(val string) string { + return fmt.Sprintf("%s.%s", prefixes.Seller, val) +} + +// Seller ... +var Seller = struct { + GetSellerInfoByID string +}{ + GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), +} From 89967955ea2af42c918b213a4183f2d3a471db93 Mon Sep 17 00:00:00 2001 From: phuanbui Date: Mon, 19 Sep 2022 11:48:30 +0700 Subject: [PATCH 02/13] get list seller by ids --- client/seller.go | 25 +++++++++++++++++++++++++ model/seller_request.go | 5 +++++ model/seller_response.go | 5 +++++ subject/seller.go | 6 ++++-- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/client/seller.go b/client/seller.go index ec3ab83..5944bdb 100644 --- a/client/seller.go +++ b/client/seller.go @@ -3,6 +3,7 @@ package client import ( "encoding/json" "errors" + "github.com/Selly-Modules/natsio" "github.com/Selly-Modules/natsio/model" "github.com/Selly-Modules/natsio/subject" @@ -38,3 +39,27 @@ func (s Seller) GetSellerInfoByID(p model.GetSellerByIDRequest) (*model.Response return r.Data, nil } + +// GetListSellerInfoByIDs ... +func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*model.ResponseListSellerInfo, error) { + msg, err := natsio.GetServer().Request(subject.Seller.GetListSellerInfoByIDs, toBytes(p)) + + if err != nil { + return nil, err + } + + var r struct { + Data *model.ResponseListSellerInfo `json:"data"` + Error string `json:"error"` + } + + if err := json.Unmarshal(msg.Data, &r); err != nil { + return nil, err + } + + if r.Error != "" { + return nil, errors.New(r.Error) + + } + return r.Data, nil +} diff --git a/model/seller_request.go b/model/seller_request.go index 997cd97..29732b9 100644 --- a/model/seller_request.go +++ b/model/seller_request.go @@ -6,3 +6,8 @@ import "go.mongodb.org/mongo-driver/bson/primitive" type GetSellerByIDRequest struct { SellerID primitive.ObjectID `json:"sellerId"` } + +// GetListSellerByIDsRequest ... +type GetListSellerByIDsRequest struct { + SellerIDs []primitive.ObjectID `json:"sellerIds"` +} diff --git a/model/seller_response.go b/model/seller_response.go index 6b7d698..5dd5271 100644 --- a/model/seller_response.go +++ b/model/seller_response.go @@ -6,3 +6,8 @@ type ResponseSellerInfo struct { Name string `json:"name"` Code string `json:"code"` } + +// ResponseListSellerInfo ... +type ResponseListSellerInfo struct { + Sellers []ResponseSellerInfo `json:"sellers"` +} diff --git a/subject/seller.go b/subject/seller.go index 033f993..ab3ac20 100644 --- a/subject/seller.go +++ b/subject/seller.go @@ -8,7 +8,9 @@ func getSellerValue(val string) string { // Seller ... var Seller = struct { - GetSellerInfoByID string + GetSellerInfoByID string + GetListSellerInfoByIDs string }{ - GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), + GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), + GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), } From 35a811886b1113bda8683c1063da558766ae49ac Mon Sep 17 00:00:00 2001 From: phuanbui Date: Mon, 19 Sep 2022 14:52:26 +0700 Subject: [PATCH 03/13] edit type id --- model/seller_response.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/seller_response.go b/model/seller_response.go index 5dd5271..21f2693 100644 --- a/model/seller_response.go +++ b/model/seller_response.go @@ -2,7 +2,7 @@ package model // ResponseSellerInfo ... type ResponseSellerInfo struct { - ID string `json:"id"` + ID string `json:"_id"` Name string `json:"name"` Code string `json:"code"` } From 583f2abda5476a5b6f8c92f7b9e678eb663242e6 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Wed, 21 Sep 2022 10:19:17 +0700 Subject: [PATCH 04/13] get seller info support chat --- client/seller.go | 23 ++++++++++++++ model/seller_request.go | 5 +++ model/seller_response.go | 68 ++++++++++++++++++++++++++++++++++++++++ subject/seller.go | 10 +++--- 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/client/seller.go b/client/seller.go index 5944bdb..56a9d7c 100644 --- a/client/seller.go +++ b/client/seller.go @@ -63,3 +63,26 @@ func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*mode } return r.Data, nil } + +// GetListSellerInfoSupportChatByIDs ... +func (s Seller) GetListSellerInfoSupportChatByIDs(p model.GetListSellerSupportChatByIDsRequest) (*model.ResponseListSellerInfoSupportChat, error) { + msg, err := natsio.GetServer().Request(subject.Seller.GetListSellerInfoSupportChatByIDs, toBytes(p)) + if err != nil { + return nil, err + } + + var r struct { + Data *model.ResponseListSellerInfoSupportChat `json:"data"` + Error string `json:"error"` + } + + if err := json.Unmarshal(msg.Data, &r); err != nil { + return nil, err + } + + if r.Error != "" { + return nil, errors.New(r.Error) + + } + return r.Data, nil +} diff --git a/model/seller_request.go b/model/seller_request.go index 29732b9..a54996c 100644 --- a/model/seller_request.go +++ b/model/seller_request.go @@ -11,3 +11,8 @@ type GetSellerByIDRequest struct { type GetListSellerByIDsRequest struct { SellerIDs []primitive.ObjectID `json:"sellerIds"` } + +// GetListSellerSupportChatByIDsRequest ... +type GetListSellerSupportChatByIDsRequest struct { + SellerIDs []primitive.ObjectID `json:"sellerIds"` +} diff --git a/model/seller_response.go b/model/seller_response.go index 21f2693..aec57b9 100644 --- a/model/seller_response.go +++ b/model/seller_response.go @@ -1,5 +1,7 @@ package model +import "time" + // ResponseSellerInfo ... type ResponseSellerInfo struct { ID string `json:"_id"` @@ -11,3 +13,69 @@ type ResponseSellerInfo struct { type ResponseListSellerInfo struct { Sellers []ResponseSellerInfo `json:"sellers"` } + +// ResponseListSellerInfoSupportChat ... +type ResponseListSellerInfoSupportChat struct { + Sellers []ResponseSellerInfoSupportChat `json:"sellers"` +} + +// ResponseSellerInfoSupportChat ... +type ResponseSellerInfoSupportChat struct { + ID string `json:"_id"` + Name string `json:"name"` + Code string `json:"code"` + Membership SellerMembershipInfo `json:"membership"` + Info SellerContactInfo `json:"info"` + Team *TeamInfo `json:"team,omitempty"` + Statistic SellerStatistic `json:"statistic"` + TrackingTime *SellerTrackingTime `json:"trackingTime"` + Invitee *InviteeInfo `json:"invitee"` + CreatedAt time.Time `json:"createdAt"` +} + +// SellerTrackingTime ... +type SellerTrackingTime struct { + FirstOrderDeliveredAt time.Time `json:"firstOrderDeliveredAt,omitempty"` + ThirdOrderDeliveredAt time.Time `json:"thirdOrderDeliveredAt,omitempty"` +} + +// SellerStatistic ... +type SellerStatistic struct { + ThisMonthSale float64 `bson:"thisMonthSale" json:"thisMonthSale"` + LastMonthSale float64 `bson:"lastMonthSale" json:"lastMonthSale"` + Sale float64 `bson:"sale" json:"sale"` + TransactionTotal int `json:"transactionTotal"` + TransactionPaymentProcessing int `json:"transactionPaymentProcessing"` + TransactionWaitingApprove int `json:"transactionWaitingApprove"` + TransactionPending int `json:"transactionPending"` + TransactionSuccess int `json:"transactionSuccess"` + TransactionRejected int `json:"transactionRejected"` + TransactionDelivering int `json:"transactionDelivering"` + TransactionDelivered int `json:"transactionDelivered"` +} + +// TeamInfo ... +type TeamInfo struct { + ID string `json:"_id"` + Name string `json:"name"` + Role string `json:"role"` +} + +// InviteeInfo ... +type InviteeInfo struct { + ID string `json:"_id"` + Name string `json:"name"` +} + +// SellerContactInfo ... +type SellerContactInfo struct { + City int `json:"cityCode"` + CityName string `json:"cityName"` + Gender string `json:"gender"` +} + +// SellerMembershipInfo ... +type SellerMembershipInfo struct { + Level int `json:"level"` + Name string `json:"name"` +} diff --git a/subject/seller.go b/subject/seller.go index ab3ac20..6ef730e 100644 --- a/subject/seller.go +++ b/subject/seller.go @@ -8,9 +8,11 @@ func getSellerValue(val string) string { // Seller ... var Seller = struct { - GetSellerInfoByID string - GetListSellerInfoByIDs string + GetSellerInfoByID string + GetListSellerInfoByIDs string + GetListSellerInfoSupportChatByIDs string }{ - GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), - GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), + GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), + GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), + GetListSellerInfoSupportChatByIDs: getSellerValue("get_list_seller_info_support_chat_by_ids"), } From 4ac7ec3b0ceb1a29519d680da717ec5547c4652f Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Thu, 22 Sep 2022 13:49:11 +0700 Subject: [PATCH 05/13] support chat get seller info --- client/seller.go | 2 +- subject/seller.go | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/seller.go b/client/seller.go index 56a9d7c..1d06208 100644 --- a/client/seller.go +++ b/client/seller.go @@ -66,7 +66,7 @@ func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*mode // GetListSellerInfoSupportChatByIDs ... func (s Seller) GetListSellerInfoSupportChatByIDs(p model.GetListSellerSupportChatByIDsRequest) (*model.ResponseListSellerInfoSupportChat, error) { - msg, err := natsio.GetServer().Request(subject.Seller.GetListSellerInfoSupportChatByIDs, toBytes(p)) + msg, err := natsio.GetServer().Request(subject.SupportChat.GetListSellerInfoSupportChatByIDs, toBytes(p)) if err != nil { return nil, err } diff --git a/subject/seller.go b/subject/seller.go index 6ef730e..eba9131 100644 --- a/subject/seller.go +++ b/subject/seller.go @@ -8,11 +8,16 @@ func getSellerValue(val string) string { // Seller ... var Seller = struct { - GetSellerInfoByID string - GetListSellerInfoByIDs string + GetSellerInfoByID string + GetListSellerInfoByIDs string +}{ + GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), + GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), +} + +// SupportChat ... +var SupportChat = struct { GetListSellerInfoSupportChatByIDs string }{ - GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), - GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), - GetListSellerInfoSupportChatByIDs: getSellerValue("get_list_seller_info_support_chat_by_ids"), + GetListSellerInfoSupportChatByIDs: "SELLY_CHAT.REQUEST.SELLER_INFO", } From b718162cd439fd67487b695f48d4a9f7f90a4469 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 10:13:14 +0700 Subject: [PATCH 06/13] jestream-push-notification --- jestream/config.go | 8 ++++++++ jestream/notification.go | 8 ++++++++ model/notification_request.go | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 jestream/config.go create mode 100644 jestream/notification.go create mode 100644 model/notification_request.go diff --git a/jestream/config.go b/jestream/config.go new file mode 100644 index 0000000..41d28bb --- /dev/null +++ b/jestream/config.go @@ -0,0 +1,8 @@ +package jestream + +// StreamConfig ... +var StreamConfig = struct { + Notification string +}{ + Notification: "Service_Notification", +} diff --git a/jestream/notification.go b/jestream/notification.go new file mode 100644 index 0000000..fe48a8b --- /dev/null +++ b/jestream/notification.go @@ -0,0 +1,8 @@ +package jestream + +// SubjectNotification ... +var SubjectNotification = struct { + PushNotifications string +}{ + PushNotifications: "selly.pull.notification.push_notifications", +} diff --git a/model/notification_request.go b/model/notification_request.go new file mode 100644 index 0000000..ed2c36c --- /dev/null +++ b/model/notification_request.go @@ -0,0 +1,14 @@ +package model + +// PayloadPushNotification ... +type PayloadPushNotification struct { + User string `json:"user"` + Type string `json:"type"` + TargetId string `json:"targetId"` + IsFromAdmin bool `json:"isFromAdmin"` + Category string `json:"category"` + Options struct { + Title string `json:"title"` + Content string `json:"content"` + } `json:"options"` +} From f80f89e79396a477b721814ac8be0e19922d4928 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 11:17:03 +0700 Subject: [PATCH 07/13] jestream --- jestream/config.go | 8 -------- jestream/notification.go | 8 -------- .../model/selly.go | 8 ++++---- js/subject/config.go | 10 ++++++++++ js/subject/selly.go | 19 +++++++++++++++++++ 5 files changed, 33 insertions(+), 20 deletions(-) delete mode 100644 jestream/config.go delete mode 100644 jestream/notification.go rename model/notification_request.go => js/model/selly.go (68%) create mode 100644 js/subject/config.go create mode 100644 js/subject/selly.go diff --git a/jestream/config.go b/jestream/config.go deleted file mode 100644 index 41d28bb..0000000 --- a/jestream/config.go +++ /dev/null @@ -1,8 +0,0 @@ -package jestream - -// StreamConfig ... -var StreamConfig = struct { - Notification string -}{ - Notification: "Service_Notification", -} diff --git a/jestream/notification.go b/jestream/notification.go deleted file mode 100644 index fe48a8b..0000000 --- a/jestream/notification.go +++ /dev/null @@ -1,8 +0,0 @@ -package jestream - -// SubjectNotification ... -var SubjectNotification = struct { - PushNotifications string -}{ - PushNotifications: "selly.pull.notification.push_notifications", -} diff --git a/model/notification_request.go b/js/model/selly.go similarity index 68% rename from model/notification_request.go rename to js/model/selly.go index ed2c36c..053a3be 100644 --- a/model/notification_request.go +++ b/js/model/selly.go @@ -1,10 +1,10 @@ -package model +package jsmodel -// PayloadPushNotification ... -type PayloadPushNotification struct { +// PushNotification ... +type PushNotification struct { User string `json:"user"` Type string `json:"type"` - TargetId string `json:"targetId"` + TargetID string `json:"targetId"` IsFromAdmin bool `json:"isFromAdmin"` Category string `json:"category"` Options struct { diff --git a/js/subject/config.go b/js/subject/config.go new file mode 100644 index 0000000..3f77205 --- /dev/null +++ b/js/subject/config.go @@ -0,0 +1,10 @@ +package jssubject + +var root = "js" + +// prefixes ... +var prefixes = struct { + Selly string +}{ + Selly: "selly", +} diff --git a/js/subject/selly.go b/js/subject/selly.go new file mode 100644 index 0000000..e6a344b --- /dev/null +++ b/js/subject/selly.go @@ -0,0 +1,19 @@ +package jssubject + +import ( + "fmt" +) + +// getSellyValue ... +func getSellyValue(val string) string { + return fmt.Sprintf("%s.%s.%s", root, prefixes.Selly, val) +} + +// Selly ... +var Selly = struct { + Stream string + PushNotification string +}{ + Stream: prefixes.Selly, + PushNotification: getSellyValue("push_notifications"), +} From 047037f12303c601b49fa7431eb311901c48c176 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 11:57:19 +0700 Subject: [PATCH 08/13] stream name --- jestream_name.go | 4 ++++ js/subject/selly.go | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 jestream_name.go diff --git a/jestream_name.go b/jestream_name.go new file mode 100644 index 0000000..1f2ea4d --- /dev/null +++ b/jestream_name.go @@ -0,0 +1,4 @@ +package natsio + +// StreamNameSelly ... +const StreamNameSelly = "selly" diff --git a/js/subject/selly.go b/js/subject/selly.go index e6a344b..bdd4ce8 100644 --- a/js/subject/selly.go +++ b/js/subject/selly.go @@ -11,9 +11,7 @@ func getSellyValue(val string) string { // Selly ... var Selly = struct { - Stream string PushNotification string }{ - Stream: prefixes.Selly, PushNotification: getSellyValue("push_notifications"), } From 547b3b8dd911df5bb2664e8374d4a96b6874ef7b Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 14:47:00 +0700 Subject: [PATCH 09/13] update js stream --- js/consumer/selly.go | 8 ++++++++ js/model/selly.go | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 js/consumer/selly.go diff --git a/js/consumer/selly.go b/js/consumer/selly.go new file mode 100644 index 0000000..380927c --- /dev/null +++ b/js/consumer/selly.go @@ -0,0 +1,8 @@ +package jsconsumer + +// Selly ... +var Selly = struct { + PushNotification string +}{ + PushNotification: "PULL_PUSH_NOTIFICATION", +} diff --git a/js/model/selly.go b/js/model/selly.go index 053a3be..ab8d021 100644 --- a/js/model/selly.go +++ b/js/model/selly.go @@ -2,13 +2,16 @@ package jsmodel // PushNotification ... type PushNotification struct { - User string `json:"user"` - Type string `json:"type"` - TargetID string `json:"targetId"` - IsFromAdmin bool `json:"isFromAdmin"` - Category string `json:"category"` - Options struct { - Title string `json:"title"` - Content string `json:"content"` - } `json:"options"` + User string `json:"user"` + Type string `json:"type"` + TargetID string `json:"targetId"` + IsFromAdmin bool `json:"isFromAdmin"` + Category string `json:"category"` + Options NotificationOptions `json:"options"` +} + +// NotificationOptions ... +type NotificationOptions struct { + Title string `json:"title"` + Content string `json:"content"` } From d9763edd75d48c0d20b7ce5aff940b47fb44eb67 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 22:11:24 +0700 Subject: [PATCH 10/13] pull js seller affiliate statistic --- js/consumer/selly.go | 6 ++++-- js/model/selly.go | 19 +++++++++++++++++++ js/subject/selly.go | 6 ++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/js/consumer/selly.go b/js/consumer/selly.go index 380927c..b13c5f6 100644 --- a/js/consumer/selly.go +++ b/js/consumer/selly.go @@ -2,7 +2,9 @@ package jsconsumer // Selly ... var Selly = struct { - PushNotification string + PushNotification string + UpdateSellerStatistic string }{ - PushNotification: "PULL_PUSH_NOTIFICATION", + PushNotification: "PULL_PUSH_NOTIFICATION", + UpdateSellerStatistic: "PULL_UPDATE_SELLER_STATISTIC", } diff --git a/js/model/selly.go b/js/model/selly.go index ab8d021..412e62d 100644 --- a/js/model/selly.go +++ b/js/model/selly.go @@ -15,3 +15,22 @@ type NotificationOptions struct { Title string `json:"title"` Content string `json:"content"` } + +// PayloadUpdateSellerAffiliateStatistic ... +type PayloadUpdateSellerAffiliateStatistic struct { + SellerID string `json:"sellerId"` + Statistic SellerAffiliateStatistic `json:"statistic"` +} + +// SellerAffiliateStatistic ... +type SellerAffiliateStatistic struct { + TransactionTotal int `json:"transactionTotal"` + TransactionCashback int `json:"transactionCashback"` + TransactionPending int `json:"transactionPending"` + TransactionApproved int `json:"transactionApproved"` + TransactionRejected int `json:"transactionRejected"` + CommissionTransactionTotal float64 `json:"commissionTransactionTotal"` + CommissionTransactionCashback float64 `json:"commissionTransactionCashback"` + CommissionTransactionApproved float64 `json:"commissionTransactionApproved"` + CommissionTransactionRejected float64 `json:"commissionTransactionRejected"` +} diff --git a/js/subject/selly.go b/js/subject/selly.go index bdd4ce8..204e781 100644 --- a/js/subject/selly.go +++ b/js/subject/selly.go @@ -11,7 +11,9 @@ func getSellyValue(val string) string { // Selly ... var Selly = struct { - PushNotification string + PushNotification string + UpdateSellerStatistic string }{ - PushNotification: getSellyValue("push_notifications"), + PushNotification: getSellyValue("push_notifications"), + UpdateSellerStatistic: getSellyValue("update_seller_statistic"), } From 68b9cab1e2f9733947cf3709f54ee0ae53289f04 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 22:11:28 +0700 Subject: [PATCH 11/13] pull js seller affiliate statistic --- js/consumer/selly.go | 8 ++++---- js/subject/selly.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/consumer/selly.go b/js/consumer/selly.go index b13c5f6..0305c7c 100644 --- a/js/consumer/selly.go +++ b/js/consumer/selly.go @@ -2,9 +2,9 @@ package jsconsumer // Selly ... var Selly = struct { - PushNotification string - UpdateSellerStatistic string + PushNotification string + UpdateSellerAffiliateStatistic string }{ - PushNotification: "PULL_PUSH_NOTIFICATION", - UpdateSellerStatistic: "PULL_UPDATE_SELLER_STATISTIC", + PushNotification: "PULL_PUSH_NOTIFICATION", + UpdateSellerAffiliateStatistic: "PULL_UPDATE_SELLER_AFFILIATE_STATISTIC", } diff --git a/js/subject/selly.go b/js/subject/selly.go index 204e781..71ca355 100644 --- a/js/subject/selly.go +++ b/js/subject/selly.go @@ -11,9 +11,9 @@ func getSellyValue(val string) string { // Selly ... var Selly = struct { - PushNotification string - UpdateSellerStatistic string + PushNotification string + UpdateSellerAffiliateStatistic string }{ - PushNotification: getSellyValue("push_notifications"), - UpdateSellerStatistic: getSellyValue("update_seller_statistic"), + PushNotification: getSellyValue("push_notifications"), + UpdateSellerAffiliateStatistic: getSellyValue("update_seller_affiliate_statistic"), } From dcea3798f881cc096b5c6c3e51cad6d186e58ea6 Mon Sep 17 00:00:00 2001 From: Nguyen Minh Date: Fri, 23 Sep 2022 23:32:23 +0700 Subject: [PATCH 12/13] js cashflow seller --- js/consumer/selly.go | 2 ++ js/model/selly.go | 23 +++++++++++++++++++++++ js/subject/selly.go | 2 ++ 3 files changed, 27 insertions(+) diff --git a/js/consumer/selly.go b/js/consumer/selly.go index 0305c7c..975cb5b 100644 --- a/js/consumer/selly.go +++ b/js/consumer/selly.go @@ -4,7 +4,9 @@ package jsconsumer var Selly = struct { PushNotification string UpdateSellerAffiliateStatistic string + CheckAnDInsertCashflowBySeller string }{ PushNotification: "PULL_PUSH_NOTIFICATION", UpdateSellerAffiliateStatistic: "PULL_UPDATE_SELLER_AFFILIATE_STATISTIC", + CheckAnDInsertCashflowBySeller: "PULL_CHECK_AND_INSERT_CASHFLOW_BY_SELLER", } diff --git a/js/model/selly.go b/js/model/selly.go index 412e62d..c521660 100644 --- a/js/model/selly.go +++ b/js/model/selly.go @@ -34,3 +34,26 @@ type SellerAffiliateStatistic struct { CommissionTransactionApproved float64 `json:"commissionTransactionApproved"` CommissionTransactionRejected float64 `json:"commissionTransactionRejected"` } + +// PayloadCashflowsBySeller ... +type PayloadCashflowsBySeller struct { + SellerID string `json:"sellerId"` + List []CashflowSeller `json:"list"` +} + +// CashflowSeller ... +type CashflowSeller struct { + Value float64 `json:"value"` + Action string `json:"action"` + Category string `json:"category"` + TargetID string `json:"targetId"` + TargetType string `json:"targetType"` + Options *CashFlowOptions `json:"options"` +} + +// CashFlowOptions ... +type CashFlowOptions struct { + AffiliateTransactionCode string `json:"affiliateTransactionCode,omitempty"` + AffiliateCampaignID string `json:"affiliateCampaignId,omitempty"` + AffiliateCampaignName string `json:"affiliateCampaignName,omitempty"` +} diff --git a/js/subject/selly.go b/js/subject/selly.go index 71ca355..2f665bb 100644 --- a/js/subject/selly.go +++ b/js/subject/selly.go @@ -13,7 +13,9 @@ func getSellyValue(val string) string { var Selly = struct { PushNotification string UpdateSellerAffiliateStatistic string + CheckAnDInsertCashflowBySeller string }{ PushNotification: getSellyValue("push_notifications"), UpdateSellerAffiliateStatistic: getSellyValue("update_seller_affiliate_statistic"), + CheckAnDInsertCashflowBySeller: getSellyValue("check_and_insert_cashflow_statistic"), } From e6b620ca6c97a067ca94f48d6187a50b0ccb52fc Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Fri, 30 Sep 2022 10:29:14 +0700 Subject: [PATCH 13/13] CommissionTransactionPending --- js/model/selly.go | 1 + 1 file changed, 1 insertion(+) diff --git a/js/model/selly.go b/js/model/selly.go index c521660..a8e0a60 100644 --- a/js/model/selly.go +++ b/js/model/selly.go @@ -32,6 +32,7 @@ type SellerAffiliateStatistic struct { CommissionTransactionTotal float64 `json:"commissionTransactionTotal"` CommissionTransactionCashback float64 `json:"commissionTransactionCashback"` CommissionTransactionApproved float64 `json:"commissionTransactionApproved"` + CommissionTransactionPending float64 `json:"commissionTransactionPending"` CommissionTransactionRejected float64 `json:"commissionTransactionRejected"` }