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

billing questions #2

Open
podviaznikov opened this issue Feb 22, 2014 · 6 comments · May be fixed by #3
Open

billing questions #2

podviaznikov opened this issue Feb 22, 2014 · 6 comments · May be fixed by #3
Labels

Comments

@podviaznikov
Copy link
Contributor

Hi,

thanks for the great library. I think it is really well designed.

I'm having some trouble with billing API.

(shop/save! :recurring_application_charge
                     {:name "Super Duper Plan"
                      :price  10.0
                      :return_url "http://localhost:3000"} auth)

Do you think this code should work? Should it return something? I have proper auth object.

Another question: can I see some debug information? For me this method returns just nil.

@jamesmacaulay jamesmacaulay linked a pull request Feb 25, 2014 that will close this issue
3 tasks
@jamesmacaulay
Copy link
Owner

Thanks for the report. I've confirmed that it's a bug with extracting multi-word resource names (it was looking for the underscored_version, but the keywords had already been converted-to-dashes).

I've got a work-in-progress fix (#3) that you can try out right now. I'll try to get it into a patch release soon.

@jamesmacaulay
Copy link
Owner

Some more clarification:

  • the function was actually correctly sending the request, so a resource was probably correctly created as the result of your call.
  • the function was returning nil because the library was returning the value of the key :recurring_application_charge in the response, but by that point other code had transformed the key to :recurring-application-charge. I need to make all the code for converting between dashes and underscores less brittle.

@podviaznikov
Copy link
Contributor Author

Thank you for looking into it!

@podviaznikov
Copy link
Contributor Author

Hi, I can confirm that call for creating charge is working.

Can you please tell me how to activate charge?

I'm not quite sure with what parameters to call save! for such resource /admin/recurring_application_charges/455696195/activate.json.

@jamesmacaulay
Copy link
Owner

Good question. I don't think there's a very good way of doing this right now that is integrated into the documented API of this library. However, you can build up the request manually and send it like so:

(defn activate-recurring-charge!
  "Sends a request to activate the charge with the given id"
  [id auth]
  (-> auth
      (assoc
        :method :post
        :uri (str "/admin/recurring_application_charges/" id "/activate"))
      (shopify.resources/request)))

(shopify.resources/request is the function that actually performs the request)

@podviaznikov
Copy link
Contributor Author

Thanks! That worked

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

Successfully merging a pull request may close this issue.

2 participants