Skip to content

Commit

Permalink
Add return_to and failed_return_to config for mixpay
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh authored and lyricat committed Mar 23, 2023
1 parent f2fadb3 commit 95ff537
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/httpd/httpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func NewCmdHttpd() *cobra.Command {
QuoteAssetId: cfg.Mixpay.QuoteAssetId,
SettlementAssetId: cfg.Mixpay.SettlementAssetId,
CallbackUrl: cfg.Mixpay.CallbackUrl,
ReturnTo: cfg.Mixpay.ReturnTo,
FailedReturnTo: cfg.Mixpay.FailedReturnTo,
}, orders, userz, mixpayClient)
hub := chanhub.New()
// var userz core.UserService
Expand Down
2 changes: 2 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ mixpay:
quote_asset_id: "31d2ea9c-95eb-3355-b65b-ba096853bc18"
settlement_asset_id: "31d2ea9c-95eb-3355-b65b-ba096853bc18"
callback_url: "$API_HOST/api/callback/mixpay"
return_to: ""
failed_return_to: ""

order_syncer:
interval: 1s
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type Mixpay struct {
QuoteAssetId string `yaml:"quote_asset_id"`
SettlementAssetId string `yaml:"settlement_asset_id"`
CallbackUrl string `yaml:"callback_url"`
ReturnTo string `yaml:"return_to"`
FailedReturnTo string `yaml:"failed_return_to"`
}

type Milvus struct {
Expand Down
4 changes: 4 additions & 0 deletions service/order/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type (
QuoteAssetId string
SettlementAssetId string
CallbackUrl string
ReturnTo string
FailedReturnTo string
}

service struct {
Expand Down Expand Up @@ -60,6 +62,8 @@ func (s *service) CreateMixpayOrder(ctx context.Context, userId uint64, amount d
OrderId: orderId,
TraceId: traceId,
CallbackUrl: s.cfg.CallbackUrl,
ReturnTo: s.cfg.ReturnTo,
FailedReturnTo: s.cfg.FailedReturnTo,
})
if err != nil {
return "", err
Expand Down

0 comments on commit 95ff537

Please sign in to comment.