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

ARB Subscription Request API Call missing option #280

Closed
zenphp opened this issue Jan 19, 2018 · 7 comments
Closed

ARB Subscription Request API Call missing option #280

zenphp opened this issue Jan 19, 2018 · 7 comments

Comments

@zenphp
Copy link

zenphp commented Jan 19, 2018

Working with the recurring billing portions of the API, I am trying to retrieve recent transactions related to a subscription. The documentation (https://developer.authorize.net/api/reference/#recurring-billing-get-subscription-status) for ARBGetSubscriptionRequest states that there is an optional parameter includeTransactions that will return recent transactions associated with the subscription.

This does not seem to be present in the PHP SDK. Looking in the code (https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/contract/v1/ARBGetSubscriptionRequest.php) there is no property to store the value nor any accessors to set/retrieve the value.

Manually adding them, and updating the YML definition (https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/yml/v1/ARBGetSubscriptionRequest.yml) to define the property allows it to be set and transmitted, but no data appears to be returned to the client in the response.

The appropriate section of my application code:

        $subscription = new AnetAPI\ARBGetSubscriptionRequest();
        $subscription->setSubscriptionId($subid);
        $subscription->setRefId($refId);
        $subscription->setMerchantAuthentication($merchantAuthentication);
        $subscription->setIncludeTransactions(true);

        $controller = new AnetController\ARBGetSubscriptionController($subscription);
        $target = self::getAuthNetEnvTarget();
        $response = $controller->executeWithApiResponse($target);

Am I missing something? Or is the API missing something?

@adavidw
Copy link
Contributor

adavidw commented Jan 19, 2018

Looks like you'd also need to add a getter to get the arbTransactions element out of the ARBSubscriptionMaskedType in ARBSubscriptionMaskedType.php and ARBSubscriptionMaskedType.yml

@enterlight
Copy link

@zenphp did you get this to work? Would you share your code please? I need help. Did you create a arbTransactionsListType class and a arbTransactionType?

@zenphp
Copy link
Author

zenphp commented Jan 26, 2018

@enterlight I have not had a chance to circle back on this. Will try to do so this weekend and let you know where I end up.

@sjordan1975
Copy link

sjordan1975 commented Jan 30, 2018

I suspect that includeTransactions support has been implemented in the underlying Authorize.net API; however, the PHP SDK is woefully out of date. And no sample code has been forthcoming from Authorize.net (earliest request is from June 2016)

So, For my purposes, I forked the PHP SDK:
https://github.com/sjordan1975/sdk-php

I implemented get ARB Transaction from Get Subscription sufficient for what I needed.

Specifically, I modified the following 4 files:
lib/net/authorize/api/contract/v1/ARBGetSubscriptionRequest.php
lib/net/authorize/api/contract/v1/ARBSubscriptionMaskedType.php
lib/net/authorize/api/yml/v1/ARBGetSubscriptionRequest.yml
lib/net/authorize/api/yml/v1/ARBSubscriptionMaskedType.yml

Immediately after setting setSubscriptionID in the sample code (https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/get-subscription-status.php) add the following:

$request->setIncludeTransactions(true);

Note: I have used TransactionDetailsType whereas I suspect the actual type should be something like ARBTransactionType, but the yaml definition is missing and I have not defined it

The result is for now not all transaction data is populated; HOWEVER, transId IS populated and this is good enough to make an additional API call to get Transaction Details.

Feel free to have at it. Code provided AS IS to the Community. YMMV

@zenphp
Copy link
Author

zenphp commented Feb 14, 2018

I've finally worked with what @sjordan1975 provided and cleaned things up. I am using this code in production right now, and have submitted a PR to have it included in the base api.

https://github.com/CGX-Development/sdk-php/tree/dev-1.9.4

@ashtru
Copy link
Contributor

ashtru commented Feb 22, 2018

includeTransactions has been added to the ARBGetSubscription request as part of the latest release!
Kindly change your composer.json to use version 1.9.5 of authorizenet/authorizenet similar to the sample code composer.

@ashtru ashtru closed this as completed Feb 22, 2018
@enterlight
Copy link

This is great news!! Thanks

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

No branches or pull requests

5 participants