Giter Club home page Giter Club logo

lago-ruby-client's People

Contributors

ansmonjol avatar chendo avatar dependabot[bot] avatar ivannovosad avatar jdenquin avatar joeltaylor avatar lovrocolic avatar mariedw75 avatar prognostikos avatar rsempe avatar tnlong311 avatar vincent-pochet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lago-ruby-client's Issues

[BUG]: License Confusion

Describe the bug
A clear and concise description of what the bug is.

In Readme.md, we read that this client is licensed under the MIT license. This is also reflected in (License copy) in the repository. However, in the Gemspec, and in the LICENSE file, we read that the gem is AGPL licensed.

To Reproduce
Steps to reproduce the behavior:
View files listed in description
Experience confusion as to which license applies to usage of this gem.

Expected behavior
I should be able to determine what license applies to this gem.

Screenshots
Not Applicable

Support
Not Applicable

Additional context

[BUG]: Getting a Customer doesn't URL encode the external_id, so it 404s.

Describe the bug
For example, let's use rails global id as the external_id, like: gid://app/Customer/1234.
This works fine as the external_id when creating the customer, but when going to retrieve the Customer, it fails with a 404.
However, running URI.encode_www_form_component on the external_id first retrieves the Customer correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Customer with the external id: gid://app/Customer/1234
  2. client.customers.get("gid://app/Customer/1234")

Expected behavior
Step 2 should return a Customer.
The client should encode the external_id before performing the request.

Support

  • OS: Arch Linux
  • Browser: Firefox 116.0.3
  • Version: 0.44.0-beta

Additional context
It's likely this issue effects more than just the Customer get request, but I have only tested it on Customer.

[BUG]: error_code is a string, not an integer

I guess this could be debatable if it is in fact a bug, but I think it is at least surprising.

In a Lago::Api::HttpError, the #error_code method returns a string, not an integer. This is apparently what Net::Http returns in its response.code method as it's the source of the value.

In every other ruby Http client that I've used (Faraday, Excon, etc) the code is an integer which allows matching against Rails' http symbols like :not_found etc.

Happy to provide a PR for this, either to change the type of the return value or at a minimum to document it in the README (or both)

[BUG]: creating an event returns a boolean and seems to succeed even when I would expect it to fail.

Describe the bug
I am testing sending events to Lago using this gem. I get a boolean response where I would expect a representation of the resource that was create or some kind of http response object. In addition, if I send an event with a customer_id that doesn't exist in Lago I get the same true response.

To Reproduce

client = Lago::Api::Client.new(api_key: ENV['LAGO_API_KEY'])
r = client.events.create(transaction_id: SecureRandom.uuid, customer_id: 2010, code: :mobilepay_transaction, properties: { donation_id: 12345 })
=> true
r = client.events.create(transaction_id: SecureRandom.uuid, customer_id: 20100000, code: :mobilepay_transaction, properties: { donation_id: 12345 })
=> true

Expected behavior
I expect the response to fail if the customer_id doesn't exist in Lago. I also expect to get either an HTTP response that I can check the status and headers of or a representation of the resource created by the API call.

[BUG]: Error in client.customers.checkout_url, function leads to URI::InvalidURIError

Describe the bug
The client.customers.checkout_url('external_id') function is encountering an URI::InvalidURIError. The error message suggests that the URI being constructed is invalid, leading to the issue.

Error:

Error:
URI::InvalidURIError in SubscriptionsController#test_lago
bad URI(is not URI?): "https://your-lago-host.com:443{:identifier=>nil}"

To Reproduce
Steps to reproduce the behavior:

  1. Set up Stripe integration in Lago frontend host
  2. Create a customer in Lago frontend host with external_id "12345". Add payment provider information as Stripe and enable auto create customer in Stripe.
  3. In client rails project, initialize a client and call the function:
@billing_client = Lago::Api::Client.new(api_key: API_KEY, api_url: LAGO_FRONT_URL)
@billing_client.customers.checkout_url("12345")
  1. Observe the URI::InvalidURIError and the associated error message.

Expected behavior:
The checkout_url function should successfully call the POST API and return the following object:

{
  "checkout_url": "https://foo.bar",
  "external_customer_id": "12345",
  "lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
  "payment_provider": "stripe"
}

Additional context
Api is used here: https://docs.getlago.com/api-reference/customers/psp-checkout-url

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.