clojurewerkz / elephant Goto Github PK
View Code? Open in Web Editor NEWModern Clojure client for the Stripe API
Modern Clojure client for the Stripe API
I wanted to retrieve the total count of customers. According to the documentation for the upstream Stripe API,
You can optionally request that the response include the total count of all
customers that match your filters. To do so, specify include[]=total_count in
your request.
However, I couldn't figure out if this is possible using Elephant and the clojurewerkz.elephant.customers/list
function. I tried using (ecr/list {"include[]" "total_count"})
but, as the result is always a plain sequence of customer maps, the count was not accessible.
Version
1.0.0-beta18
Behaviour
The customer "Create" function only has one method signature, which does not take an API-key.
(defn ^IPersistentMap create [^IPersistentMap m] (cnv/customer->map (Customer/create m)))
Expected behaviour
The customer "Create" function should have an additional method signature which takes the API-key. Something similar to the charge "Create" function:
(defn create ([m] (cnv/charge->map (Charge/create (wlk/stringify-keys m)))) ([^String api-key m] (cnv/charge->map (Charge/create (wlk/stringify-keys m) api-key))))
Additional info
It is my understanding that you would need to pass your API-key to actually create real customers tied to your Stripe account. Am I correct that this is currently a missing feature? If so, would you encourage a pull request to add this?
Thanks!
Any chance you could push the current code to a new beta artifact? My PR (#9) was merged back in November, and I'm just hoping I can avoid this warning every time I compile.
WARNING: list already refers to: #'clojure.core/list in namespace: clojurewerkz.elephant.charges, being replaced by: #'clojurewerkz.elephant.charges/list
Thanks
I'm getting the following error:
com.stripe.exception.InvalidRequestException: This customer has no attached payment source or default payment method.
at com.stripe.net.LiveStripeResponseGetter.handleAPIError(LiveStripeResponseGetter.java:591)
at com.stripe.net.LiveStripeResponseGetter._request(LiveStripeResponseGetter.java:443)
at com.stripe.net.LiveStripeResponseGetter.request(LiveStripeResponseGetter.java:65)
at com.stripe.net.APIResource.request(APIResource.java:140)
at com.stripe.model.Customer.createSubscription(Customer.java:478)
at com.stripe.model.Customer.createSubscription(Customer.java:320)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
at clojurewerkz.elephant.subscriptions$create.invokeStatic(subscriptions.clj:32)
at clojurewerkz.elephant.subscriptions$create.invoke(subscriptions.clj:29)
at vendo.routes.home$create_subscription.invokeStatic(home.clj:62)
at vendo.routes.home$create_subscription.invoke(home.clj:56)
at muuntaja.middleware$wrap_params$fn__8119.invoke(middleware.clj:52)
at muuntaja.middleware$wrap_format$fn__8123.invoke(middleware.clj:73)
at vendo.middleware$wrap_formats$fn__9256.invoke(middleware.clj:40)
at reitit.ring$ring_handler$fn__15124.invoke(ring.cljc:326)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:384)
at ring.middleware.reload$wrap_reload$fn__4448.invoke(reload.clj:39)
at selmer.middleware$wrap_error_page$fn__4463.invoke(middleware.clj:18)
at prone.middleware$wrap_exceptions$fn__4704.invoke(middleware.clj:159)
at ring.middleware.flash$wrap_flash$fn__8361.invoke(flash.clj:39)
at ring.middleware.session$wrap_session$fn__8728.invoke(session.clj:108)
at ring.middleware.keyword_params$wrap_keyword_params$fn__8774.invoke(keyword_params.clj:53)
at ring.middleware.nested_params$wrap_nested_params$fn__8832.invoke(nested_params.clj:89)
at ring.middleware.multipart_params$wrap_multipart_params$fn__8964.invoke(multipart_params.clj:171)
at ring.middleware.params$wrap_params$fn__8988.invoke(params.clj:67)
at ring.middleware.cookies$wrap_cookies$fn__8679.invoke(cookies.clj:214)
at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn__9176.invoke(absolute_redirects.clj:47)
at ring.middleware.resource$wrap_resource_prefer_resources$fn__9024.invoke(resource.clj:25)
at ring.middleware.content_type$wrap_content_type$fn__9124.invoke(content_type.clj:34)
at ring.middleware.default_charset$wrap_default_charset$fn__9148.invoke(default_charset.clj:31)
at ring.middleware.not_modified$wrap_not_modified$fn__9090.invoke(not_modified.clj:61)
at ring.middleware.x_headers$wrap_x_header$fn__8324.invoke(x_headers.clj:22)
at ring.middleware.x_headers$wrap_x_header$fn__8324.invoke(x_headers.clj:22)
at ring.middleware.x_headers$wrap_x_header$fn__8324.invoke(x_headers.clj:22)
at vendo.middleware$wrap_internal_error$fn__9250.invoke(middleware.clj:19)
at aleph.http.server$handle_request$fn__29655$f__16451__auto____29656.invoke(server.clj:158)
at clojure.lang.AFn.run(AFn.java:22)
at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
at manifold.executor$thread_factory$reify__16333$f__16334.invoke(executor.clj:44)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
When using [clojurewerkz.elephant.customers :as cust]
(cust/create {"email" (:email (:params req))
"payment_method" (:payment-method-id (:params req))
})
I have the payment_method key, yet I'm seeing this error. How to fix this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.