mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +01:00
add capture detail interface
This commit is contained in:
parent
a5cff3c18c
commit
a3c2eaa0d4
16
order.go
16
order.go
|
@ -158,3 +158,19 @@ func (c *Client) RefundCaptureWithPaypalRequestId(ctx context.Context,
|
|||
}
|
||||
return refund, nil
|
||||
}
|
||||
|
||||
// CapturedDetail - https://developer.paypal.com/docs/api/payments/v2/#captures_get
|
||||
// Endpoint: GET /v2/payments/captures/ID
|
||||
func (c *Client) CapturedDetail(ctx context.Context, captureID string ) (*CaptureDetailsResponse, error) {
|
||||
response := &CaptureDetailsResponse{}
|
||||
|
||||
req, err := c.NewRequest(ctx, "GET", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/captures/"+captureID), nil)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
if err = c.SendWithAuth(req, response); err != nil {
|
||||
return response, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
17
types.go
17
types.go
|
@ -277,6 +277,23 @@ type (
|
|||
Links []Link `json:"links,omitempty"`
|
||||
}
|
||||
|
||||
//https://developer.paypal.com/docs/api/payments/v2/#captures_get
|
||||
CaptureDetailsResponse struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Amount *Money `json:"amount,omitempty"`
|
||||
InvoiceID string `json:"invoice_id,omitempty"`
|
||||
CustomID string `json:"custom_id,omitempty"`
|
||||
SellerProtection *SellerProtection `json:"seller_protection,omitempty"`
|
||||
FinalCapture bool `json:"final_capture,omitempty"`
|
||||
SellerReceivableBreakdown *SellerReceivableBreakdown `json:"seller_receivable_breakdown,omitempty"`
|
||||
DisbursementMode string `json:"disbursement_mode,omitempty"`
|
||||
Links []Link `json:"links,omitempty"`
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
}
|
||||
|
||||
// CaptureOrderRequest - https://developer.paypal.com/docs/api/orders/v2/#orders_capture
|
||||
CaptureOrderRequest struct {
|
||||
PaymentSource *PaymentSource `json:"payment_source"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user