[Java API] Error Creating Discount


#1

It seems as though the methods that are used to create and update a discount within the Java API do not have the useWithSale parameter that they should.

Methods In Question:

@POST("/shop/{sid}/discount")
CompletableFuture<ShopDiscount> createDiscount(@Path("sid") String shopId, @Query("name") String name, @Query("amount") double amount, @Query("percent") boolean percent, @Query("active") boolean active, @Query("starts") long starts, @Query("ends") long ends, @Query("code") String code, @Query("maxUses") int masUses);

@PATCH("/shop/{sid}/discount/{discount}")
CompletableFuture<ShopDiscount> updateDiscount(@Path("sid") String shopId, @Path("discount") String saleId, @Query("name") String name, @Query("amount") double amount, @Query("percent") boolean percent, @Query("active") boolean active, @Query("starts") long starts, @Query("ends") long ends, @Query("code") String code, @Query("maxUses") int masUses);

Error Message: (using createDiscount)
image

Full Stack Trace: (using createDiscount)

01.09 16:40:50 [Server] WARN java.util.concurrent.CompletionException: co.melondev.cubedpay.CubedPayException: Missing Parameter (useWithSale) please see documentation. (Build)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture.uniAccept(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
01.09 16:40:50 [Server] WARN at retrofit2.adapter.java8.Java8CallAdapterFactory$BodyCallAdapter$2.onFailure(Java8CallAdapterFactory.java:114)
01.09 16:40:50 [Server] WARN at retrofit2.OkHttpCall$1.callFailure(OkHttpCall.java:135)
01.09 16:40:50 [Server] WARN at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:118)
01.09 16:40:50 [Server] WARN at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
01.09 16:40:50 [Server] WARN at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
01.09 16:40:50 [Server] WARN at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
01.09 16:40:50 [Server] WARN at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
01.09 16:40:50 [Server] WARN at java.lang.Thread.run(Unknown Source)
01.09 16:40:50 [Server] WARN Caused by: co.melondev.cubedpay.CubedPayException: Missing Parameter (useWithSale) please see documentation. (Build)
01.09 16:40:50 [Server] WARN at co.melondev.cubedpay.envelope.APIEnvelopeTransformerConverter.convert(APIEnvelopeTransformerConverter.java:40)
01.09 16:40:50 [Server] WARN at co.melondev.cubedpay.envelope.APIEnvelopeTransformerConverter.convert(APIEnvelopeTransformerConverter.java:13)
01.09 16:40:50 [Server] WARN at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
01.09 16:40:50 [Server] WARN at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217)
01.09 16:40:50 [Server] WARN at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:116)
01.09 16:40:50 [Server] WARN ... 5 more

#2

Hey Bert,
Just pushed out a fix to the library to include those in said methods with the last commit. Not going to push out another update for a little bit to make sure everything is stable.

Thanks
Cameron


#3

Thank you for the update :smiley: It behaved normally this time, so that’s good. I think that it would be a good idea to look into [Java API] Error Creating Transaction before releasing the next version since it seems to be the only Java client-specific issue that has been discovered that hasn’t been fixed.