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

Reporting API is not returning SubscriptionID field for transaction via this gem #39

Closed
dmitrypol opened this issue Apr 1, 2015 · 4 comments

Comments

@dmitrypol
Copy link

Reporting API is not returning SubscriptionID field for transaction per http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/ARB-Subscription-IDs-Available-Through-Transaction-Details-API/ba-p/40602.

I have a sandbox subscription ID 2343517. On March 18th, it charged $10 https://sandbox.authorize.net/UI/themes/sandbox/ARB/TransactionList.aspx?SubscrID=2343517

Here is what API returns:
​{"id":"2230382467","submitted_at":"2015-03-18T09:45:10.000+00:00","status":"settledSuccessfully","account_type":"Visa","account_number":"XXXX4242","settle_amount":"10.0","customer":{"first_name":"Tanya","last_name":"Rowe"}}

Here is my code snippet:
t1 = AuthorizeNet::Reporting::Transaction.new ...
response1 = t1.get_settled_batch_list(dates here)
if response1.success?
response1.batch_list.each do |batch|
t2 = AuthorizeNet::Reporting::Transaction.new ...
response2 = t2.get_transaction_list(batch.id)
if response2.success?
transactions = response2.transactions
transactions.each do |t|

@dmitrypol
Copy link
Author

I have a workaround to query get_transaction_details(tran.id) for each transaction (99% of which do NOT have subscriptions) but that's pretty stupid.

Here is the response from http://developer.authorize.net/api/reference/#transaction-reporting-get-transaction-list, you can see that subscription is returned. Why doesn't the gem return it?

    {
        "transId": "2230382467",
        "submitTimeUTC": "2015-03-18T09:45:10Z",
        "submitTimeLocal": "2015-03-18T02:45:10",
        "transactionStatus": "settledSuccessfully",
        "firstName": "Tanya",
        "lastName": "Rowe",
        "accountType": "Visa",
        "accountNumber": "XXXX4242",
        "settleAmount": 10,
        "marketType": "eCommerce",
        "product": "Card Not Present",
        "subscription": {
            "id": 2343517,
            "payNum": 2
        },
        "hasReturnedItemsSpecified": false
    },

@dmitrypol dmitrypol changed the title Reporting API is not returning SubscriptionID field for transaction Reporting API is not returning SubscriptionID field for transaction via this gem Apr 1, 2015
@brianmc
Copy link
Contributor

brianmc commented Apr 8, 2015

Hi @dmitrypol, You are quite correct and the transaction list should have the properties set. The fix is quite simple, I have tested it locally but not had a chance to commit anything to github yet. The following should be added after line 54 in https://github.com/AuthorizeNet/sdk-ruby/blob/master/lib/authorize_net/reporting/response.rb

            subscription = child.at_css('subscription')
            unless subscription.nil?
                subscription_id = node_content_unless_nil(child.at_css('subscription').at_css('id'))
                transaction.subscription_id = subscription_id unless subscription_id.nil?

                pay_num = node_content_unless_nil(child.at_css('subscription').at_css('payNum'))
                transaction.subscription_paynum = pay_num unless pay_num.nil?
            end

@brianmc
Copy link
Contributor

brianmc commented Apr 8, 2015

See rspec & change on future branch here : 4e2a00f

@brianmc
Copy link
Contributor

brianmc commented May 28, 2015

I'm closing this one as we're close to releasing the fix. Thanks again for the issue.

@brianmc brianmc closed this as completed May 28, 2015
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

2 participants