mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +01:00
fix param error while query transactions of subscriptions (#186)
url needs start_time and end_time, and both fields remove timezome
This commit is contained in:
parent
ef386ff32f
commit
98cae62470
|
@ -175,16 +175,14 @@ func (c *Client) SuspendSubscription(subscriptionId, reason string) error {
|
|||
// Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_transactions
|
||||
// Endpoint: GET /v1/billing/subscriptions/{id}/transactions
|
||||
func (c *Client) GetSubscriptionTransactions(requestParams SubscriptionTransactionsParams) (*SubscriptionTransactionsResponse, error) {
|
||||
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v1/billing/subscriptions/%s/transactions", c.APIBase, requestParams.SubscriptionId), nil)
|
||||
startTime := requestParams.StartTime.Format("2006-01-02T15:04:05Z")
|
||||
endTime := requestParams.EndTime.Format("2006-01-02T15:04:05Z")
|
||||
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v1/billing/subscriptions/%s/transactions?start_time=%s&end_time=%s", c.APIBase, requestParams.SubscriptionId, startTime, endTime), nil)
|
||||
response := &SubscriptionTransactionsResponse{}
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
q := req.URL.Query()
|
||||
q.Add("start_time", requestParams.StartTime.Format(time.RFC3339Nano))
|
||||
q.Add("end_time", requestParams.EndTime.Format(time.RFC3339Nano))
|
||||
|
||||
err = c.SendWithAuth(req, response)
|
||||
return response, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user