1 Star 0 Fork 1

後天/paypal

forked from wslxj/paypal 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
payments.go 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
wslxj 提交于 2023-08-14 16:26 . fix err
package paypal
/*
* 付款
* https://developer.paypal.com/docs/api/payments/v2/#authorizations
*/
import (
"fmt"
"paypal/model"
)
// GetAuthorizedPaymentDetails 获取付款授权详情
func (p *Client) GetAuthorizedPaymentDetails(req *model.ReqGetAuthorizedPaymentDetails) (res model.ResGetAuthorizedPaymentDetails, err error) {
api := fmt.Sprintf(AuthorizedPaymentDetailsAPI, req.AuthorizationId)
if err = p.CallApiRequest(HttpMethodGet, api, nil, &res); err != nil {
return
}
return
}
// CaptureAuthorizedPayment 付款授权捕获
func (p *Client) CaptureAuthorizedPayment(req *model.ReqCaptureAuthorizedPayment) (res model.ResCaptureAuthorizedPayment, err error) {
api := fmt.Sprintf(CaptureAuthorizedPaymentAPI, req.AuthorizationId)
if err = p.CallApiRequest(HttpMethodPost, api, req, &res); err != nil {
return
}
return
}
// ReauthorizeAuthorizedPayment 付款重新授权
func (p *Client) ReauthorizeAuthorizedPayment(req *model.ReqReauthorizeAuthorizedPayment) (res model.ResReauthorizeAuthorizedPayment, err error) {
api := fmt.Sprintf(ReauthorizeAuthorizedPaymentAPI, req.AuthorizationId)
if err = p.CallApiRequest(HttpMethodPost, api, req, &res); err != nil {
return
}
return
}
// VoidAuthorizedPayment 无效的授权付款
func (p *Client) VoidAuthorizedPayment(req *model.ReqVoidAuthorizedPayment) (err error) {
api := fmt.Sprintf(VoidAuthorizedPaymentAPI, req.AuthorizationId)
if err = p.CallApiRequest(HttpMethodPost, api, req, nil); err != nil {
return
}
return
}
// GetCapturedPaymentDetails 获取捕获的付款详情
func (p *Client) GetCapturedPaymentDetails(req *model.ReqGetCapturedPaymentDetails) (res model.ResGetCapturedPaymentDetails, err error) {
api := fmt.Sprintf(CapturedPaymentDetailsAPI, req.CaptureId)
if err = p.CallApiRequest(HttpMethodGet, api, nil, &res); err != nil {
return
}
return
}
// RefundCapturedPayment 退还被捕获的付款
func (p *Client) RefundCapturedPayment(req *model.ReqRefundCapturedPayment) (res model.ResRefundCapturedPayment, err error) {
api := fmt.Sprintf(RefundCapturedPaymentAPI, req.CaptureId)
if err = p.CallApiRequest(HttpMethodPost, api, req, &res); err != nil {
return
}
return
}
// GetRefundDetails 获取退款详情
func (p *Client) GetRefundDetails(req *model.ReqGetRefundDetails) (res model.ResGetRefundDetails, err error) {
api := fmt.Sprintf(RefundDetailsAPI, req.RefundId)
if err = p.CallApiRequest(HttpMethodPost, api, nil, &res); err != nil {
return
}
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/houtian213/paypal.git
git@gitee.com:houtian213/paypal.git
houtian213
paypal
paypal
main

搜索帮助