codeswholesale / codeswholesale-sdk-php

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

Postback related #31

Closed Sammyy96 closed 6 years ago

Sammyy96 commented 6 years ago

Hi there! There is no documentation as to how the postback works for version 2 of your sdk. I analyzed testpostbacks, by sending data to myself.

Issue 1: The authMash code doesn't match the signature I was given. Issue 2: Your sdk retrieves prices $prices->from, $prices->to, which looks like the json attributes in the documentation examples. However, your test postback sends an array of objects containing prices with different attributes such as: "priceRangeLabel", "price". Issue 3: Your documentation doesn't describe what you actually postback to client and how it works. For instance, you have a hiding postback, but how do I know when it should no longer be hidden?

Best regards

codeswholesale commented 6 years ago

Hey there,

Issue 1: The authMash code doesn't match the signature I was given. You are completly right! Just pushed and released new release which fix this issue

Issue 2: Your sdk retrieves prices $prices->from, $prices->to, which looks like the json attributes in the documentation examples. However, your test postback sends an array of objects containing prices with different attributes such as: "priceRangeLabel", "price". Take a look and StockAndPriceChange class, this is what you will receive when postback came.

Issue 3: Your documentation doesn't describe what you actually postback to client and how it works. For instance, you have a hiding postback, but how do I know when it should no longer be hidden? It will came as notification of new product. You can interprate hidden as deleted.

Hope that helps. Let me know if you have more questions.

Sammyy96 commented 6 years ago

Thank you, that cleared up some things! I will take a look at the StockAndPriceChange class. Although still confused it returned different arguments.

Sammyy96 commented 6 years ago

Hello just a question about issue 2(prices). In the json in the api docs you have different arguments for price. This is also found in product.php `public function getDefaultPrice()

{

    $prices = $this->getPrices();

    foreach ($prices as $price) {

        if ($price->from == 1) {

            return $price->value;

        }

    }

}` 

why is it that the price arguments posted from you vs retrieved from you are different? I find this a bit confusing, why not use one or the other instead of both?

Sammyy96 commented 6 years ago

Another question.. The test postback at your website doesn't actually send back any existing product Ids that exist in the sandbox. So if you were testing you would get no useful values to test if your application actually works.

codeswholesale commented 6 years ago

Hey,

Good idea, we will implement it. Currently, I can't provide you ETA. Hope that will arive on production on this week.