add capture detail interface

This commit is contained in:
Yuusuke 2021-02-07 00:56:29 +09:00
parent a5cff3c18c
commit a3c2eaa0d4
2 changed files with 33 additions and 0 deletions

View File

@ -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
}

View File

@ -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"`