activemerchant / active_merchant

Active Merchant is a simple payment abstraction library extracted from Shopify. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
http://activemerchant.org
MIT License
4.54k stars 2.5k forks source link

Bug with Recurring Payments in Cybersource #719

Closed spiritbear closed 11 years ago

spiritbear commented 11 years ago

I was working on integrating ActiveMerchant with my Rails App when I ran into a couple of issues with CyberSource and the way recurring payments are handled.

1) Overriding Subscription Parameters

In the cyber_source.rb file https://github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/gateways/cyber_source.rb

on line 306 the parameters get overridden by some default values, e.g the payment type changes to "on-demand", the amount to 0, and automatic_renew to false.

2) While creating a recurring subscription I get a 500 Internal Server Error.

[ActiveMerchant::Billing::CyberSourceGateway] --> 500 Internal Server Error (427 0.1868s)
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns:c="urn:schemas-cybersource-com:transaction-data-1.0">
      <faultcode>soap:Client</faultcode>
      <faultstring>XML parse error.Element 'recurringSubscriptionInfo' not expected.</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

I changed the library around a little bit and managed to get it working. I wanted to make sure that this is really a bug and not me using the library incorrectly.

I can submit a fix if someone can verify if this is a bug.

ntalbott commented 11 years ago

We'll have to take your word for it - I don't think any of the maintainers use the recurring API. You could git blame and try contacting the original contributor as well.

spiritbear commented 11 years ago

Ok, I will fix the changes, write test cases and submit a pull request

petersooley commented 11 years ago

@spiritbear How did you change the library around to fix this?

spiritbear commented 11 years ago

@psoots I have not checked that code in, we were busy with other stuff, but it simply involves changing the way the xml is generated (which means changing the order in which functions are called.). Did you want more specific details?

petersooley commented 11 years ago

Yeah, if you could at least point me to a reasonable fix/workaround, that would be super helpful.

rousselle commented 11 years ago

@spiritbear we have run into this problem. It would be very helpful if you could check in the fix. It would save us from duplicating your effort. Thanks Much.

spiritbear commented 11 years ago

Yes sorry guys things have been a little hectic at my end, I will go back and check in my fix within a couple of days.

spiritbear commented 11 years ago

I have created a branch with my changes and completed testing, I am trying to push the branch and I get an error.

ERROR: Permission to Shopify/active_merchant.git denied to spiritbear. fatal: The remote end hung up unexpectedly

I have never submitted a pull request before, can someone help me out with this?

spiritbear commented 11 years ago

Figured it out, submitted a patch. Let me know if you need anything else.

ntalbott commented 11 years ago

Superseded by #774.