diff --git a/app/Http/Controllers/Supply.php b/app/Http/Controllers/Supply.php index 2fdec1f..431de81 100644 --- a/app/Http/Controllers/Supply.php +++ b/app/Http/Controllers/Supply.php @@ -121,16 +121,34 @@ class Supply extends Controller } + //Should check that cost is not greater than price and store order + //information if completed. return false/NULL if an error occured public static function orderSmmkings($order, $supplier) { if ($supplier->supplier != 'smmkings') { return false; } + //Check that the order is not already pending. Probably by calling + //another function. + + //Check supplier cost here to make sure the request is a good idea + $response = Http::post(config("services.smmkings.link"), ['key' => config("services.smmkings.key"), 'action' => 'add', 'service' => $supplier->supplier_id, 'link' => $order->url, 'quantity' => $order->quantity])->json(); + //This should log the error for later reporting + if (array_key_exists('error', $response)){ + return + } + + //store order information here + + $status = Http::post(config("services.smmkings.link"), ['key' => + config("services.smmkings.key"), 'action' => 'status', + 'order' => $response['order']])->json(); + return $response; } diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index 3ed0b76..d427b4b 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -7,6 +7,17 @@ + @if (config('app.env') == 'production') + + + + @endif @show