conf

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package conf 包含微信 sdk 各类配置信息.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultConfig

type DefaultConfig struct {
	// AppID 微信应用(公众号/小程序...) app id
	AppID string
	// MchID 微信支付商户号
	MchID string
	// MchKey 微信支付密钥
	MchKey string
}

DefaultConfig 是默认配置,它实现多个子模块的配置接口

func (*DefaultConfig) SelectMch

func (config *DefaultConfig) SelectMch(appID, mchID string) (MchConfig, error)

SelectMch 实现 MchConfigSelector 接口

func (*DefaultConfig) WechatAppID

func (config *DefaultConfig) WechatAppID() string

WechatAppID 返回微信应用(公众号/小程序...) app id

func (*DefaultConfig) WechatMchID

func (config *DefaultConfig) WechatMchID() string

WechatMchID 返回微信支付商户号

func (*DefaultConfig) WechatMchKey

func (config *DefaultConfig) WechatMchKey() string

WechatMchKey 返回微信支付密钥

type MchConfig

type MchConfig interface {
	// WechatAppID 返回微信应用(公众号/小程序...) app id
	WechatAppID() string

	// WechatMchID 返回微信支付商户号
	WechatMchID() string

	// WechatMchKey 返回微信支付密钥
	WechatMchKey() string
}

MchConfig 包含微信支付接口所必须的配置信息

type MchConfigSelector

type MchConfigSelector interface {
	// SelectMch 通过 appID 和 mchID 查找对应配置,若找不到应该返回 nil
	SelectMch(appID, mchID string) (MchConfig, error)
}

MchConfigSelector 用于选择微信支付配置

Jump to

Keyboard shortcuts

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