Code Monkey home page Code Monkey logo

spreedly-gem's People

Contributors

adamcohen avatar almalee24 avatar bpollack avatar davidsantoso avatar duff avatar ecleel avatar fedesoria avatar gus avatar hoenth avatar ilyutov avatar jeremywrowe avatar jjthrash avatar jknipp avatar markabe avatar mateuszzawisza avatar motdotla avatar mrudult avatar ntalbott avatar patrickarnett avatar rwdaigle avatar seancribbs avatar sosedoff avatar therufs avatar tomharris avatar zeusperez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spreedly-gem's Issues

Calling `SpreedlyCore.configure` does not reset `basic_auth` in all classes

When calling configure repeatedly the basic_auth call to HTTParty results in the authentication parameters in not all classes in the hierarchy being updated.

To try it out:

irb(main):001:0> SpreedlyCore.configure environment_key: '3', access_secret: '4'

irb(main):002:0> SpreedlyCore::Base.default_options
=> {:basic_auth=>{:username=>"3", :password=>"4"}}

irb(main):003:0> SpreedlyCore::Gateway.default_options
=> {:basic_auth=>{:username=>"3", :password=>"4"}}

irb(main):004:0> SpreedlyCore.configure environment_key: '5', access_secret: '6'

irb(main):005:0> SpreedlyCore::Base.default_options
=> {:basic_auth=>{:username=>"5", :password=>"6"}}

irb(main):006:0> SpreedlyCore::Gateway.default_options
=> {:basic_auth=>{:username=>"3", :password=>"4"}}

The reason is that HTTParty uses mattr_inheritable :default_options which according to its documentation:

Allows attributes to be shared within an inheritance hierarchy, but where each > descendant gets a copy of their parents' attributes, instead of just a pointer to the same.

I guess SpreedlyCore.configure would have to call basic_auth on every class that inherits from Base separately. A maybe better alternative would be to move all HTTP calls into a separate client class.

Support for adding bank accounts

It seems like there is no equivalent to #add_credit_card for bank accounts. Is this something you would take a pull request for?

First six digits of CC

Noticed this in the change log on the Spreedly changelog on Apr. 22, 2014. Doesn't seem to be implemented in the gem yet? We use the first six digits to ping fraud prevention APIs so it's invaluable to our organization.

Support offsite gateways

The current gem doesn't support the integration of offsite gateways (paypal / gocardless) and their required fields (redirect_url, callback_url)

Untitled

Gem installed fine in development, but in production (Ubuntu) got this error message. It's a build dependency issue with Nokogiri (not spreedly).

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.
...

Gem files will remain installed in /opt/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.1 for inspection.
Results logged to /opt/ruby/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out

The solution in ubuntu was:
sudo apt-get install libxslt1-dev
then this works
sudo gem install spreedly

Voidable? & Refundable?

It would be helpful to know whether or not a purchase transaction was voidable or refundable using something other than a time stamp.

def refundable?

magic

end

def voidable?

unicorns

end

Flush all payment methods

Hi, there,

Is there an API method to flush all payment methods (credit cards) on gateway?

Doing something like this is not a best idea:

env.list_payment_methods do |cc|
  env.redact_payment_method(cc.token)
end

Needed mostly for testing purposes.

Search by metadata using list_payment_methods

Checking the API docs for list_payment_methods, it supports filtering by metadata, which is very handy, for example, for retrieving all payment methods associated to a user (userId set as metadata).

But checking list_payment_methods implementation, it only supports since_token.

Will this Ruby gem be updated to match with the API docs?

What would be the recommended workaround to adapt (add decorators) this gem to filter by metadata?

Remote test fails on `supports_disburse` field

The following test is failing because supports_disburse is not coming back from core xml:

ruby -Itest test/remote/remote_gateway_options_test.rb --name test_successfully_get_options

Don't raise exceptions for missing fields

When an API response does not have the expected fields, a parsing exception will result which makes it seem like the tx failed when in actuality it succeeded. We shouldn't fail parsing for missing fields, or should fail in a very predictable explicit fashion (like throw a clearly client-side exception).

/cc @spreedly/product-dev

De-emphasize support for the Spreedly gem

This spreedly gem is of dubious value (being a thing wrapper around a simple API and only supporting one specific client language). As an organization, Spreedly hasn't yet prioritized a first-class client library approach. So, until we have clear client support, we should discourage use of this gem when integrating to Spreedly (not a formal sun-setting yet, more of a recommendation/signal to our customers).

I believe that should take the following (but not exclusive) actions:

  • Add a note to this repo's readme discouraging its use and generally clarifying our stance on client libraries.
  • Update the example repos that might be using the gem to not use them anymore
  • Anything else?

Don't parse nil payment method attributes as empty strings

This gem is parsing nil attributes as empty strings and this caused unexpected errors in our application. I'm worried the same might happen to yours. Either way, this can probably be fixed.

Responses from GET core.spreedly.com/v1/payment_methods/YBEtVpJvKWed2bkitmP0MFS7OOc.{format} using JSON and XML apis. Then using gem.

Notice how gem response is the only one not having nil values.

XML:

<payment_method>
  <token>YBEtVpJvKWed2bkitmP0MFS7OOc</token>
  <created_at type="dateTime">2019-08-06T17:41:41Z</created_at>
  <updated_at type="dateTime">2019-08-06T17:42:38Z</updated_at>
  <email nil="true"/>
  <data nil="true"/>
  <storage_state>retained</storage_state>
  <test type="boolean">true</test>
  <metadata nil="true"/>
  <callback_url nil="true"/>
  <last_four_digits>0005</last_four_digits>
  <first_six_digits>378282</first_six_digits>
  <card_type>american_express</card_type>
  <first_name>LUIS</first_name>
  <last_name>SUAREZ</last_name>
  <month type="integer">8</month>
  <year type="integer">2024</year>
  <address1 nil="true"/>
  <address2 nil="true"/>
  <city nil="true"/>
  <state nil="true"/>
  <zip>12345</zip>
  <country nil="true"/>
  <phone_number nil="true"/>
  <company nil="true"/>
  <full_name>LUIS SUAREZ</full_name>
  <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
  <shipping_address1 nil="true"/>
  <shipping_address2 nil="true"/>
  <shipping_city nil="true"/>
  <shipping_state nil="true"/>
  <shipping_zip nil="true"/>
  <shipping_country nil="true"/>
  <shipping_phone_number nil="true"/>
  <payment_method_type>credit_card</payment_method_type>
  <errors>
  </errors>
  <verification_value></verification_value>
  <number>XXXX-XXXX-XXXX-0005</number>
  <fingerprint>5430cba1b3ca00de0e5297e3291686d259f6</fingerprint>
</payment_method>

JSON

{
    "payment_method": {
        "token": "YBEtVpJvKWed2bkitmP0MFS7OOc",
        "created_at": "2019-08-06T17:41:41Z",
        "updated_at": "2019-08-06T17:42:38Z",
        "email": null,
        "data": null,
        "storage_state": "retained",
        "test": true,
        "metadata": null,
        "callback_url": null,
        "last_four_digits": "0005",
        "first_six_digits": "378282",
        "card_type": "american_express",
        "first_name": "LUIS",
        "last_name": "SUAREZ",
        "month": 8,
        "year": 2024,
        "address1": null,
        "address2": null,
        "city": null,
        "state": null,
        "zip": "12345",
        "country": null,
        "phone_number": null,
        "company": null,
        "full_name": "LUIS SUAREZ",
        "eligible_for_card_updater": true,
        "shipping_address1": null,
        "shipping_address2": null,
        "shipping_city": null,
        "shipping_state": null,
        "shipping_zip": null,
        "shipping_country": null,
        "shipping_phone_number": null,
        "payment_method_type": "credit_card",
        "errors": [],
        "fingerprint": "5430cba1b3ca00de0e5297e3291686d259f6",
        "verification_value": "",
        "number": "XXXX-XXXX-XXXX-0005"
    }
}

and gem:

[14] pry(main)> SPREEDLY.find_payment_method('YBEtVpJvKWed2bkitmP0MFS7OOc')
#<Spreedly::CreditCard:0x007f9655ddd158
 @address1="",
 @address2="",
 @card_type="american_express",
 @city="",
 @company="",
 @country="",
 @created_at="2019-08-06T17:41:41Z",
 @data="",
 @eligible_for_card_updater="true",
 @email="",
 @errors=[],
 @fingerprint="5430cba1b3ca00de0e5297e3291686d259f6",
 @first_name="LUIS",
 @first_six_digits="378282",
 @full_name="LUIS SUAREZ",
 @last_four_digits="0005",
 @last_name="SUAREZ",
 @month="8",
 @number="XXXX-XXXX-XXXX-0005",
 @phone_number="",
 @state="",
 @storage_state="retained",
 @token="YBEtVpJvKWed2bkitmP0MFS7OOc",
 @updated_at="2019-08-06T17:42:38Z",
 @verification_value="",
 @year="2024",

Finish the remaining items from the Readme.

The README talks about a few features that haven't been implemented quite yet. Finish these.

  • List the transactions for a payment method
  • Allow adding other gateways.
  • Listing Payment Methods (retained on an account)
  • Updating a Payment Method
  • Listing Your Gateways
  • Finding a Gateway
  • Show the transcript for an individual transaction
  • Updating a Gateway
  • Meta info about gateways (curl -X OPTIONS https://core.spreedly.com/v1/gateways.xml)

When will the new version be available?

I would like to start with Spreedly, but I'm worried that as soon as I finish the implementation "at your own risk." this gem gets deprecated.

This is an example Ruby integration with Spreedly. This version is no longer actively updated and will be superseded by a new version in the near future. Feature parity may lag behind, so please use this gem at your own risk.

#<NoMethodError: undefined method `at_xpath' for nil:NilClass>

I'm intermittently getting this error when trying to make a charge.

transaction = spreedly.purchase_on_gateway(gateway_token, payment_token, session_price )

Any ideas?

NoMethodError: undefined method at_xpath for nil:NilClass from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/common/fields.rb:10:in block in initialize_fields from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/common/fields.rb:9:in each from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/common/fields.rb:9:in initialize_fields from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/gateway_transaction.rb:26:in initialize from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/gateway_transaction.rb:13:in new from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/gateway_transaction.rb:13:in initialize from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/auth_purchase.rb:11:in initialize from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/transaction.rb:14:in new from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/transactions/transaction.rb:14:in new_from from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/environment.rb:211:in api_post from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spreedly-2.0.4/lib/spreedly/environment.rb:43:in purchase_on_gateway from /Users/....../code/.../app/models/payment_manager.rb:11:in charge from (irb):12 from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in start from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in start from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus/rails.rb:134:in console ... 10 levels... from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:62:in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in block (3 levels) in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in fork from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in block (2 levels) in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:73:in each from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:73:in block in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:62:in loop from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:62:in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in block (3 levels) in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in fork from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:78:in block (2 levels) in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:73:in each from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:73:in block in go from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:62:in loop from /Users/....../.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb:62:in go from -e:1:in <main>irb(main):013:0>

return_url in release 1.3.2 and 1.3.1-16

Hi
I just find that the latest release version of the gem 1.3.2 do not include return_url.
At the other hand from project home page I can download as archive file version 1.3.1-16 which include return_url
Could you please release new gem (under 1.3.2) which will include return_url
Thanks
Tsvetelin

Support Stored Credentials

Spreedly provides a standard interface for Stored Credentials that requires two fields: stored_credential_initiator and stored_credential_reason_type. On some gateways, it is possible to use gateway specific fields to send and receive this data, but most of the eight gateways currently supported (and all new gateway implementations) only support the Spreedly Stored Credentials framework. Let's expose this first-class implementation via the gem.

Callback url can't be blank Redirect url can't be blank

Hi

response = env.purchase_on_gateway(gateway_token, payment_token, 33)

just calling the purchase_on_gateway method as it mentioned in the readme file, but it says callback url can't be blank. gatway is :test and payment_method_type is sprel.

I tried env.purchase_on_gateway(gateway_token, payment_token, 33, redirect_url: r_url, callback_url: c_url)

still doesn't seem to be working. What am I doing wrong? Thanks

Extra data isn't correctly parsed

I have a company_name sent in the data field during the payment method creation (transparent redirect). When I retrieve the payment method using the gem it returns .data as "<company_name></company_name>", it should parse the xml data and return an hash of values in this case data: {'company_name' => ''} or even better data.company_name (this could break names like "company-name")

Improve project description

Current project description: "The Spreedly gem provides a convenient Ruby wrapper Spreedly's Subscriptions API."

First, I'd say there are a few words missing in that sentence. But more importantly, I believe it's no longer accurate. It took me a while to figure out if this project was solely focusing on the Subscriptions API. And after reading the history file [1] and the project code, I understand now that it's probably the best wrapper out there for the Spreedly API.

The project description should probably make it more obvious.

[1] https://github.com/spreedly/spreedly-gem/blob/master/HISTORY.md

store_on_gateway - This API call cannot be made with a publishable API key

I have a Spreedly token that I want to store on the gateway (Stripe).
When I call
store_on_gateway(my_spreedly_provided_stripe_gateway_token, my_spreedly_provided_payment_method_token)
I receive

#<Spreedly::Store:0x00007f82c26e6148
...
@message="This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys."

According to the documentation the POST api call expects to receive "The token of the gateway to execute against" and "transaction | Root element โฏ payment_method_token required | The token of the payment method to copy to the gateway"
https://docs.spreedly.com/reference/api/v1/#store

looking on spreedly logs, I see the error returned from the Stripe API is
{\n \"error\": {\n \"code\": \"secret_key_required\",\n

However the endpoint doesn't seem to accept a secret key?

Are you able to give me any insights if I am using incorrect tokens or if the gem has a bug?
Thanks

Is there a way to test API credentials?

In our system users put API credentials (secret and environment key) via web GUI. Is there a way I could test creds (not actually add_gateway, add_credit_card or purchase_on_gateway)? Thanks,

unexpected private method error

When I try and emulate this in the IRB:

credit_card = env.find_payment_method(token)
credit_card.last_name # => "Jones"
credit_card.valid? # => false

I get this error:

credit_card.last_name
NoMethodError: private method `last_name' called for #Spreedly::CreditCard:0x007fa7186d7dd0
from (irb):22

This is true if I try first_name, last_name, email, even if I try valid?

verification_value ignored for add_credit_card and update_credit_card

I think the verification_value may have been left out of the acceptable params for adding a credit card.

In the environment class there are these methods and they are both missing :verification_value. For update it may not be valid to submit similar to the number attribute being excluded.

def add_credit_card_body(options)
  build_xml_request('payment_method') do |doc|
    add_to_doc(doc, options, :data, :retained, :email)
    doc.credit_card do
      add_to_doc(doc, options, :number, :month, :first_name, :last_name, :year,
                 :address1, :address2, :city, :state, :zip, :country, :phone_number)
    end
  end
end

def update_credit_card_body(options)
  build_xml_request('payment_method') do |doc|
    add_to_doc(doc, options, :email, :month, :first_name, :last_name, :year,
               :address1, :address2, :city, :state, :zip, :country, :phone_number)
  end
end

Complete receiver API

The ability to list the receivers you added, redact and update them are all missing features. Was there a reason these were excluded? If not, I can submit a PR to get this added. Thoughts? @bpollack

Feature: Return 'description' for Gateway tokens

We have a large number of gateway tokens. In order to assist the code with selecting a gateway token, we would like to have the "description" field of the gateway token returned as part of the list gateway and return gatweay methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.