Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create subscription with coupon #100

Open
mhlsf opened this issue May 30, 2018 · 0 comments
Open

Create subscription with coupon #100

mhlsf opened this issue May 30, 2018 · 0 comments

Comments

@mhlsf
Copy link

mhlsf commented May 30, 2018

Hello,

We can't create a subscription with a coupon in the parameters. Settings the coupon as a parameter in the request allow you to set a discount on a newly created subscription as it is stated in the documentation.

We should update the CreateSubscriptionRequest and add getter and setter for the coupon as follow :

`/**
* Set the coupon
*
* @param $value
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
*/
public function setCoupon($value)
{
return $this->setParameter('coupon', $value);
}

/**
 * Set the plan
 *
 * @param $value
 * @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
 */
public function setPlan($value)
{
    return $this->setParameter('plan', $value);
}

`
And also add a condition the getData() method to add the coupon in the request data like this :

if($this->parameters->has('coupon')) { $data['coupon'] = $this->getCoupon(); }

I will try to make a proper pull request

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant