سلام و عرض ادب.
وقتی از صفحه پرداخت برگشت داده میشم با این خطا مواجه میشم:
Swift_TransportException
Expected response code 250 but got code "502", with message "502 5.5.2 Error: command not recognized "
ایمیل هم ارسال نمیشه.
کلاس mail:
namespace App\\Mail;
use App\\Models\\User;
use Illuminate\\Bus\\Queueable;
use Illuminate\\Mail\\Mailable;
use Illuminate\\Queue\\SerializesModels;
class SendOrderedImages extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(private array $images, private User $user)
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$email = $this
->view('mail.send-ordered-images')
->with([
'user' => $this->user
]);
foreach ($this->images as $filePath) {
$email->attach(storage_path('app/local_storage/' . $filePath));
}
return $email;
}
}
متد callback کنترلر PaymentController:
public function callback(Request $request) { $paymentInfo = $request->all(); $idPayVerifyRequest = new IDPayVerifyRequest([ 'orderId' => $paymentInfo['order_id'], 'id' => $paymentInfo['id'], 'apiKey' => config('services.gateways.idpay.api_key'), ]); $paymentService = new PaymentService(PaymentService::IDPAY, $idPayVerifyRequest); $result = $paymentService->verify(); if (!$result['status']) { return redirect()->route('home.checkout')->with('failed', 'خطا در پرداخت.'); } if ($result['statusCode'] == 101) { return redirect()->route('home.checkout')->with('failed', 'پرداخت شما قبلا انجام شده است و نیازی به پرداخت مجدد نیست. فایلهای مربوطه به ایمیل شما ارسال شده است.'); } $currentPayment = Payment::where('ref_code',$result['data']['order_id'])->first(); $currentPayment->update([ 'status' =>'paid', 'res_id'=>$result['data']['track_id'], ]); $currentPayment->order()->update([ 'status' =>'paid' ]); $currentUser = $currentPayment->order->user; $reservedImages = $currentPayment->order->orderItems->map(function($orderItem){ return $orderItem->product->source_url; }); Mail::to($currentUser)->send(new SendOrderedImages ($reservedImages->toArray(),$currentUser)); Cookie::queue('basket',null); return redirect()->route('home.products.all')->with('success','خرید شما انجام شد و فایلها به ایمیل شما ارسال شد.'); }