fix: review feedback

This commit is contained in:
Noah Lancien 2025-10-29 12:42:18 +01:00
parent 6a5f07ae58
commit 7240c5e35d
7 changed files with 10 additions and 57 deletions

View file

@ -136,7 +136,6 @@ class CustomerController extends Controller
->with(['instantWin'])->where(function (Builder $q) {
$q->whereHas('instantWin');
})->get();
$coupons = [];
return view('theme::pages.participation.winning-participations', compact('winningList', 'canPrint'));
}

View file

@ -12,10 +12,9 @@ class DiscountController extends Controller
/**
* Fetch PDF BR.
*
* @param \App\Http\Requests\Club\MesBr\PrintCouponsRequest $request
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
public function fetchBrPdf(PrintCouponsRequest $request): \Symfony\Component\HttpFoundation\StreamedResponse
public function fetchBrPdf(): \Symfony\Component\HttpFoundation\StreamedResponse
{
/** @var \App\Models\Customer $customer */
$customer = auth('frontend')->user();

View file

@ -220,7 +220,6 @@ class ParticipateController extends Controller
// * Maj Panier
$result = $mesBr->updateBasket(
$crmUser,
$settings->discounts_site,
strval($discount->web_coupon_identifiant)
);

View file

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests\Fo\MesBr;
use Illuminate\Foundation\Http\FormRequest;
class PrintCouponsRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('frontend')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string,\Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
// 'hashcode' => 'required|string|exists:customers,hashcode',
];
}
}

View file

@ -11,10 +11,13 @@ class MesBr
private $refCamp;
public function __construct($endpoint, $refCamp)
private $refSite;
public function __construct($endpoint, $refCamp, $refSite)
{
$this->endpoint = $endpoint;
$this->refCamp = $refCamp;
$this->refSite = $refSite;
}
public function createCustomer(string $hashcode, string $email, string $country)
@ -146,25 +149,21 @@ class MesBr
* Update basket
*
* @param \LDC\LDCCRM\Models\Customer $crm_customer
* @param string $ref_site
* @param string $coupon_id
* @param integer $quantity
* @return array<string,string>
* 'status' => 'OK',
* 'link' => URL,
* 'verif' => URL,
* 'basketId' => 'ID'
* 'ref' => 'Basket REF'
*/
public function updateBasket(
Customer $crm_customer,
string $ref_site,
string $coupon_id,
int $quantity = 1
): array {
$res = $this->callAPI("GET", "/customer/basket/update", [
'refsite' => $ref_site,
'refsite' => $this->refSite,
'refcamp' => $this->refCamp,
'refadherent' => $crm_customer->hashcode,
'customer_hashcode' => $crm_customer->hashcode,
'panier' => "({$quantity}){$coupon_id}"
]);

View file

@ -22,7 +22,8 @@ class MesBrApiServiceProvider extends ServiceProvider
return new MesBr(
config('mesbr.endpoint'),
$settings->discounts_campaign
$settings->discounts_campaign,
$settings->discounts_site
);
});
}

View file

@ -1,14 +0,0 @@
document.addEventListener("DOMContentLoaded", function () {
if (!document.querySelector("main.prizes-page")) {
// * We are not on settings page
return;
}
let btnBrs = document.getElementsByClassName('btn-br');
for (let btnBr of btnBrs) {
btnBr.addEventListener('click', function () {
})
}
});