diff --git a/README.md b/README.md index f1f9781..7663953 100644 --- a/README.md +++ b/README.md @@ -6,25 +6,47 @@ ## Coverage +### Auth + * POST /v1/oauth2/token -* POST /v1/identity/openidconnect/tokenservice -* GET /v1/identity/openidconnect/userinfo/?schema=:schema + +### /v1/payments + * POST /v1/payments/payouts * GET /v1/payments/payouts/:id * GET /v1/payments/payouts-item/:id * POST /v1/payments/payouts-item/:id/cancel +* GET /v1/payments/sale/:id +* POST /v1/payments/sale/:id/refund +* GET /v1/payments/billing-plans +* POST /v1/payments/billing-plans +* PATCH /v1/payments/billing-plans/:id +* POST /v1/payments/billing-agreements +* POST /v1/payments/billing-agreements/:token/agreement-execute + +### /v2/payments + +* GET /v2/payments/authorizations/:id +* GET /v2/payments/captures/:id +* POST /v2/payments/authorizations/:id/capture +* POST /v2/payments/authorizations/:id/void +* POST /v2/payments/authorizations/:id/reauthorize +* GET /v2/payments/refund/:id + +### Identity +* POST /v1/identity/openidconnect/tokenservice +* GET /v1/identity/openidconnect/userinfo/?schema=:schema + +### /v1/payment-experience + * GET /v1/payment-experience/web-profiles * POST /v1/payment-experience/web-profiles * GET /v1/payment-experience/web-profiles/:id * PUT /v1/payment-experience/web-profiles/:id * DELETE /v1/payment-experience/web-profiles/:id -* GET /v2/payments/authorizations/:id -* POST /v2/payments/authorizations/:id/capture -* POST /v2/payments/authorizations/:id/void -* POST /v2/payments/authorizations/:id/reauthorize -* GET /v1/payments/sale/:id -* POST /v1/payments/sale/:id/refund -* GET /v2/payments/refund/:id + +### /v1/reporting + * POST /v1/reporting/transactions ### Vault @@ -43,14 +65,6 @@ * POST /v2/checkout/orders/:id/authorize * POST /v2/checkout/orders/:id/capture -### Billing plans (payments) - -* GET /v1/payments/billing-plans -* POST /v1/payments/billing-plans -* PATCH /v1/payments/billing-plans/:id -* POST /v1/payments/billing-agreements -* POST /v1/payments/billing-agreements/:token/agreement-execute - ### Notifications * POST /v1/notifications/webhooks * GET /v1/notifications/webhooks diff --git a/capture.go b/capture.go new file mode 100644 index 0000000..cec5cea --- /dev/null +++ b/capture.go @@ -0,0 +1,23 @@ +package paypal + +import ( + "context" + "fmt" +) + +// GetCapturedPaymentDetails. +// Endpoint: GET /v1/payments/capture/:id +func (c *Client) GetCapturedPaymentDetails(ctx context.Context, id string) (*Capture, error) { + res := &Capture{} + + req, err := c.NewRequest(ctx, "GET", fmt.Sprintf("%s%s%s", c.APIBase, "/v1/payments/capture/", id), nil) + if err != nil { + return res, err + } + + if err = c.SendWithAuth(req, res); err != nil { + return res, err + } + + return res, nil +} diff --git a/types.go b/types.go index b8fc88c..35c93a0 100644 --- a/types.go +++ b/types.go @@ -349,13 +349,14 @@ type ( // Capture struct Capture struct { + ID string `json:"id,omitempty"` Amount *Amount `json:"amount,omitempty"` + State string `json:"state,omitempty"` + ParentPayment string `json:"parent_payment,omitempty"` + TransactionFee string `json:"transaction_fee,omitempty"` IsFinalCapture bool `json:"is_final_capture"` 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"` Links []Link `json:"links,omitempty"` }