mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
Add NotifyPayment API.
This commit is contained in:
@ -44,7 +44,7 @@ func NewAlipayPaymentProvider(appId string, appPublicKey string, appPrivateKey s
|
||||
return pp
|
||||
}
|
||||
|
||||
func (pp *AlipayPaymentProvider) Pay(productName string, paymentId string, price float64, returnUrl string, notifyUrl string) (string, error) {
|
||||
func (pp *AlipayPaymentProvider) Pay(productName string, productId string, providerId string, paymentId string, price float64, returnUrl string, notifyUrl string) (string, error) {
|
||||
pp.Client.DebugSwitch = gopay.DebugOn
|
||||
|
||||
priceString := strings.TrimRight(strings.TrimRight(fmt.Sprintf("%.2f", price), "0"), ".")
|
||||
@ -53,10 +53,12 @@ func (pp *AlipayPaymentProvider) Pay(productName string, paymentId string, price
|
||||
bm.Set("subject", productName)
|
||||
bm.Set("out_trade_no", paymentId)
|
||||
bm.Set("total_amount", priceString)
|
||||
|
||||
bm.Set("return_url", returnUrl)
|
||||
bm.Set("notify_url", notifyUrl)
|
||||
|
||||
bm.Set("productId", productId)
|
||||
bm.Set("providerId", productId)
|
||||
|
||||
payUrl, err := pp.Client.TradePagePay(context.Background(), bm)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -15,7 +15,7 @@
|
||||
package pp
|
||||
|
||||
type PaymentProvider interface {
|
||||
Pay(productName string, paymentId string, price float64, returnUrl string, notifyUrl string) (string, error)
|
||||
Pay(productName string, productId string, providerId string, paymentId string, price float64, returnUrl string, notifyUrl string) (string, error)
|
||||
}
|
||||
|
||||
func GetPaymentProvider(typ string, appId string, appPublicKey string, appPrivateKey string, authorityPublicKey string, authorityRootPublicKey string) PaymentProvider {
|
||||
|
Reference in New Issue
Block a user