2019-08-21 15:50:20 +02:00
|
|
|
package paypal
|
2015-12-17 04:56:49 +01:00
|
|
|
|
2021-01-03 10:28:52 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
)
|
2015-12-17 04:56:49 +01:00
|
|
|
|
2015-12-17 05:28:26 +01:00
|
|
|
// GetRefund by ID
|
2015-12-29 10:21:11 +01:00
|
|
|
// Use it to look up details of a specific refund on direct and captured payments.
|
2019-03-27 09:27:53 +01:00
|
|
|
// Endpoint: GET /v2/payments/refund/ID
|
2021-01-03 10:28:52 +01:00
|
|
|
func (c *Client) GetRefund(ctx context.Context, refundID string) (*Refund, error) {
|
2015-12-17 05:28:26 +01:00
|
|
|
refund := &Refund{}
|
|
|
|
|
2021-01-03 10:28:52 +01:00
|
|
|
req, err := c.NewRequest(ctx, "GET", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/refund/"+refundID), nil)
|
2015-12-17 05:28:26 +01:00
|
|
|
if err != nil {
|
|
|
|
return refund, err
|
|
|
|
}
|
|
|
|
|
2017-11-23 03:15:11 +01:00
|
|
|
if err = c.SendWithAuth(req, refund); err != nil {
|
2015-12-17 05:28:26 +01:00
|
|
|
return refund, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return refund, nil
|
|
|
|
}
|