Skip to content

Commit

Permalink
processOrder Call added
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Jun 30, 2024
1 parent 2686095 commit db31ae0
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 182 deletions.
2 changes: 1 addition & 1 deletion src/Http/Controllers/AssignVendorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function process(AssignableVendorInfoRequest $request): JsonResponse

$order = $this->getOrder($order_id);

$jsonResponse = Remit::assignVendor()->requestQuote($order, $service_vendor_slug);
$jsonResponse = Remit::assignVendor()->processOrder($order, $service_vendor_slug);

return response()->success($jsonResponse);

Expand Down
10 changes: 7 additions & 3 deletions src/Services/AssignVendorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Fintech\Business\Facades\Business;
use Fintech\Core\Abstracts\BaseModel;
use Fintech\Remit\Contracts\OrderQuotation;
use Fintech\Remit\Contracts\ProceedOrder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\App;

Expand Down Expand Up @@ -56,13 +57,16 @@ public function processOrder(BaseModel $order, string $vendor_slug): mixed

$driverClass = $vendor['driver'];

/**
* @var $instance ProceedOrder
*/
$instance = App::make($driverClass);

if (! $instance instanceof OrderQuotation) {
throw new ErrorException('Service Vendor Class is not instance of `Fintech\Remit\Contracts\OrderQuotation` interface.');
if (! $instance instanceof ProceedOrder) {
throw new ErrorException('Service Vendor Class is not instance of `Fintech\Remit\Contracts\ProceedOrder` interface.');
}

return $instance->requestQuote($order);
return $instance->processOrder($order);
}

public function orderStatus(BaseModel $order, string $vendor_slug): mixed
Expand Down
Loading

0 comments on commit db31ae0

Please sign in to comment.