Bad request on creating PaymentOrder
Closed this issue · 1 comments
I am trying to use Instamojo java API in clojure.
So when I call createPaymentOrder
with Payment order object it gives com.instamojo.wrapper.exception.HTTPException: Bad Request.
Same happens when I try InstamojoExample.java
in java.
I am using Test credential for Java Wrapper with ApiContext.Mode.TEST
This is my order object :
(def porder (PaymentOrder.)) (.setName porder "Jo1212emith") (.setEmail porder "jo1hn.smieth@gmail.com") (.setPhone porder "3145628790") (.setCurrency porder "INR") (.setAmount porder (Double/parseDouble "109.0")) (.setDescription porder "This is a test transaction.") (.setRedirectUrl porder "https://www.instamojo.com/@codelitelabsprivatelimited") (.setWebhookUrl porder "http://www.someurl.com/") (.setTransactionId porder "QSDWDWDWD")
Response
Mar 12, 2019 12:13:55 PM com.instamojo.wrapper.util.HttpUtils post INFO: Sending POST request to the url https://test.instamojo.com/oauth2/token/ Mar 12, 2019 12:13:56 PM com.instamojo.wrapper.util.HttpUtils post INFO: Sending POST request to the url https://test.instamojo.com/v2/gateway/orders/ com.instamojo.wrapper.exception.HTTPException: Bad Request, compiling:(core.clj:29:13) Exception in thread "main" com.instamojo.wrapper.exception.HTTPException: Bad Request, compiling:(core.clj:29:13) at clojure.lang.Compiler$InstanceMethodExpr.eval(Compiler.java:1532) at clojure.lang.Compiler$DefExpr.eval(Compiler.java:451) at clojure.lang.Compiler.compile1(Compiler.java:7474) at clojure.lang.Compiler.compile(Compiler.java:7541) at clojure.lang.RT.compile(RT.java:406) at clojure.lang.RT.load(RT.java:451) at clojure.lang.RT.load(RT.java:419) at clojure.core$load$fn__5677.invoke(core.clj:5893) at clojure.core$load.invokeStatic(core.clj:5892) at clojure.core$load.doInvoke(core.clj:5876) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5697) at clojure.core$compile$fn__5682.invoke(core.clj:5903) at clojure.core$compile.invokeStatic(core.clj:5903) at clojure.core$compile.invoke(core.clj:5895) at user$eval20$fn__29.invoke(form-init5090599396103381016.clj:1) at user$eval20.invokeStatic(form-init5090599396103381016.clj:1) at user$eval20.invoke(form-init5090599396103381016.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$init_opt.invokeStatic(main.clj:277) at clojure.main$init_opt.invoke(main.clj:277) at clojure.main$initialize.invokeStatic(main.clj:308) at clojure.main$null_opt.invokeStatic(main.clj:342) at clojure.main$null_opt.invoke(main.clj:339) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: com.instamojo.wrapper.exception.HTTPException: Bad Request at com.instamojo.wrapper.util.HttpUtils.post(HttpUtils.java:141) at com.instamojo.wrapper.api.InstamojoImpl.createPaymentOrder(InstamojoImpl.java:39) 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:93) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at clojure.lang.Compiler$InstanceMethodExpr.eval(Compiler.java:1527) ... 35 more Compilation failed: Subprocess failed
In java I was able to see the error, phone number value was not in right format.