Skip to content

Commit

Permalink
Merge pull request #2720 from bakaphp/hotfix/branch-listing
Browse files Browse the repository at this point in the history
hotfix: orders
  • Loading branch information
kaioken authored Dec 23, 2024
2 parents 5142e3f + 64248fd commit 62ed77f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

use Baka\Support\Str;
use Kanvas\Apps\Models\Apps;
use Kanvas\Companies\Models\Companies;
use Kanvas\Companies\Models\CompaniesBranches;
use Kanvas\Connectors\Stripe\Enums\ConfigurationEnum;
use Kanvas\Exceptions\ValidationException;
use Kanvas\Souk\Orders\Models\Order;
use Kanvas\Users\Models\UserCompanyApps;
use Stripe\PaymentIntent;
use Stripe\Stripe;

Expand All @@ -36,6 +38,12 @@ public function generatePaymentIntent(mixed $root, array $request): array
$company = $user->getCurrentCompany();
$orderId = $request['id'];

if ($app->get('USE_B2B_COMPANY_GROUP')) {
if (UserCompanyApps::where('companies_id', $app->get('B2B_GLOBAL_COMPANY'))->where('apps_id', $app->getId())->first()) {
$company = Companies::getById($app->get('B2B_GLOBAL_COMPANY'));
}
}

$order = Order::getByIdFromCompanyApp($orderId, $company, $app);

if ($order->isFulfilled()) {
Expand Down

0 comments on commit 62ed77f

Please sign in to comment.