codeswholesale / codeswholesale-sdk-php

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

Blocking the possibility of having preorders instead of regular order (image or text) #9

Closed rchoffardet closed 7 years ago

rchoffardet commented 8 years ago

Hello there,

Me and my organization would like to have to possibility to get preorder while ordering products from you. Could you add this feature ? Would help a lot :)

Currently we just check the specified product's stock before ordering. But this way is vulnerable to concurrent access and then not 100% secure. So yeah, adding this feature would be great.

regards,

codeswholesale commented 8 years ago

Hello @petitkoalak,

We have such a function! Take a look below:

$product = \CodesWholesale\Resource\Product::get($url);

$code = \CodesWholesale\Resource\Order::createOrder($product);

   if($code->isPreOrder()) {
        echo "Pre-order";
    }

While you creating the order you can recognize that game which has been ordered is PreOrder.

In that case, you can also handle it via receiving postback:

    $productOrdered = $client->receiveProductOrdered();

    $allCodesFromProduct = \CodesWholesale\Resource\Order::getCodes($productOrdered);

    foreach ($allCodesFromProduct as $code) {

        if ($code->isPreOrder()) {
            // check if still some codes are in pre-order state
            echo "Pre-order <br />";
        }

    }

Simply add your custom URL under our RestAPI tab on app.codeswholesale.com to handle request from CodesWholesale.

Hope that helps you!

Best Regards, Maciej

rchoffardet commented 8 years ago

I knew that. I don't want to detect if the order is a preorder or not, I would like to prevent it.

codeswholesale commented 8 years ago

Hey,

Okey, now I understand. So you want to list only available games with stock.

I am adding it to my tasks.

Best Regards, Maciej

rchoffardet commented 8 years ago

No, I would to have only text or image orders, no preorder. And if there is no stock available, it could send an error message or just an empty result

rchoffardet commented 8 years ago

Hey, any news ? :)

codeswholesale commented 8 years ago

Hello @petitkoalak,

This feature will be added as soon as it is possible.

Best Regards, Maciej

rchoffardet commented 7 years ago

Hey, Do you have any news concerning this issue ? I know it's been but still. :)