fix on payment by cb
This commit is contained in:
@@ -222,7 +222,8 @@ class Articles
|
||||
{
|
||||
$saleChannelId = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||
$model = self::getModelByOptions($options);
|
||||
$data = $model->withAvailableOffers($saleChannelId)->with([
|
||||
|
||||
return $model->withAvailableOffers($saleChannelId)->with([
|
||||
'image',
|
||||
'product',
|
||||
'article_nature',
|
||||
@@ -238,14 +239,6 @@ class Articles
|
||||
'offers.tariff.price_lists.price_list_values',
|
||||
'offers.variation.package',
|
||||
])->get();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getArticleNaturesOptionsWithOffers($options = false)
|
||||
{
|
||||
$ids = self::getArticleNaturesIdsWithOffers($options);
|
||||
|
||||
}
|
||||
|
||||
public static function getArticleNaturesWithOffers($options = false)
|
||||
@@ -294,7 +287,7 @@ class Articles
|
||||
|
||||
$model = ($options['homepage'] ?? false) ? Article::homepage()->visible() : Article::visible();
|
||||
$model = $category_id ? $model->byCategoryParent($category_id) : $model;
|
||||
$model = $tags ? $model->byTagsSelected($tags) : $model;
|
||||
$model = $tags ? $model->byTags($tags) : $model;
|
||||
$model = $search ? $model->search($search) : $model;
|
||||
$model = $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
$model = $article_nature_ids ? $model->byArticleNatures($article_nature_ids) : $model;
|
||||
@@ -305,6 +298,8 @@ class Articles
|
||||
case 'merchandise':
|
||||
$model = $model->merchandise();
|
||||
break;
|
||||
default:
|
||||
$model = $model->botanic();
|
||||
}
|
||||
|
||||
return $model;
|
||||
@@ -313,9 +308,8 @@ class Articles
|
||||
public static function getFull($id)
|
||||
{
|
||||
$data['article'] = self::getArticleEdit($id);
|
||||
self::getMeta($data);
|
||||
|
||||
return $data;
|
||||
|
||||
return self::getMeta($data);
|
||||
}
|
||||
|
||||
public static function getArticleEdit($id)
|
||||
@@ -378,6 +372,7 @@ class Articles
|
||||
'tags' => $product->tags->toArray(),
|
||||
];
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return $data ?? false;
|
||||
@@ -395,6 +390,7 @@ class Articles
|
||||
case 'App\Models\Shop\Merchandise':
|
||||
$images = Merchandises::getImages($product_id);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return $images ?? false ? ['images' => $images] : false;
|
||||
@@ -538,8 +534,12 @@ class Articles
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$variety = $article->product ?? false;
|
||||
$specie = $variety->specie ?? false;
|
||||
$images = $variety ? (count($variety->images ?? []) ? $images->merge($variety->images) : $images) : $images;
|
||||
$images = $specie ? (count($specie->images ?? []) ? $images->merge($specie->images) : $images) : $images;
|
||||
if ($variety) {
|
||||
$images = count($variety->images ?? []) ? $images->merge($variety->images) : $images;
|
||||
}
|
||||
if ($specie) {
|
||||
$images = count($specie->images ?? []) ? $images->merge($specie->images) : $images;
|
||||
}
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$specie = $article->product ?? false;
|
||||
|
||||
@@ -2,24 +2,27 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App;
|
||||
use Bnb\PayboxGateway\Requests\AuthorizationWithCapture;
|
||||
use Bnb\PayboxGateway\Requests\Capture;
|
||||
use Bnb\PayboxGateway\Responses\Verify;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Bnb\PayboxGateway\Requests\Paybox\AuthorizationWithCapture;
|
||||
use Bnb\PayboxGateway\Requests\PayboxDirect\Capture;
|
||||
use Bnb\PayboxGateway\Responses\Paybox\Verify;
|
||||
use Bnb\PayboxGateway\Responses\Exceptions\InvalidSignature;
|
||||
|
||||
class Paybox
|
||||
{
|
||||
public static function makeAuthorizationRequest($amount, $customer_email = 'test@example.com')
|
||||
public static function makeAuthorizationRequest($order, $customer_email = 'test@example.com')
|
||||
{
|
||||
$authorizationRequest = App::make(AuthorizationWithCapture::class);
|
||||
$invoiceId = $order->invoice->id;
|
||||
|
||||
return $authorizationRequest->setAmount($amount)->setCustomerEmail($customer_email)
|
||||
->setPaymentNumber(1)->send('paybox.send');
|
||||
return $authorizationRequest->setAmount($order->total_shipped)->setCustomerEmail($customer_email)
|
||||
->setPaymentNumber($invoiceId)->send('paybox.send');
|
||||
}
|
||||
|
||||
public static function verifyPayment($invoice_id)
|
||||
public static function verifyPayment($invoiceId)
|
||||
{
|
||||
$invoice = Invoices::get($invoice_id);
|
||||
$invoice = Invoices::get($invoiceId);
|
||||
$payboxVerify = App::make(Verify::class);
|
||||
try {
|
||||
$success = $payboxVerify->isSuccess($invoice->total_shipped);
|
||||
@@ -34,7 +37,7 @@ class Paybox
|
||||
|
||||
public static function getPreviousAuthorizedRequest()
|
||||
{
|
||||
$payment = PaymentModel::find($idOfAuthorizedPayment);
|
||||
$payment = Payment::where('number', $request->input('order_number'))->firstOrFail();
|
||||
$captureRequest = App::make(Capture::class);
|
||||
$response = $captureRequest->setAmount($payment->amount)
|
||||
->setPayboxCallNumber($payment->call_number)
|
||||
|
||||
Reference in New Issue
Block a user