wx_chain

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Initialize

func Initialize(p InitConfig) (*Client, error)

func (*Client) ApplyRefund

func (c *Client) ApplyRefund(txID, refundID, reason string, amount int64) (RespApplyRefund, error)

func (*Client) CloseOrder

func (c *Client) CloseOrder(txID string) error

func (*Client) CreateOrder

func (c *Client) CreateOrder(orderId, description string, amount int64) (RespCreateOrder, error)

func (*Client) CreateOrderH5

func (c *Client) CreateOrderH5(orderId, description, clientIP string, amount int64) (RespCreateOrder, error)

func (*Client) OrderNotifyResolve

func (c *Client) OrderNotifyResolve(notify PayNotify) (OrderNotifyData, error)

func (*Client) QueryOrder

func (c *Client) QueryOrder(orderId string) (RespQueryOrder, error)

func (*Client) QueryRefund

func (c *Client) QueryRefund(refundId string) (RespApplyRefund, error)

func (*Client) RefundNotifyResolve

func (c *Client) RefundNotifyResolve(notify PayNotify) (RefundNotifyData, error)

type InitConfig

type InitConfig struct {
	MchID                 string
	MchCertSerialNumber   string
	PrivateKeyPath        string
	WechatCertificatePath string
	AppID                 string
	ApiV3Key              string
	NotifyUrl             string
	Dev                   bool
}

type OrderNotifyData

type OrderNotifyData struct {
	AppID         string `json:"appid"`
	MchID         string `json:"mchid"`
	OutTradeNo    string `json:"out_trade_no"`
	TransactionId string `json:"transaction_id"`
	TradeType     string `json:"trade_type"`
	TradeState    string `json:"trade_state"`
	BankType      string `json:"bank_type"`
	SuccessTime   string `json:"success_time"`
	Payer         struct {
		Openid string `json:"openid"`
	} `json:"payer"`
	Amount struct {
		Total         int64  `json:"total"`
		PayerTotal    int64  `json:"payer_total"`
		Currency      string `json:"currency"`
		PayerCurrency string `json:"payer_currency"`
	} `json:"amount"`
}

type PayNotify

type PayNotify struct {
	ID           string `json:"id"`
	CreateTime   string `json:"create_time"`
	ResourceType string `json:"resource_type"`
	EventType    string `json:"event_type"`
	Resource     struct {
		Algorithm      string `json:"algorithm"`
		Ciphertext     string `json:"ciphertext"`
		Nonce          string `json:"nonce"`
		OriginalType   string `json:"original_type"`
		AssociatedData string `json:"associated_data"`
	} `json:"resource"`
	Summary string `json:"summary"`
}

type RefundNotifyData

type RefundNotifyData struct {
	MchID               string `json:"mchid"`
	TransactionId       string `json:"transaction_id"`
	OutTradeNo          string `json:"out_trade_no"`
	RefundID            string `json:"refund_id"`
	OutRefundNo         string `json:"out_refund_no"`
	RefundStatus        string `json:"refund_status"`
	SuccessTime         string `json:"success_time"`
	UserReceivedAccount string `json:"user_received_account"`
	Amount              struct {
		Total       int64 `json:"total"`
		PayerTotal  int64 `json:"payer_total"`
		Refund      int64 `json:"refund"`
		PayerRefund int64 `json:"payer_refund"`
	} `json:"amount"`
}

type RespApplyRefund

type RespApplyRefund struct {
	Amount struct {
		Currency         string `json:"currency"`
		DiscountRefund   int64  `json:"discount_refund"`
		PayerRefund      int64  `json:"payer_refund"`
		PayerTotal       int64  `json:"payer_total"`
		Refund           int64  `json:"refund"`
		SettlementRefund int64  `json:"settlement_refund"`
		SettlementTotal  int64  `json:"settlement_total"`
		Total            int64  `json:"total"`
	} `json:"amount"`
	Channel             string `json:"channel"`
	CreateTime          string `json:"create_time"`
	FundsAccount        string `json:"funds_account"`
	OutRefundNo         string `json:"out_refund_no"`
	OutTradeNo          string `json:"out_trade_no"`
	RefundId            string `json:"refund_id"`
	Status              string `json:"status"`
	TransactionId       string `json:"transaction_id"`
	UserReceivedAccount string `json:"user_received_account"`
}

type RespCreateOrder

type RespCreateOrder struct {
	CodeUrl string `json:"code_url"`
	H5Url   string `json:"h5_url"`
}

type RespQueryOrder

type RespQueryOrder struct {
	OutTradeNo     string `json:"out_trade_no"`
	TransactionId  string `json:"transaction_id"`
	TradeType      string `json:"trade_type"`
	TradeStateDesc string `json:"trade_state_desc"`
	TradeState     string `json:"trade_state"`
	SuccessTime    string `json:"success_time"`
	Payer          struct {
		Openid string `json:"openid"`
	} `json:"payer"`
	MchId    string `json:"mchid"`
	BankType string `json:"bank_type"`
	AppId    string `json:"appid"`
	Attach   string `json:"attach"`
	Amount   struct {
		Currency      string `json:"currency"`
		PayerCurrency string `json:"payer_currency"`
		PayerTotal    int64  `json:"payer_total"`
		Total         int64  `json:"total"`
	} `json:"amount"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL