codeswholesale / codeswholesale-sdk-php

A PHP wrapper for CodesWholesale's API
Apache License 2.0
36 stars 21 forks source link

Issue with hash or postback #35

Open Sammyy96 opened 6 years ago

Sammyy96 commented 6 years ago

Hello, I'm here to tell you that my live postback system has been tested thoroughly and worked. However, your system sending the postbacks, are for one or more callbacks sending a wrongly encoded hash. For instance, everything works when I send postbacks myself with correctly encoded hashs, but I am not receiving any added product even though they should be. Either the hash your api is sending is wrong or you are not sending some postback data at all. I know it is not completely related to this this SDK, but I am writing here in case the support doesn't understand this..

codeswholesale commented 6 years ago

Hey there @Sammyy96,

Your message alarmed me as this is our major feature enabling our customers to make proper orders on CodesWholesale. I’ve investigated this case and found that you must have made a mistake at the post-back stage. Let me show you the flow:

  1. On CodesWholesale you have 2 options to receive postback. It can be either a test postback or a live postback (this one is sent directly from our production API). Take a look at the screenshots below:

a) Test 1

b) Production 2

In this situation you need to pick the right environment: test or production. If you are using test instance, you need to provide test client_id, client_secret, and signature (to be found directly in our php-sdk code) and use postback tool form (see screenshot a).

$params = [ 'cw.client_id' => 'ff72ce315d1259e822f47d87d02d261e', 'cw.client_secret' => '$2a$10$E2jVWDADFA5gh6zlRVcrlOOX01Q/HJoT6hXuDMJxek.YEo.lkO2T6', 'cw.signature' => 'b4cded07-e13e-4021-8b9f-a3cee994109b', 'cw.endpoint_uri' => CodesWholesale::SANDBOX_ENDPOINT, 'cw.token_storage' => new TokenSessionStorage() ];

On other hand, if you want to test production environment and run your store, provide production account details (you can generate them on our website). Next, put the postback url in the box (see screenshot b).

This should resolve your issues with receiving not valid authHash’s. Let me know if this helps you. Good luck!

Sammyy96 commented 6 years ago

No I have it on live. With all due respect, I have tested both live and offline by sending your json data from hurl with already existing products. It works when it doesn't come from your server. I have noticed in live production I do get updates, but added products are never received(probably not valid hash or object type). I think maybe this error exists for pre-order, deletetion and possibly one of the updates too.

Sammyy96 commented 6 years ago

Also the fake properties contain no productId for test products which I see as a major flaw which is why I had to edit testreponses and send from hurl, which works.

codeswholesale commented 6 years ago

Hey,

Okay, now I am on the right track to find the issue you are facing. I'll be back with an answer once I've tested all these steps.

Cheers!

Sammyy96 commented 6 years ago

Any updates? This is still not working

fefrik commented 4 years ago

Any progress with that? Sometimes it works, sometimes not. I guess there is a limit how offten you can call CW API. There is needed aprox. 1 request per 1 second to contact oauth endpoint. I am able to use my credentials, but when I enable postback feature it starting resturn 403 - Access Denied after some time.