forked from go-packages/paypal
#188: GetCapturedPaymentDetails
This commit is contained in:
parent
52acc61786
commit
62598e5880
48
README.md
48
README.md
|
@ -6,25 +6,47 @@
|
||||||
|
|
||||||
## Coverage
|
## Coverage
|
||||||
|
|
||||||
|
### Auth
|
||||||
|
|
||||||
* POST /v1/oauth2/token
|
* POST /v1/oauth2/token
|
||||||
* POST /v1/identity/openidconnect/tokenservice
|
|
||||||
* GET /v1/identity/openidconnect/userinfo/?schema=:schema
|
### /v1/payments
|
||||||
|
|
||||||
* POST /v1/payments/payouts
|
* POST /v1/payments/payouts
|
||||||
* GET /v1/payments/payouts/:id
|
* GET /v1/payments/payouts/:id
|
||||||
* GET /v1/payments/payouts-item/:id
|
* GET /v1/payments/payouts-item/:id
|
||||||
* POST /v1/payments/payouts-item/:id/cancel
|
* 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
|
* GET /v1/payment-experience/web-profiles
|
||||||
* POST /v1/payment-experience/web-profiles
|
* POST /v1/payment-experience/web-profiles
|
||||||
* GET /v1/payment-experience/web-profiles/:id
|
* GET /v1/payment-experience/web-profiles/:id
|
||||||
* PUT /v1/payment-experience/web-profiles/:id
|
* PUT /v1/payment-experience/web-profiles/:id
|
||||||
* DELETE /v1/payment-experience/web-profiles/:id
|
* DELETE /v1/payment-experience/web-profiles/:id
|
||||||
* GET /v2/payments/authorizations/:id
|
|
||||||
* POST /v2/payments/authorizations/:id/capture
|
### /v1/reporting
|
||||||
* 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
|
|
||||||
* POST /v1/reporting/transactions
|
* POST /v1/reporting/transactions
|
||||||
|
|
||||||
### Vault
|
### Vault
|
||||||
|
@ -43,14 +65,6 @@
|
||||||
* POST /v2/checkout/orders/:id/authorize
|
* POST /v2/checkout/orders/:id/authorize
|
||||||
* POST /v2/checkout/orders/:id/capture
|
* 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
|
### Notifications
|
||||||
* POST /v1/notifications/webhooks
|
* POST /v1/notifications/webhooks
|
||||||
* GET /v1/notifications/webhooks
|
* GET /v1/notifications/webhooks
|
||||||
|
|
23
capture.go
Normal file
23
capture.go
Normal file
|
@ -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
|
||||||
|
}
|
7
types.go
7
types.go
|
@ -349,13 +349,14 @@ type (
|
||||||
|
|
||||||
// Capture struct
|
// Capture struct
|
||||||
Capture struct {
|
Capture struct {
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
Amount *Amount `json:"amount,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"`
|
IsFinalCapture bool `json:"is_final_capture"`
|
||||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||||
UpdateTime *time.Time `json:"update_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"`
|
Links []Link `json:"links,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user