mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +01:00
Merge pull request #36 from logpacker/issue/33
#33 Send only Plan ID when create agreement
This commit is contained in:
commit
b5e9ae1c2d
|
@ -42,7 +42,7 @@ func (c *Client) CreateBillingPlan(plan BillingPlan) (*CreateBillingResp, error)
|
|||
return response, err
|
||||
}
|
||||
|
||||
// Activates a billing plan
|
||||
// ActivatePlan activates a billing plan
|
||||
// By default, a new plan is not activated
|
||||
// Endpoint: PATCH /v1/payments/billing-plans/
|
||||
func (c *Client) ActivatePlan(planID string) error {
|
||||
|
@ -56,9 +56,14 @@ func (c *Client) ActivatePlan(planID string) error {
|
|||
return c.SendWithAuth(req, nil)
|
||||
}
|
||||
|
||||
// Creates an agreement for specified plan
|
||||
// CreateBillingAgreement creates an agreement for specified plan
|
||||
// Endpoint: POST /v1/payments/billing-agreements
|
||||
func (c *Client) CreateBillingAgreement(a BillingAgreement) (*CreateAgreementResp, error) {
|
||||
// PayPal needs only ID, so we will remove all fields except Plan ID
|
||||
a.Plan = BillingPlan{
|
||||
ID: a.Plan.ID,
|
||||
}
|
||||
|
||||
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/billing-agreements"), a)
|
||||
response := &CreateAgreementResp{}
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user