TheoBong / Store

An in-game substitute for a webstore with fully dynamic Menus and easy-to-use interface.
MIT License
7 stars 2 forks source link

UNPROCESSABLE_ENTITY error/"null" player #4

Open untuned opened 2 years ago

untuned commented 2 years ago
[18:42:39 INFO]: [Store] {"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"ORDER_NOT_APPROVED","description":"Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"xxxxxxxxxxxxx","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED","rel":"information_link","method":"GET"}]}

Error on completing a purchase

[18:52:40 WARN]: [Store] Plugin Store vgit-Store-627204f generated an exception while executing task 15
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null
        at io.github.paypal.CaptureOrder.capture(CaptureOrder.java:66) ~[Store.jar:?]
        at io.github.paypal.CaptureTask.run(CaptureTask.java:36) ~[Store.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.19.2.jar:git-Purpur-1759]
        at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.19.2.jar:git-Purpur-1759]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.19.2.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
TheoBong commented 2 years ago

did paypal change their api endpoint bullshit again?

untuned commented 2 years ago

did paypal change their api endpoint bullshit again?

No actually, here's the issue: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null https://github.com/TheoBong/Store/blob/9112cbea19c745b5f6b22f8b1f8d90a13731457c/src/main/java/io/github/paypal/CaptureOrder.java#L66

I'm running the plugin on a 1.19.2 server.

Current: git-Purpur-1774 (MC: 1.19.2)*
Previous: git-Purpur-1770 (MC: 1.19.2)
* You are running the latest version
TheoBong commented 2 years ago

Its null because theres an issue up the line when the paypal API call is made. If the paypal api returns an error instead of the response expected (when i wrote this), it will cause issues down the line. I'm 90% sure its a paypal api change that broke the plugin since this didn't happen when I wrote it.

I might fix this in the future or more likely, just rewrite. Don't be counting on it anytime soon though. Feel free to add it yourself and make a pull request though.