crucialwebstudio / chargify-sdk-php

Chargify SDK for PHP
Apache License 2.0
26 stars 44 forks source link

Added Coupon::findValid() #22

Closed gbrunacci closed 7 years ago

gbrunacci commented 7 years ago

Hi,

I added a Coupon::findValid() method that implements the following Chargify method: https://reference.chargify.com/v1/coupons/validate-a-coupon

The main difference between find() and findValid() is that the coupon is retrieved only when it exists and is valid.

Usage:

$chargify->coupon()
    ->setCode($coupon_code)
    ->findValid($product_family_id);
return $coupon->isError();
dan-bowen commented 7 years ago

Ahh, I also forgot to mention that you will need to re-target this to the develop branch as we don't merge straight into master. I'm going to update our documentation to reflect this standard.

I'm going to close this for now, but if you can make the suggested changes and re-submit this to the develop branch I'll make sure to take another look at it then.

Thanks again for your submission.