mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
parent
06a298ef76
commit
c4226ce43c
|
@ -10,7 +10,7 @@ import (
|
|||
// Endpoint: GET /v2/payments/authorization/ID
|
||||
func (c *Client) GetAuthorization(authID string) (*Authorization, error) {
|
||||
buf := bytes.NewBuffer([]byte(""))
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("%s%s%s", c.APIBase, "/v2/payments/authorization/", authID), buf)
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("%s%s%s", c.APIBase, "/v2/payments/authorizations/", authID), buf)
|
||||
auth := &Authorization{}
|
||||
|
||||
if err != nil {
|
||||
|
@ -40,7 +40,7 @@ func (c *Client) CaptureAuthorization(authID string, paymentCaptureRequest *Paym
|
|||
// Endpoint: POST /v2/payments/authorization/ID/void
|
||||
func (c *Client) VoidAuthorization(authID string) (*Authorization, error) {
|
||||
buf := bytes.NewBuffer([]byte(""))
|
||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/authorization/"+authID+"/void"), buf)
|
||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/authorizations/"+authID+"/void"), buf)
|
||||
auth := &Authorization{}
|
||||
|
||||
if err != nil {
|
||||
|
@ -56,7 +56,7 @@ func (c *Client) VoidAuthorization(authID string) (*Authorization, error) {
|
|||
// Endpoint: POST /v2/payments/authorization/ID/reauthorize
|
||||
func (c *Client) ReauthorizeAuthorization(authID string, a *Amount) (*Authorization, error) {
|
||||
buf := bytes.NewBuffer([]byte(`{"amount":{"currency":"` + a.Currency + `","total":"` + a.Total + `"}}`))
|
||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/authorization/"+authID+"/reauthorize"), buf)
|
||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/authorizations/"+authID+"/reauthorize"), buf)
|
||||
auth := &Authorization{}
|
||||
|
||||
if err != nil {
|
||||
|
|
27
types.go
27
types.go
|
@ -132,17 +132,17 @@ type (
|
|||
|
||||
// Authorization struct
|
||||
Authorization struct {
|
||||
Amount *Amount `json:"amount,omitempty"`
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
ParentPayment string `json:"parent_payment,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
ValidUntil *time.Time `json:"valid_until,omitempty"`
|
||||
Links []Link `json:"links,omitempty"`
|
||||
ClearingTime string `json:"clearing_time,omitempty"`
|
||||
ProtectionEligibility string `json:"protection_eligibility,omitempty"`
|
||||
ProtectionEligibilityType string `json:"protection_eligibility_type,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
CustomID string `json:"custom_id,omitempty"`
|
||||
InvoiceID string `json:"invoice_id,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"`
|
||||
Amount *PurchaseUnitAmount `json:"amount,omitempty"`
|
||||
SellerProtection *SellerProtection `json:"seller_protection,omitempty"`
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
ExpirationTime *time.Time `json:"expiration_time,omitempty"`
|
||||
Links []Link `json:"links,omitempty"`
|
||||
}
|
||||
|
||||
// AuthorizeOrderResponse .
|
||||
|
@ -183,6 +183,11 @@ type (
|
|||
FinalCapture bool `json:"final_capture,omitempty"`
|
||||
}
|
||||
|
||||
SellerProtection struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
DisputeCategories []string `json:"dispute_categories,omitempty"`
|
||||
}
|
||||
|
||||
// https://developer.paypal.com/docs/api/payments/v2/#definition-capture_status_details
|
||||
CaptureStatusDetails struct {
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user