forked from go-packages/paypal
This reverts commit efe72c1ed4
.
This commit is contained in:
parent
efe72c1ed4
commit
b3eb2c69dd
9
sale.go
9
sale.go
|
@ -23,10 +23,15 @@ func (c *Client) GetSale(saleID string) (*Sale, error) {
|
||||||
|
|
||||||
// RefundSale refunds a completed payment.
|
// RefundSale refunds a completed payment.
|
||||||
// Use this call to refund a completed payment. Provide the sale_id in the URI and an empty JSON payload for a full refund. For partial refunds, you can include an amount.
|
// Use this call to refund a completed payment. Provide the sale_id in the URI and an empty JSON payload for a full refund. For partial refunds, you can include an amount.
|
||||||
func (c *Client) RefundSale(saleID string, r RefundRequest) (*Refund, error) {
|
// Endpoint: POST /v1/payments/sale/ID/refund
|
||||||
|
func (c *Client) RefundSale(saleID string, a *Amount) (*Refund, error) {
|
||||||
|
type refundRequest struct {
|
||||||
|
Amount *Amount `json:"amount"`
|
||||||
|
}
|
||||||
|
|
||||||
refund := &Refund{}
|
refund := &Refund{}
|
||||||
|
|
||||||
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/sale/"+saleID+"/refund"), &r)
|
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/sale/"+saleID+"/refund"), &refundRequest{Amount: a})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return refund, err
|
return refund, err
|
||||||
}
|
}
|
||||||
|
|
28
types.go
28
types.go
|
@ -234,12 +234,6 @@ type (
|
||||||
FinalCapture bool `json:"final_capture,omitempty"`
|
FinalCapture bool `json:"final_capture,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
RefundRequest struct {
|
|
||||||
Amount *PurchaseUnitAmount `json:"amount,omitempty"`
|
|
||||||
InvoiceID string `json:"invoice_id,omitempty"`
|
|
||||||
NoteToPayer string `json:"note_to_payer,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
SellerProtection struct {
|
SellerProtection struct {
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
DisputeCategories []string `json:"dispute_categories,omitempty"`
|
DisputeCategories []string `json:"dispute_categories,omitempty"`
|
||||||
|
@ -250,10 +244,6 @@ type (
|
||||||
Reason string `json:"reason,omitempty"`
|
Reason string `json:"reason,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
RefundStatusDetails struct {
|
|
||||||
Reason string `json:"reason,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
PaymentCaptureResponse struct {
|
PaymentCaptureResponse struct {
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"`
|
StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"`
|
||||||
|
@ -786,16 +776,13 @@ type (
|
||||||
|
|
||||||
// Refund struct
|
// Refund struct
|
||||||
Refund struct {
|
Refund struct {
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"`
|
||||||
Amount *PurchaseUnitAmount `json:"amount,omitempty"`
|
Amount *Amount `json:"amount,omitempty"`
|
||||||
Status string `json:"status,omitempty"`
|
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||||
StatusDetails *RefundStatusDetails `json:"status_details,omitempty"`
|
State string `json:"state,omitempty"`
|
||||||
InvoiceID string `json:"invoice_id,omitempty"`
|
CaptureID string `json:"capture_id,omitempty"`
|
||||||
NoteToPayer string `json:"note_to_payer,omitempty"`
|
ParentPayment string `json:"parent_payment,omitempty"`
|
||||||
SellerPayableBreakdown *CaptureSellerBreakdown `json:"seller_payable_breakdown,omitempty"`
|
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||||
Links []Link `json:"links"`
|
|
||||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
|
||||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RefundResponse .
|
// RefundResponse .
|
||||||
|
@ -996,6 +983,7 @@ type (
|
||||||
Links []Link `json:"links"`
|
Links []Link `json:"links"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WebhookEvent struct
|
||||||
WebhookEvent struct {
|
WebhookEvent struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreateTime time.Time `json:"create_time"`
|
CreateTime time.Time `json:"create_time"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user