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

Coupon redemption issues #196

Closed
davidmcl opened this issue Dec 1, 2015 · 5 comments
Closed

Coupon redemption issues #196

davidmcl opened this issue Dec 1, 2015 · 5 comments
Assignees
Labels
V2 V2 Client

Comments

@davidmcl
Copy link

davidmcl commented Dec 1, 2015

I have switched my test subdomain to allow multiple coupon redemptions per account and have run into a few issues in my testing; I believe likely with the api itself, not the PHP wrapper, but there doesn't seem to be an generic api repo for issues and since I use the php wrapper - here it goes.

  1. If multiple redemptions are allowed, I would think that the link in the account lookup (accounts/xxx) for the <redemption> element should reference /redemptions - plural, not singular - so as to get all redemptions, not just the last.

  2. If I call the redemptions api endpoint directly, e.g.

https://xxx-domain.recurly.com/v2/accounts/96394/redemptions

I get a list of redemptions, but the uuid of the individual redemptions are missing and the link shows the singular redemption ...

<?xml version="1.0" encoding="UTF-8"?>
<redemptions type="array">
    <redemption href="https://xxx-domain.recurly.com/v2/accounts/96394/redemption">
        <coupon href="https://xxx-domain.recurly.com/v2/coupons/omteam"/>
        <account href="https://xxx-domain.recurly.com/v2/accounts/96394"/>
        <uuid>32cd4c6dc1a097aa131b244f23a19f61</uuid>
        <single_use type="boolean">false</single_use>
        <total_discounted_in_cents type="integer">0</total_discounted_in_cents>
        <currency>USD</currency>
        <state>active</state>
        <coupon_code>omteam</coupon_code>
        <created_at type="datetime">2015-12-01T17:05:02Z</created_at>
    </redemption>
    <redemption href="https://xxx-domain.recurly.com/v2/accounts/96394/redemption">
        <coupon href="https://xxx-domain.recurly.com/v2/coupons/first100-03dkx92mdj"/>
        <account href="https://xxx-domain.recurly.com/v2/accounts/96394"/>
        <uuid>32cd3afb54c65ef697d53f47a7b4fb2a</uuid>
        <single_use type="boolean">true</single_use>
        <total_discounted_in_cents type="integer">0</total_discounted_in_cents>
        <currency>USD</currency>
        <state>active</state>
        <coupon_code>first100-03dkx92mdj</coupon_code>
        <created_at type="datetime">2015-12-01T16:45:59Z</created_at>
    </redemption>
</redemptions>

unlike your sample responses in the docs...

<redemption href="https://your-subdomain.recurly.com/v2/accounts/1/redemptions/316a4213e8fa9e97390aff4995bda9e6">
  1. Lastly, in the PHP client, perhaps because of item 1 above being singular? - I can only get the last redemption, not all redemptions.

Thanks,
David

@drewish
Copy link

drewish commented Jan 5, 2016

Hey sorry I'm not sure how this got missed. We're doing some other work with the PHP client's coupons so we can look into this as part of that.

@bhelx
Copy link
Contributor

bhelx commented Jan 26, 2016

Hey @davidmcl

The href on redemption is dependent on the API Version which is set as the header X-Api-Version. Version 2.0 uses the singular href and version > 2.0 uses the plural. The php library is setting this to 2.1:

'X-Api-Version: ' . Recurly_Client::$apiVersion

So it should be returning plural. I believe if you do not set a header, it defaults to 2.0. In your curl request try setting that header to 2.1.

Also, which version of the php library are you using? You should be able to get multiple redemptions as of version 2.4.6.

Thanks for your patience.

@davidmcl
Copy link
Author

Thanks - I'll not get to check this out until after this weekend, but I was using code as of...
Commit: daccf55 [daccf55]

I'll update to the latest build when I push out some other changes over the weekend and then retry the testing next week.

... and attached is a screenshot from the version of PHP client I'm using. -- cheers, dbm

capture

@bhelx
Copy link
Contributor

bhelx commented Jan 28, 2016

@davidmcl I did find and fix a bug that may be related to this which you can follow here: #201

Should hopefully be merging this week.

@drewish
Copy link

drewish commented Mar 1, 2016

That's merged and released in https://github.com/recurly/recurly-client-php/releases/tag/2.5.1 so I'm going to close this.

@drewish drewish closed this as completed Mar 1, 2016
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

No branches or pull requests

3 participants