支付模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

payment.go 2.0 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package adapay
  2. import (
  3. "strings"
  4. adapayCore "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/lib/adapay-sdk/adapay-core"
  5. )
  6. type paymentInterface interface {
  7. Create(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error)
  8. Query(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error)
  9. QueryList(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error)
  10. Close(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error)
  11. }
  12. type Payment struct {
  13. *Adapay
  14. }
  15. func (p *Payment) Create(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error) {
  16. reqUrl := BASE_URL + PAYMENT_CREATE
  17. return adapayCore.RequestAdaPay(reqUrl, adapayCore.POST, reqParam, p.HandleConfig(multiMerchConfigId...))
  18. }
  19. func (p *Payment) Query(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error) {
  20. reqUrl := BASE_URL + strings.Replace(PAYMENT_QUERY, "{payment_id}", adapayCore.ToString(reqParam["payment_id"]), -1)
  21. return adapayCore.RequestAdaPay(reqUrl, adapayCore.GET, reqParam, p.HandleConfig(multiMerchConfigId...))
  22. }
  23. func (p *Payment) QueryList(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error) {
  24. reqUrl := BASE_URL + PAYMENT_LIST_QUERY
  25. return adapayCore.RequestAdaPay(reqUrl, adapayCore.GET, reqParam, p.HandleConfig(multiMerchConfigId...))
  26. }
  27. func (p *Payment) Close(reqParam map[string]interface{}, multiMerchConfigId ...string) (map[string]interface{}, *adapayCore.ApiError, error) {
  28. reqUrl := BASE_URL + strings.Replace(PAYMENT_CLOSE, "{payment_id}", adapayCore.ToString(reqParam["payment_id"]), -1)
  29. return adapayCore.RequestAdaPay(reqUrl, adapayCore.POST, reqParam, p.HandleConfig(multiMerchConfigId...))
  30. }