fix: amount
This commit is contained in:
@@ -185,12 +185,18 @@ func (b *BodyMap) OutTradeNo(outTradeNo string) *BodyMap {
|
||||
}
|
||||
|
||||
// Amount
|
||||
func (b *BodyMap) Amount(total int, currency string) *BodyMap {
|
||||
func (b *BodyMap) Amount(total int64, currency CURRENCY) *BodyMap {
|
||||
return b.SetBodyMap("amount", func(bm gopay.BodyMap) {
|
||||
bm.Set("total", total).Set("currency", currency)
|
||||
bm.
|
||||
Set("total", total).
|
||||
Set("currency", currency.String())
|
||||
})
|
||||
}
|
||||
|
||||
func (b *BodyMap) CNYAmount(total int64) *BodyMap {
|
||||
return b.Amount(total, CNY)
|
||||
}
|
||||
|
||||
// Payer
|
||||
func (b *BodyMap) Payer(spOpenId string) *BodyMap {
|
||||
return b.SetBodyMap("payer", func(bm gopay.BodyMap) {
|
||||
@@ -202,3 +208,15 @@ func (b *BodyMap) Payer(spOpenId string) *BodyMap {
|
||||
func (b *BodyMap) SubMchId(subMchId string) *BodyMap {
|
||||
return b.Set("sub_mchid", subMchId)
|
||||
}
|
||||
|
||||
type CURRENCY string
|
||||
|
||||
func (c CURRENCY) String() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
const (
|
||||
CNY CURRENCY = "CNY"
|
||||
USD CURRENCY = "USD"
|
||||
EUR CURRENCY = "EUR"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user