almost finish bank card export part and pec gatepay

This commit is contained in:
Hesabix 2025-02-08 21:49:28 +00:00
parent af3d3a9c06
commit 779e422909
8 changed files with 392 additions and 205 deletions

View file

@ -93,6 +93,7 @@ class ArchiveController extends AbstractController
$result = $payMGR->createRequest($order->getPrice(), $this->generateUrl('api_archive_buy_verify', ["id"=>$order->getId()], UrlGeneratorInterface::ABSOLUTE_URL), 'خرید فضای ابری'); $result = $payMGR->createRequest($order->getPrice(), $this->generateUrl('api_archive_buy_verify', ["id"=>$order->getId()], UrlGeneratorInterface::ABSOLUTE_URL), 'خرید فضای ابری');
if ($result['Success']) { if ($result['Success']) {
$order->setGatePay($result['gate']); $order->setGatePay($result['gate']);
$order->setVerifyCode($result['authkey']);
$entityManager->persist($order); $entityManager->persist($order);
$entityManager->flush(); $entityManager->flush();
$log->insert('سرویس فضای ابری', 'صدور فاکتور سرویس فضای ابری به مقدار ' . $params['space'] . ' گیگابایت به مدت ' . $params['month'] . ' ماه ', $this->getUser(), $acc['bid']); $log->insert('سرویس فضای ابری', 'صدور فاکتور سرویس فضای ابری به مقدار ' . $params['space'] . ' گیگابایت به مدت ' . $params['month'] . ' ماه ', $this->getUser(), $acc['bid']);
@ -107,7 +108,7 @@ class ArchiveController extends AbstractController
if (!$req) if (!$req)
throw $this->createNotFoundException(''); throw $this->createNotFoundException('');
$res = $payMGR->verify($req->getPrice(), $id, $request); $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request);
if ($res['Success'] == false) { if ($res['Success'] == false) {
$log->insert('سرویس فضای ابری', 'پرداخت ناموفق سرویس فضای ابری', $this->getUser(), $req->getBid()); $log->insert('سرویس فضای ابری', 'پرداخت ناموفق سرویس فضای ابری', $this->getUser(), $req->getBid());
return $this->render('buy/fail.html.twig', ['results' => $res]); return $this->render('buy/fail.html.twig', ['results' => $res]);

View file

@ -13,7 +13,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Writer\Exception;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class BankController extends AbstractController class BankController extends AbstractController
{ {
#[Route('/api/bank/list', name: 'app_bank_list')] #[Route('/api/bank/list', name: 'app_bank_list')]
@ -141,4 +146,123 @@ class BankController extends AbstractController
$log->insert('بانکداری', ' حساب بانکی با نام ' . $name . ' حذف شد. ', $this->getUser(), $acc['bid']->getId()); $log->insert('بانکداری', ' حساب بانکی با نام ' . $name . ' حذف شد. ', $this->getUser(), $acc['bid']->getId());
return $this->json(['result' => 1]); return $this->json(['result' => 1]);
} }
/**
* @throws Exception
*/
#[Route('/api/bank/card/list/excel', name: 'app_bank_card_list_excel')]
public function app_bank_card_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse|JsonResponse|StreamedResponse
{
$acc = $access->hasRole('banks');
if (!$acc)
throw $this->createAccessDeniedException();
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
if (!array_key_exists('code', $params))
throw $this->createNotFoundException();
$bank = $entityManager->getRepository(BankAccount::class)->findOneBy(['bid' => $acc['bid'], 'code' => $params['code']]);
if (!$bank)
throw $this->createNotFoundException();
if (!array_key_exists('items', $params)) {
$transactions = $entityManager->getRepository(HesabdariRow::class)->findBy([
'bid' => $acc['bid'],
'bank' => $bank,
'year'=>$acc['year']
]);
} else {
$transactions = [];
foreach ($params['items'] as $param) {
$prs = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
'id' => $param['id'],
'bid' => $acc['bid'],
'bank' => $bank,
'year' => $acc['year']
]);
if ($prs) {
$transactions[] = $prs;
}
}
}
$spreadsheet = new Spreadsheet();
$activeWorksheet = $spreadsheet->getActiveSheet();
$arrayEntity = [
[
'شماره تراکنش',
'تاریخ',
'توضیحات',
'تفضیل',
'بستانکار',
'بدهکار',
'سال مالی',
]
];
foreach ($transactions as $transaction) {
$arrayEntity[] = [
$transaction->getId(),
$transaction->getDoc()->getDate(),
$transaction->getDes(),
$transaction->getRef()->getName(),
$transaction->getBs(),
$transaction->getBd(),
$transaction->getYear()->getlabel()
];
}
$activeWorksheet->fromArray($arrayEntity, null, 'A1');
$activeWorksheet->setRightToLeft(true);
$writer = new Xlsx($spreadsheet);
$filePath = __DIR__ . '/../../var/' . $provider->RandomString(12) . '.xlsx';
$writer->save($filePath);
return new BinaryFileResponse($filePath);
}
#[Route('/api/bank/card/list/print', name: 'app_bank_card_list_print')]
public function app_bank_card_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
{
$acc = $access->hasRole('banks');
if (!$acc)
throw $this->createAccessDeniedException();
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
if (!array_key_exists('code', $params))
throw $this->createNotFoundException();
$bank = $entityManager->getRepository(BankAccount::class)->findOneBy(['bid' => $acc['bid'], 'code' => $params['code']]);
if (!$bank)
throw $this->createNotFoundException();
if (!array_key_exists('items', $params)) {
$transactions = $entityManager->getRepository(HesabdariRow::class)->findBy([
'bid' => $acc['bid'],
'bank' => $bank,
'year'=>$acc['year']
]);
} else {
$transactions = [];
foreach ($params['items'] as $param) {
$prs = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
'id' => $param['id'],
'bid' => $acc['bid'],
'bank' => $bank,
'year'=>$acc['year']
]);
if ($prs) {
$transactions[] = $prs;
}
}
}
$pid = $provider->createPrint(
$acc['bid'],
$this->getUser(),
$this->renderView('pdf/bank_card.html.twig', [
'page_title' => 'کارت حساب' . ' ' . $bank->getName(),
'bid' => $acc['bid'],
'items' => $transactions,
'bank' => $bank
])
);
return $this->json(['id' => $pid]);
}
} }

View file

@ -13,7 +13,9 @@ use App\Entity\Year;
use App\Service\Jdate; use App\Service\Jdate;
use App\Service\Log; use App\Service\Log;
use App\Service\Notification; use App\Service\Notification;
use App\Service\PayMGR;
use App\Service\Provider; use App\Service\Provider;
use App\Service\twigFunctions;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -24,213 +26,162 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class PayController extends AbstractController class PayController extends AbstractController
{ {
#[Route('/pay/sell/{id}', name: 'pay_sell')] #[Route('/pay/sell/{id}', name: 'pay_sell')]
public function pay_sell(String $id,EntityManagerInterface $entityManager,Log $log): Response public function pay_sell(string $id, PayMGR $payMGR, twigFunctions $twigFunctions, EntityManagerInterface $entityManager, Log $log): Response
{ {
$doc = $entityManager->getRepository(HesabdariDoc::class)->find($id); $doc = $entityManager->getRepository(HesabdariDoc::class)->find($id);
if(!$doc) if (!$doc)
throw $this->createNotFoundException(); throw $this->createNotFoundException();
//calculate total pays //calculate total pays
$totalPays = 0; $totalPays = 0;
if($doc->getWalletTransaction()) if ($doc->getWalletTransaction())
$totalPays += $doc->getWalletTransaction()->getAmount(); $totalPays += $doc->getWalletTransaction()->getAmount();
foreach ($doc->getRelatedDocs() as $relatedDoc) foreach ($doc->getRelatedDocs() as $relatedDoc)
$totalPays += $relatedDoc->getAmount(); $totalPays += $relatedDoc->getAmount();
$amountPay = $doc->getAmount() - $totalPays; $amountPay = $doc->getAmount() - $totalPays;
//get system settings $tempPay = new PayInfoTemp();
$settings = $entityManager->getRepository(Settings::class)->findAll()[0]; $tempPay->setBid($doc->getBid());
$data = array("merchant_id" => $settings->getZarinpalMerchant(), $tempPay->setDateSubmit(time());
"amount" => $amountPay, $tempPay->setDes('پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' . $doc->getBid()->getLegalName());
"callback_url" => $this->generateUrl('pay_sell_verify',['id'=>$doc->getId()],UrlGeneratorInterface::ABSOLUTE_URL), $tempPay->setPrice($amountPay);
"description" => 'پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' .$doc->getBid()->getLegalName(), $tempPay->setStatus(0);
); $tempPay->setDoc($doc);
$jsonData = json_encode($data); $entityManager->persist($tempPay);
$ch = curl_init('https://api.zarinpal.com/pg/v4/payment/request.json'); $entityManager->flush();
curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v1'); $result = $payMGR->createRequest($amountPay, $this->generateUrl('pay_sell_verify', ["id" => $doc->getId()], UrlGeneratorInterface::ABSOLUTE_URL), 'پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' . $doc->getBid()->getLegalName());
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); if ($result['Success']) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); $tempPay->setGatePay($result['gate']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $tempPay->setVerifyCode($result['authkey']);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( $entityManager->persist($tempPay);
'Content-Type: application/json', $entityManager->flush();
'Content-Length: ' . strlen($jsonData) $log->insert('کیف پول', 'ایجاد تراکنش پرداخت برای فاکتور فروش ' . $doc->getCode(), $this->getUser(), $doc->getBid());
)); return $this->redirect($result['targetURL']);
$result = curl_exec($ch);
$err = curl_error($ch);
$result = json_decode($result, true, JSON_PRETTY_PRINT);
curl_close($ch);
if ($err) {
throw $this->createAccessDeniedException($err);
} else {
if (empty($result['errors'])) {
if ($result['data']['code'] == 100) {
$tempPay = new PayInfoTemp();
$tempPay->setBid($doc->getBid());
$tempPay->setDateSubmit(time());
$tempPay->setDes('پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' .$doc->getBid()->getLegalName());
$tempPay->setPrice($amountPay);
$tempPay->setStatus(0);
$tempPay->setDoc($doc);
$tempPay->setVerifyCode($result['data']['authority']);
$tempPay->setGatePay('zarinpal');
$entityManager->persist($tempPay);
$entityManager->flush();
$log->insert('کیف پول','ایجاد تراکنش پرداخت برای فاکتور فروش ' . $doc->getCode() ,$this->getUser(),$doc->getBid());
return $this->redirect('https://www.zarinpal.com/pg/StartPay/' . $result['data']["authority"]);
}
}
} }
return $this->render('pay/fail.html.twig',[ return $this->render('pay/fail.html.twig', [
'type'=>'sell', 'type' => 'sell',
'doc'=>$doc 'doc' => $doc
]); ]);
} }
#[Route('pay/sell/verify/{id}', name: 'pay_sell_verify')] #[Route('pay/sell/verify/{id}', name: 'pay_sell_verify')]
public function pay_sell_verify(String $id, Notification $notification,Provider $provider,Jdate $jdate,Request $request,EntityManagerInterface $entityManager,Log $log): Response public function pay_sell_verify(string $id, PayMGR $payMGR, Notification $notification, Provider $provider, Jdate $jdate, Request $request, EntityManagerInterface $entityManager, Log $log): Response
{ {
$doc = $entityManager->getRepository(HesabdariDoc::class)->find($id); $req = $entityManager->getRepository(PayInfoTemp::class)->find($id);
if(!$doc) if (!$req)
throw $this->createNotFoundException('');
$doc = $req->getDoc();
if (!$doc)
throw $this->createNotFoundException(); throw $this->createNotFoundException();
$Authority = $request->get('Authority'); $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request);
$status = $request->get('Status'); if ($res['Success'] == false) {
$req = $entityManager->getRepository(PayInfoTemp::class)->findOneBy(['verifyCode'=>$Authority]); $log->insert('کیف پول', 'خطا در پرداخت فاکتور فروش ' . $doc->getCode(), $this->getUser(), $doc->getBid());
//get system settings return $this->redirectToRoute('shortlinks_show', ['type' => 'sell', 'bid' => $doc->getBid()->getId(), 'link' => $doc->getId(), 'msg' => 'fail']);
$settings = $entityManager->getRepository(Settings::class)->findAll()[0];
$data = array("merchant_id" => $settings->getZarinpalMerchant(), "authority" => $Authority, "amount" => $req->getPrice());
$jsonData = json_encode($data);
$ch = curl_init('https://api.zarinpal.com/pg/v4/payment/verify.json');
curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v4');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($jsonData)
));
$result = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
$result = json_decode($result, true);
//-----------------------------------
$originalDoc = $req->getDoc();
//-----------------------------------
if ($err) {
$log->insert('کیف پول','خطا در پرداخت فاکتور فروش ' . $doc->getCode() ,$this->getUser(),$doc->getBid());
return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'fail']);
} else { } else {
if(array_key_exists('code',$result['data'])){ $req->setStatus(100);
if ($result['data']['code'] == 100) { $req->setRefID($res['refID']);
$req->setStatus(100); $req->setCardPan($res['card_pan']);
$req->setRefID($result['data']['ref_id']); $entityManager->persist($req);
$req->setCardPan($result['data']['card_pan']); $entityManager->flush();
$entityManager->persist($req); $originalDoc = $req->getDoc();
$entityManager->flush();
//create wallet transaction
$wt = new WalletTransaction();
$wt->setBid($req->getBid());
$wt->setDes($req->getDes());
$wt->setDateSubmit($req->getDateSubmit());
$wt->setGatePay($req->getGatePay());
$wt->setStatus($req->getStatus());
$wt->setVerifyCode($req->getVerifyCode());
$wt->setRefID($req->getRefID());
$wt->setCardPan($req->getCardPan());
$wt->setAmount($req->getPrice());
$wt->setType('sell');
$entityManager->persist($wt);
$entityManager->flush();
$doc->setWalletTransaction($wt);
$entityManager->persist($doc);
$entityManager->flush();
$entityManager->persist($originalDoc);
$entityManager->flush();
//create wallet transaction //create hesabdariDoc
$wt = new WalletTransaction(); $doc = new HesabdariDoc();
$wt->setBid($req->getBid()); $doc->setBid($wt->getBid());
$wt->setDes($req->getDes()); $doc->setDateSubmit(time());
$wt->setDateSubmit($req->getDateSubmit()); $doc->setDate($jdate->jdate('Y/n/d', time()));
$wt->setGatePay($req->getGatePay()); $doc->setType('walletPay');
$wt->setStatus($req->getStatus()); $doc->setMoney($wt->getBid()->getMoney());
$wt->setVerifyCode($req->getVerifyCode()); //get default year
$wt->setRefID($req->getRefID()); $year = $entityManager->getRepository(Year::class)->findOneBy([
$wt->setCardPan($req->getCardPan()); 'bid' => $originalDoc->getBid(),
$wt->setAmount($req->getPrice()); 'head' => true
$wt->setType('sell'); ]);
$entityManager->persist($wt); $doc->setYear($year);
$entityManager->flush(); $doc->setDes($wt->getDes());
$doc->setWalletTransaction($wt); $doc->setAmount($wt->getAmount());
$entityManager->persist($doc); $doc->setCode($provider->getAccountingCode($wt->getBid(), 'accounting'));
$entityManager->flush(); $walletUser = $entityManager->getRepository(User::class)->findOneBy(['email' => 'wallet@hesabix.ir']);
$entityManager->persist($originalDoc); if ($walletUser)
$entityManager->flush(); $doc->setSubmitter($walletUser);
else {
//create hesabdariDoc $wu = new User();
$doc = new HesabdariDoc(); $wu->setFullName('کیف پول حسابیکس');
$doc->setBid($wt->getBid()); $wu->setEmail('wallet@hesabix.ir');
$doc->setDateSubmit(time()); $wu->setRoles([]);
$doc->setDate($jdate->jdate('Y/n/d',time())); $wu->setActive(true);
$doc->setType('walletPay'); $entityManager->persist($wu);
$doc->setMoney($wt->getBid()->getMoney()); $entityManager->flush();
//get default year $doc->setSubmitter($wu);
$year = $entityManager->getRepository(Year::class)->findOneBy([
'bid'=>$originalDoc->getBid(),
'head'=>true
]);
$doc->setYear($year);
$doc->setDes($wt->getDes());
$doc->setAmount($wt->getAmount());
$doc->setCode($provider->getAccountingCode($wt->getBid(),'accounting'));
$walletUser = $entityManager->getRepository(User::class)->findOneBy(['email'=>'wallet@hesabix.ir']);
if($walletUser)
$doc->setSubmitter($walletUser);
else{
$wu = new User();
$wu->setFullName('کیف پول حسابیکس');
$wu->setEmail('wallet@hesabix.ir');
$wu->setRoles([]);
$wu->setActive(true);
$entityManager->persist($wu);
$entityManager->flush();
$doc->setSubmitter($wu);
}
$entityManager->persist($doc);
$entityManager->flush();
$originalDoc->addRelatedDoc($doc);
$originalDoc->setWalletTransaction($wt);
$entityManager->persist($originalDoc);
$entityManager->flush();
//create rows bank
$row = new HesabdariRow();
$row->setBid($originalDoc->getBid());
$row->setDoc($doc);
$row->setBank($doc->getBid()->getWalletMatchBank());
$row->setBd($doc->getAmount());
$row->setBs(0);
$row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
//get table ref
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]);
$row->setRef($table);
$row->setYear($year);
$entityManager->persist($row);
$entityManager->flush();
//create rows person
//get person
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]);
$person = null;
foreach ($rows as $oldRow) {
if ($oldRow->getPerson())
$person = $oldRow->getPerson();
}
$row = new HesabdariRow();
$row->setBid($originalDoc->getBid());
$row->setDoc($doc);
$row->setPerson($person);
$row->setBs($doc->getAmount());
$row->setBd(0);
$row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
//get table ref
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]);
$row->setRef($table);
$row->setYear($year);
$entityManager->persist($row);
$entityManager->flush();
$log->insert('کیف پول','پرداخت موفق فاکتور فروش ' . $originalDoc->getCode() ,$this->getUser(),$doc->getBid());
return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'success']);
}
} }
$log->insert('کیف پول','خطا در پرداخت فاکتور فروش ' . $originalDoc->getCode() ,$this->getUser(),$doc->getBid()); $entityManager->persist($doc);
return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'fail']); $entityManager->flush();
$originalDoc->addRelatedDoc($doc);
$originalDoc->setWalletTransaction($wt);
$entityManager->persist($originalDoc);
$entityManager->flush();
//create rows bank
$row = new HesabdariRow();
$row->setBid($originalDoc->getBid());
$row->setDoc($doc);
$row->setBank($doc->getBid()->getWalletMatchBank());
$row->setBd($doc->getAmount());
$row->setBs(0);
$row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
//get table ref
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 5]);
$row->setRef($table);
$row->setYear($year);
$entityManager->persist($row);
$entityManager->flush();
//create rows person
//get person
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]);
$person = null;
foreach ($rows as $oldRow) {
if ($oldRow->getPerson())
$person = $oldRow->getPerson();
}
$row = new HesabdariRow();
$row->setBid($originalDoc->getBid());
$row->setDoc($doc);
$row->setPerson($person);
$row->setBs($doc->getAmount());
$row->setBd(0);
$row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
//get table ref
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 3]);
$row->setRef($table);
$row->setYear($year);
$entityManager->persist($row);
$entityManager->flush();
$log->insert('کیف پول', 'پرداخت موفق فاکتور فروش ' . $originalDoc->getCode(), $this->getUser(), $doc->getBid());
return $this->redirectToRoute('shortlinks_show', ['type' => 'sell', 'bid' => $originalDoc->getBid()->getId(), 'link' => $originalDoc->getId(), 'msg' => 'success']);
} }
} }
} }

View file

@ -72,7 +72,9 @@ class PluginController extends AbstractController
public function api_plugin_buy_verify(string $id, twigFunctions $twigFunctions, PayMGR $payMGR, Request $request, EntityManagerInterface $entityManager, Log $log): Response public function api_plugin_buy_verify(string $id, twigFunctions $twigFunctions, PayMGR $payMGR, Request $request, EntityManagerInterface $entityManager, Log $log): Response
{ {
$req = $entityManager->getRepository(Plugin::class)->find($id); $req = $entityManager->getRepository(Plugin::class)->find($id);
$res = $payMGR->verify($req->getPrice(), $id, $request); if (!$req)
throw $this->createNotFoundException('');
$res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request);
if ($res['Success'] == false) { if ($res['Success'] == false) {
$log->insert( $log->insert(
'بازار افزونه‌ها' . $req->getName(), 'بازار افزونه‌ها' . $req->getName(),

View file

@ -143,7 +143,10 @@ class SMSController extends AbstractController
public function api_sms_buy_verify(string $id, PayMGR $payMGR, twigFunctions $twigFunctions, Notification $notification, Request $request, EntityManagerInterface $entityManager, Log $log): Response public function api_sms_buy_verify(string $id, PayMGR $payMGR, twigFunctions $twigFunctions, Notification $notification, Request $request, EntityManagerInterface $entityManager, Log $log): Response
{ {
$req = $entityManager->getRepository(SMSPays::class)->find($id); $req = $entityManager->getRepository(SMSPays::class)->find($id);
$res = $payMGR->verify($req->getPrice(), $id, $request); if (!$req)
throw $this->createNotFoundException('');
$res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request);
if ($res['Success'] == false) { if ($res['Success'] == false) {
$log->insert('سرویس پیامک', 'پرداخت ناموفق شارژ سرویس پیامک', $this->getUser(), $req->getBid()); $log->insert('سرویس پیامک', 'پرداخت ناموفق شارژ سرویس پیامک', $this->getUser(), $req->getBid());
return $this->render('buy/fail.html.twig', ['results' => $res]); return $this->render('buy/fail.html.twig', ['results' => $res]);

View file

@ -32,7 +32,7 @@ class PayInfoTemp
#[ORM\Column(length: 255, nullable: true)] #[ORM\Column(length: 255, nullable: true)]
private ?string $verifyCode = null; private ?string $verifyCode = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255, nullable: true)]
private ?string $gatePay = null; private ?string $gatePay = null;
#[ORM\ManyToOne] #[ORM\ManyToOne]

View file

@ -18,9 +18,6 @@ class Settings
#[ORM\Column(nullable: true)] #[ORM\Column(nullable: true)]
private ?bool $activeSendSms = null; private ?bool $activeSendSms = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $zarinpalMerchant = null;
#[ORM\Column(length: 255, nullable: true)] #[ORM\Column(length: 255, nullable: true)]
private ?string $appSite = null; private ?string $appSite = null;
@ -62,18 +59,6 @@ class Settings
return $this; return $this;
} }
public function getZarinpalMerchant(): ?string
{
return $this->zarinpalMerchant;
}
public function setZarinpalMerchant(?string $zarinpalMerchant): static
{
$this->zarinpalMerchant = $zarinpalMerchant;
return $this;
}
public function getAppSite(): ?string public function getAppSite(): ?string
{ {
return $this->appSite; return $this->appSite;

View file

@ -0,0 +1,121 @@
{% extends "pdf/base.html.twig" %}
{% block body %}
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
<b style="color:white;">کارت حساب بانکی</b>
</div>
<table style="width:100%;">
<tbody>
<tr style="text-align:center;">
<td class="">
<p>
<b>نام:
</b>
{{ bank.name }}
</p>
</td>
<td class="center">
<p>
<b>
شماره حساب:
</b>
{{ bank.accountNum }}
</p>
</td>
<td class="center">
<p>
<b>شماره شبا:
</b>
{{ bank.shaba }}
</p>
</td>
<td class="center">
<p>
<b>شماره کارت:
</b>
{{ bank.cardNum }}
</p>
</td>
</tr>
</tbody>
</table>
</div>
<div style="width:100%;margin-top:5px;text-align:center;">
<table style="width:100%;">
<tbody>
<tr style="text-align: center; background-color: grey; text-color: white">
<td style="width: 35px;">ردیف</td>
<td class="center item">فاکتور/سند</td>
<td class="center item">تاریخ</td>
<td class="center item">توضیحات</td>
<td class="center item">تفضیل</td>
<td class="center item">بدهکار</td>
<td class="center item">بستانکار</td>
<td class="center item">سال مالی</td>
</tr>
{% set sumBs = 0 %}
{% set sumBd = 0 %}
{% for item in items %}
{% set sumBs = sumBs + item.bs %}
{% set sumBd = sumBd + item.bd %}
<tr class="stimol">
<td class="center item">{{ loop.index }}</td>
<td class="center item">{{ item.doc.code }}</td>
<td class="center item">{{ item.doc.date }}</td>
<td class="center item">{{ item.des }}</td>
<td class="center item">{{ item.ref.name }}</td>
<td class="center item">{{ item.bd | number_format }}</td>
<td class="center item">{{ item.bs | number_format }}</td>
<td class="center item">{{ item.year.label }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
<b style="color:white;">وضعیت حساب</b>
</div>
<table style="width:100%;">
<tbody>
<tr style="text-align:center;">
<td class="center">
<p>
<b>جمع بستانکار:
</b>
{{ sumBs | number_format }}
</p>
</td>
<td class="center">
<p>
<b>جمع بدهکار:
</b>
{{ sumBd | number_format }}
</p>
</td>
<td class="center">
<p>
<b>تراز حساب:
</b>
<span>{{ (sumBs - sumBd) | abs |number_format }}</span>
</p>
</td>
<td class="center">
<p>
<b> وضعیت:
</b>
{% if sumBs > sumBd%}
بستانکار
{% elseif sumBs == sumBd %}
تسویه شده
{% else %}
بدهکار
{% endif %}
</p>
</td>
</tr>
</tbody>
</table>
</div>
{% endblock %}