yunaccount

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BrokerID = "yiyun73"  // 代征主体ID
	DealerID = "05476996" // 商户ID
)

基础配置信息

View Source
const (
	OrderDelete    = -1 // 订单删除
	OrderAccept    = 0  // 订单已受理
	OrderSuccess   = 1  // 订单已打款
	OrderFailed    = 2  // 订单已失败
	OrderPending   = 4  // 订单待打款(暂停处理)
	OrderSending   = 5  // 订单打款中
	OrderReadySend = 8  // 订单待打款
	OrderReturned  = 9  // 订单已退汇
	OrderCancel    = 15 // 订单取消
)

基础订单状态

View Source
const (
	BaseURL = "https://api-jiesuan.yunzhanghu.com" // 基础url

	BankOrderURL        = "/api/payment/v1/order-realtime"               // 银行卡下单接口url
	AliOrderURL         = "/api/payment/v1/order-alipay"                 // 支付宝下单接口url
	WxOrderURL          = "/api/payment/v1/order-wxpay"                  // 微信下单接口url
	QueryOrderURL       = "/api/payment/v1/query-realtime-order"         // 查单接口url
	CancelOrderURL      = "/api/payment/v1/order/fail"                   // 取消订单url
	QueryAccountURL     = "/api/payment/v1/query-accounts"               // 查询账户信息url
	QueryReceiptFileURL = "/api/payment/v1/receipt/file"                 // 查询电子回单URL
	QueryRechargeURL    = "/api/dataservice/v2/recharge-record"          // 查询充值记录url
	DownloadOrderURL    = "/api/dataservice/v1/order/downloadurl"        // 下载日订单url
	DownloadBillURL     = "/api/dataservice/v2/bill/downloadurl"         // 下载日流水url
	UploadUserURL       = "/api/payment/v1/user/exempted/info"           // 上传用户免验证名单url
	CheckExistUserURL   = "/api/payment/v1/user/white/check"             // 校验免验证用户名单是否存在url
	QueryInvoiceURL     = "/api/payment/v1/invoice-stat"                 // 查询发票接口
	Element4RequestURL  = "/authentication/verify-request"               // 银行卡四要素鉴权发送短信url
	Element4ConfirmURL  = "/authentication/verify-confirm"               // 银行卡四要素鉴权提交验证码url
	Element4URL         = "/authentication/verify-bankcard-four-factor"  // 银行卡四要素鉴权url
	Element3URL         = "/authentication/verify-bankcard-three-factor" // 银行卡三要素鉴权url
	IDCheckURL          = "/authentication/verify-id"                    // 实名制二要素鉴权url
	BankCardInfoURL     = "/api/payment/v1/card"                         // 银行卡信息查询url
)

路由信息

View Source
const (
	SuccessCode = "0000" // 成功
)

状态标识码

Variables

This section is empty.

Functions

func BuildHeader

func BuildHeader(dealerID string) map[string]string

BuildHeader 封装请求头

func BuildParams

func BuildParams(v interface{}, appKey, des3key, privateKey string) (map[string]string, error)

BuildParams 封装请求信息

func Decrypt

func Decrypt(data string, des3key string) ([]byte, error)

Decrypt data解密

func Encrypt

func Encrypt(originData []byte, des3key string) (string, error)

Encrypt data加密

func Get

func Get(uri string, params, header map[string]string) ([]byte, error)

Get 发起Get请求

func LoadPrivateKey

func LoadPrivateKey(data []byte) (priv *rsa.PrivateKey, err error)

LoadPrivateKey 加载私钥

func LoadPublicKey

func LoadPublicKey(data []byte) (pub *rsa.PublicKey, err error)

LoadPublicKey 加载公钥

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding 填充

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding 取消填充

func Post

func Post(uri string, params, header map[string]string) ([]byte, error)

Post 发起Post请求

func Sign

func Sign(plaintext, privateKey string) (ciphertext string, err error)

Sign 生成签名

func TripleDesDecrypt

func TripleDesDecrypt(crypt, des3key []byte) ([]byte, error)

TripleDesDecrypt 3DES解密

func TripleDesEncrypt

func TripleDesEncrypt(originData, des3key []byte) ([]byte, error)

TripleDesEncrypt 3DES加密

func VerifySign

func VerifySign(plaintext, sign, publicKey string) (ok bool, err error)

VerifySign 校验签名

Types

type AccountBalance

type AccountBalance struct {
	BrokerID         string `json:"broker_id"`          // 代征主体ID
	AcctBalance      string `json:"acct_balance"`       // 账户余额
	BankCardBalance  string `json:"bank_card_balance"`  // 银行卡余额
	AlipayBalance    string `json:"alipay_balance"`     // ⽀付宝余额
	WxpayBalance     string `json:"wxpay_balance"`      // 微信余额
	IsBankCard       bool   `json:"is_bank_card"`       // 是否开通银行卡通道
	IsAlipay         bool   `json:"is_alipay"`          // 是否开通付宝通道
	IsWxpay          bool   `json:"is_wxpay"`           // 是否开通微信通道
	RebateFeeBalance string `json:"rebate_fee_balance"` // 服务费返点余额
	TotalBalance     string `json:"total_balance"`      // 账户总余额
}

AccountBalance 账户余额信息

type AliOrderParam

type AliOrderParam struct {
	OrderBaseInfo
	CardNo    string // 收款人支付宝号(必填)
	CheckName string // 校验支付宝账户姓名(可填Check、 NoCheck)
}

AliOrderParam 支付宝订单信息

type BankCardInfo

type BankCardInfo struct {
	BankCode  string `json:"bank_code"`  // 银行代码
	BankName  string `json:"bank_name"`  // 银行名称
	CardType  string `json:"card_type"`  // 银行卡类型
	IsSupport bool   `json:"is_support"` // 云账户综合服务平台是否支持该银行打款
}

BankCardInfo 银行卡信息

type BankOrderParam

type BankOrderParam struct {
	OrderBaseInfo
	CardNo  string // 收款人银行卡号(必填)
	PhoneNo string // 收款人手机号(选填)
}

BankOrderParam 银行卡订单信息

type BaseCheckResponse

type BaseCheckResponse struct {
	BaseResponse
	Data struct {
		Ok bool `json:"ok"` // 是否成功
	} `json:"data"`
}

BaseCheckResponse 基础校验响应信息

type BaseResponse

type BaseResponse struct {
	Code      string `json:"code"`       // 响应码
	Message   string `json:"message"`    // 响应信息
	RequestID string `json:"request_id"` // 请求ID
}

BaseResponse 基础响应信息

type Client

type Client struct {
	BrokerID     string // 代征主体ID
	DealerID     string // 商户ID
	Gateway      string // 路由
	Appkey       string // 商户appkey
	Des3Key      string // 商户des3key
	PrivateKey   string // 商户秘钥
	YunPublicKey string // 云账户公钥
}

Client 客户端

func New

func New(brokerID, dealerID, gateway, appkey, des3key, privateKey, publicKey string) *Client

New 新建客户端

func (*Client) CancelOrder

func (c *Client) CancelOrder(orderID, ref, channel string) (ok bool, err error)

CancelOrder 取消订单

func (*Client) CereateWxOrder

func (c *Client) CereateWxOrder(param *WxOrderParam) (ref string, err error)

CereateWxOrder 创建微信订单

func (*Client) CheckUserExist

func (c *Client) CheckUserExist(idCard, realName string) (ok bool, err error)

CheckUserExist 校验免验证用户是否存在

func (*Client) CreateAliOrder

func (c *Client) CreateAliOrder(param *AliOrderParam) (res CreateOrderResponse, err error)

CreateAliOrder 创建支付宝订单

func (*Client) CreateBankOrder

func (c *Client) CreateBankOrder(param *BankOrderParam) (ref string, err error)

CreateBankOrder 创建银行卡订单

func (*Client) DownloadBillFile

func (c *Client) DownloadBillFile(billDate string) (url string, err error)

DownloadBillFile 下载日流水文件

func (*Client) DownloadOrderFile

func (c *Client) DownloadOrderFile(orderDate string) (url string, err error)

DownloadOrderFile 下载日订单文件

func (*Client) Element3Check

func (c *Client) Element3Check(idCard, realName, cardNo string) (ok bool, err error)

Element3Check 银行卡三要素鉴权

func (*Client) Element4Check

func (c *Client) Element4Check(idCard, realName, cardNo, mobile string) (ok bool, err error)

Element4Check 银行卡四要素鉴权

func (*Client) ElementVerifyConfirm

func (c *Client) ElementVerifyConfirm(idCard, realName, cardNo, mobile, ref, captcha string) (ok bool, err error)

ElementVerifyConfirm 银行卡四要素确认鉴权

func (*Client) ElementVerifyRequest

func (c *Client) ElementVerifyRequest(idCard, realName, cardNo, mobile string) (ref string, err error)

ElementVerifyRequest 银行卡四要素请求鉴权

func (*Client) IDCheck

func (c *Client) IDCheck(idCard, realName string) (ok bool, err error)

IDCheck 实名制二要素鉴权接口

func (*Client) OrderCallBack

func (c *Client) OrderCallBack(data, mess, timestamp, sign string) (order OrderDetailInfo, err error)

OrderCallBack 订单回调

func (*Client) QueryAccountBalance

func (c *Client) QueryAccountBalance() (accounts []AccountBalance, err error)

QueryAccountBalance 查询账户余额

func (*Client) QueryBankCardInfo

func (c *Client) QueryBankCardInfo(cardNo, bankName string) (cardInfo BankCardInfo, err error)

QueryBankCardInfo 查询银行卡信息

func (*Client) QueryInvoice

func (c *Client) QueryInvoice(year int) (invoice InvoiceInfo, err error)

QueryInvoice 查询发票信息

func (*Client) QueryOrder

func (c *Client) QueryOrder(orderID, channel, dataType string) (dest OrderInfo, err error)

QueryOrder 查询订单信息

func (*Client) QueryReceiptFile

func (c *Client) QueryReceiptFile(orderID, ref string) (file OrderReceiptFile, err error)

QueryReceiptFile 查询电子回单

func (*Client) QueryRechargeRecord

func (c *Client) QueryRechargeRecord(beginAt, endAt string) (records []RechargeRecord, err error)

QueryRechargeRecord 查询充值记录

func (*Client) UploadUserInfo

func (c *Client) UploadUserInfo(param *UserInfoParam) (ok bool, err error)

UploadUserInfo 上传免验证用户名单信息

func (*Client) UserInfoCallback

func (c *Client) UserInfoCallback(data, mess, timestamp, sign string) (user UserCallBackInfo, err error)

UserInfoCallback 免验证用户信息上传回调信息

type CreateOrderResponse

type CreateOrderResponse struct {
	BaseResponse
	Data struct {
		Pay     string `json:"pay"`      // 打款金额
		Ref     string `json:"ref"`      // 综合服务平台订单流水号
		OrderID string `json:"order_id"` // 商户订单流水号
	} `json:"data"`
}

CreateOrderResponse 创建订单响应信息

type DownloadBillFileResponse

type DownloadBillFileResponse struct {
	BaseResponse
	Data struct {
		BillDownloadURL string `json:"bill_download_url"` // url地址
	} `json:"data"`
}

DownloadBillFileResponse 下载日流水响应信息

type DownloadOrderFileResponse

type DownloadOrderFileResponse struct {
	BaseResponse
	Data struct {
		OrderDownloadURL string `json:"order_download_url"` // url地址
	} `json:"data"`
}

DownloadOrderFileResponse 下载日订单响应信息

type ElementVerifyResponse

type ElementVerifyResponse struct {
	BaseResponse
	Data struct {
		Ref string `json:"ref"` // 交易凭证
	} `json:"data"`
}

ElementVerifyResponse 银行卡四要素发送短信请求信息

type InvoiceInfo

type InvoiceInfo struct {
	BrokerID    string `json:"broker_id"`    // 代征主体ID
	DealerID    string `json:"dealer_id"`    // 商户ID
	Invoiced    string `json:"invoiced"`     // 已开发票金额
	NotInvoiced string `json:"not_invoiced"` // 待开发票⾦额
}

InvoiceInfo 发票信息

type OrderBaseInfo

type OrderBaseInfo struct {
	OrderID   string // 商户订单号(必填, 保持唯一性,64个英文字符以内)
	RealName  string // 收款人姓名(必填)
	IDCard    string // 收款人手机号(必填)
	Pay       string // 打款金额(必填 单位:元)
	PayRemark string // 打款备注(选填, 最大20个字符,一个汉字占两个字符,不允许特殊字符)
	NotifyURL string // 回调地址(选填, 最大长度为200)
}

OrderBaseInfo 订单基本信息

type OrderCallBackResponse

type OrderCallBackResponse struct {
	NotifyID   string          `json:"notify_id"`
	NotifyTime string          `json:"notify_time"`
	Data       OrderDetailInfo `json:"data"`
}

OrderCallBackResponse 订单回调信息

type OrderDetailInfo

type OrderDetailInfo struct {
	AnchorID            string `json:"anchor_id"`
	BrokerAmount        string `json:"broker_amount"`
	BrokerBankBill      string `json:"broker_bank_bill"`
	BrokerFee           string `json:"broker_fee"`
	BrokerID            string `json:"broker_id"`
	BrokerWalletRef     string `json:"broker_wallet_ref"`
	CardNo              string `json:"card_no"`
	CreatedAt           string `json:"created_at"`
	DealerID            string `json:"dealer_id"`
	FinishedTime        string `json:"finished_time"`
	IDCard              string `json:"id_card"`
	Notes               string `json:"notes"`
	OrderID             string `json:"order_id"`
	Pay                 string `json:"pay"`
	PayRemark           string `json:"pay_remark"`
	PhoneNo             string `json:"phone_no"`
	RealName            string `json:"real_name"`
	Ref                 string `json:"ref"`
	Status              string `json:"status"`
	StatusDetail        string `json:"status_detail"`
	StatusDetailMessage string `json:"status_detail_message"`
	StatusMessage       string `json:"status_message"`
	SysAmount           string `json:"sys_amount"`
	SysBankBill         string `json:"sys_bank_bill"`
	SysFee              string `json:"sys_fee"`
	SysWalletRef        string `json:"sys_wallet_ref"`
	Tax                 string `json:"tax"`
	UserFee             string `json:"user_fee"`
	WithdrawPlatform    string `json:"withdraw_platform"`
}

OrderDetailInfo 回调通知订单信息

type OrderInfo

type OrderInfo struct {
	AnchorID            string `json:"anchor_id"`
	BrokerAmount        string `json:"broker_amount"`
	BrokerBankBill      string `json:"broker_bank_bill"`
	BrokerFee           string `json:"broker_fee"`
	BrokerID            string `json:"broker_id"`
	CardNo              string `json:"card_no"`
	CreatedAt           string `json:"created_at"`
	DealerID            string `json:"dealer_id"`
	EncryData           string `json:"encry_data"`
	FeeAmount           string `json:"fee_amount"`
	FinishedTime        string `json:"finished_time"`
	IDCard              string `json:"id_card"`
	Notes               string `json:"notes"`
	OrderID             string `json:"order_id"`
	Pay                 string `json:"pay"`
	PayRemark           string `json:"pay_remark"`
	PhoneNo             string `json:"phone_no"`
	RealName            string `json:"real_name"`
	Ref                 string `json:"ref"`
	Status              string `json:"status"`
	StatusDetail        string `json:"status_detail"`
	StatusDetailMessage string `json:"status_detail_message"`
	StatusMessage       string `json:"status_message"`
	SysAmount           string `json:"sys_amount"`
}

OrderInfo 订单详细信息

type OrderReceiptFile

type OrderReceiptFile struct {
	ExpireTime string `json:"expire_time"` // 过期时间
	FileName   string `json:"file_name"`   // 文件名称
	URL        string `json:"url"`         // 下载地址
}

OrderReceiptFile 电子回单信息

type QueryAccountBalanceResponse

type QueryAccountBalanceResponse struct {
	BaseResponse
	Data struct {
		DealerInfos []AccountBalance `json:"dealer_infos"`
	} `json:"data"`
}

QueryAccountBalanceResponse 查询商户余额响应信息

type QueryBankCardResponse

type QueryBankCardResponse struct {
	BaseResponse
	Data BankCardInfo `json:"data"` // 银行卡信息
}

QueryBankCardResponse 查询银行卡信息响应信息

type QueryInvoiceResponse

type QueryInvoiceResponse struct {
	BaseResponse
	Data InvoiceInfo `json:"data"`
}

QueryInvoiceResponse 查询发票响应信息

type QueryOrderResponse

type QueryOrderResponse struct {
	BaseResponse
	Data OrderInfo `json:"data"`
}

QueryOrderResponse 查询订单响应信息

type QueryReceiptFileResponse

type QueryReceiptFileResponse struct {
	BaseResponse
	Data OrderReceiptFile `json:"data"`
}

QueryReceiptFileResponse 查询电子回单响应信息

type QueryRechargeRecordResponse

type QueryRechargeRecordResponse struct {
	BaseResponse
	Data []RechargeRecord `json:"data"`
}

QueryRechargeRecordResponse 充值记录响应信息

type RechargeRecord

type RechargeRecord struct {
	BrokerID        string `json:"broker_id"`        // 代征主体ID
	DealerID        string `json:"dealer_id"`        // 商户ID
	ActualAmount    int    `json:"actual_amount"`    // 实际到账金额
	Amount          int    `json:"amount"`           // 充值金额
	CreatedAt       string `json:"created_at"`       // 创建时间
	RechargeChannel string `json:"recharge_channel"` // 充值渠道
	RechargeID      string `json:"recharge_id"`      // 充值记录ID
}

RechargeRecord 充值记录信息

type UserCallBackInfo

type UserCallBackInfo struct {
	BrokerID string `json:"broker_id"` // 代征主体ID
	DealerID string `json:"dealer_id"` // 商户ID
	Comment  string `json:"comment"`   // 备注
	RealName string `json:"real_name"` // 姓名
	IDCard   string `json:"id_card"`   // 证件号
	Ref      string `json:"ref"`       // 凭证(上传信息中)
	Status   string `json:"status"`    // 状态(pass: 通过 reject: 拒绝)
}

UserCallBackInfo 通知用户上传信息

type UserInfoParam

type UserInfoParam struct {
	RealName     string   `json:"real_name"`     // 姓名
	IDCard       string   `json:"id_card"`       // 证件号
	Birthday     string   `json:"birthday"`      // 出生日期
	CardType     string   `json:"card_type"`     // 证件类型
	Country      string   `json:"country"`       // 国家代码
	Gender       string   `json:"gender"`        // 性别
	NotifyURL    string   `json:"notify_url"`    // 回调地址
	Ref          string   `json:"ref"`           // 流水号(回调时附带)
	UserImages   []string `json:"user_images"`   // 证件照片
	CommentApply string   `json:"comment_apply"` // 申请备注
}

UserInfoParam 免验证用户名单信息

type WxOrderParam

type WxOrderParam struct {
	OrderBaseInfo
	OpenID    string // 商户AppID下用户OpenID(必填)
	Notes     string // 描述信息(选填)
	WxAppID   string // 微信打款商户微信AppID(选填,最⼤长度为200)
	WxPayMode string // 微信打款模式(选填,二种取值,可填"", "redpacket")
}

WxOrderParam 微信订单信息

Jump to

Keyboard shortcuts

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