<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 23/04/19
* Time: 12:41 AM
*/
namespace App\AppBundle\MainBundle\Controller;
use App\AppBundle\AdminBundle\Entity\AdminConfig;
use App\AppBundle\AdminBundle\Services\Admin_Encryption;
use App\AppBundle\APIBundle\Controller\BookingBaseController;
use App\AppBundle\APIBundle\Services\Encryption;
use App\AppBundle\APIBundle\Services\MailManager;
use App\AppBundle\APIBundle\Services\ParkingSupplierService;
use App\AppBundle\APIBundle\Services\PayoutService;
use App\AppBundle\APIBundle\Services\WPGeneralService;
use App\AppBundle\MainBundle\Client\StripeClient;
use App\AppBundle\MainBundle\Constants\BookingType;
use App\AppBundle\MainBundle\Constants\GeneralConstant;
use App\AppBundle\MainBundle\Entity\Orders;
use App\AppBundle\MainBundle\Entity\Orders_Suppliers_Transfers_Payout;
use App\AppBundle\MainBundle\Entity\OrdersStripePaymentIntent;
use App\AppBundle\MainBundle\Entity\PS_Add_Spot;
use App\AppBundle\MainBundle\Entity\User;
use App\AppBundle\MainBundle\Services\SendMail;
use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
use Knp\Snappy\Pdf;
use Nelmio\ApiDocBundle\Annotation\Operation;
use Stripe\Exception\ApiErrorException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
class MainController extends BookingBaseController
{
/**
* @Route("home", name="home", methods={"GET"})
* @Route("home/")
* @Route("")
* @Route("/")
*/
public function homeAction(Request $request, Admin_Encryption $admin_Encryption)
{
// replace this example code with whatever you need
return $this->render('index.html.twig', [
]);
}
/**
* @Route("/apple-app-site-association", name="apple-app-site-association", methods={"GET"})
* @Route("/.well-known/apple-app-site-association")
*
* @Operation(
* consumes={"application/pkcs7-mime"})
*
*/
public function getAppleAppSiteAssociation(Request $request) {
$responseArr = array();
$responseDetail = array();
$responseDetail[0]['appID'] = "76Y3KBZ44B.com.blueera.parkingsystem.main";
$responseDetail[0]['paths'][0] = "*";
$responseArr['applinks']['apps'] = ["76Y3KBZ44B.com.blueera.parkingsystem.main"];
$responseArr['applinks']['details'] = $responseDetail;
$responseAppsDetail = array();
$responseAppsDetail[0]['apps'] = ["76Y3KBZ44B.com.blueera.parkingsystem.main"];
$responseArr['webcredentials'] = $responseAppsDetail[0];
$jsonResponse = new JsonResponse($responseArr);
$jsonResponse->headers->set('Content-Type', 'application/pkcs7-mime');
return $jsonResponse;
}
/**
* @Route("test4", name="test-4", methods={"GET"})
*/
public function test4Action(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf, PayoutService $payoutService)
{
$entityManager = $this->getDoctrine()->getManager();
$orders = $entityManager->getRepository(Orders::class)->findAll();
foreach ($orders as $order) {
if ($order instanceof Orders) {
if ($order->getIsCompleted() == true && $order->getIsActive() == true) {
if ($order->getBookingType() == BookingType::Monthly) {
if ($order->getLatestMonthlyBookingPricingObj()->getInvoice() == NULL || $order->getLatestMonthlyBookingPricingObj()->getInvoice() == '') {
$payoutService->createPdfCustomerInvoiceForUser($entityManager, $order, $knpSnappyPdf, $generalService->getBaseUrl($request), $encryption);
}
} else {
if ($order->getOrdersPricing()->getInvoice() == NULL || $order->getOrdersPricing()->getInvoice() == '') {
$payoutService->createPdfCustomerInvoiceForUser($entityManager, $order, $knpSnappyPdf, $generalService->getBaseUrl($request), $encryption);
}
}
}
}
}
return $this->render('index.html.twig', [
]);
}
/**
* @Route("test5", name="test-5", methods={"GET"})
*/
public function test5(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf, PayoutService $payoutService)
{
$entityManager = $this->getDoctrine()->getManager();
// $payouts = $entityManager->getRepository(Orders_Suppliers_Transfers_Payout::class)->findAll();
$payout = $entityManager->getRepository(Orders_Suppliers_Transfers_Payout::class)->find(122);
$payouts = [$payout];
foreach ($payouts as $payout) {
if ($payout instanceof Orders_Suppliers_Transfers_Payout) {
// if ($payout->getInvoice() == NULL || $payout->getInvoice() == '') {
echo $payout->getReferenceId();
$payoutService->createPdfPayoutInvoiceForSupplier($entityManager, $payout, $knpSnappyPdf, $generalService->getBaseUrl($request), $encryption);
$supplierEmail = $encryption->decryptData($payout->getSupplier()->getEmail());
// $sendMail->sendPayoutEmailToSupplier($payout, $supplierEmail, $mailManager, $translator);
// }
}
}
return $this->render('index.html.twig', [
]);
}
/**
* @Route("test", name="test", methods={"GET"})
*/
public function testAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf)
{
// replace this example code with whatever you need
// dump($stripeClient->getChargeDetails());
$entityManager = $this->getDoctrine()->getManager();
// $userObj = $entityManager->getRepository(User::class)->find(1);
// $response = $parkingSupplierService->createChargeForSpotProvider($entityManager, $userObj, $stripeClient, $encryption, 1.0, 'chf', '0', $translator->trans('txt_manual_payout_fees', [], null, $languageCode), $languageCode, $translator);
// dump($response);
// $analytics = initializeAnalytics();
// $profile = getFirstProfileId($analytics);
// $results = getResults($analytics, $profile);
// printResults($results);
$payouts = $entityManager->getRepository(Orders_Suppliers_Transfers_Payout::class)->findAll();
$objPayout = $payouts[count($payouts) - 1];
$adminConfigArr = $entityManager->getRepository(AdminConfig::class)->findAll();
if (count($adminConfigArr) == 0) {
$adminConfig = new AdminConfig();
$entityManager->persist($adminConfig);
$entityManager->flush();
} else {
$adminConfig = $adminConfigArr[0];
}
//
$html = $this->renderView('invoice/index.html.twig', [
'payout' => $objPayout,
'admin_config' => $adminConfig,
'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
'emailContent' => 'This content<br>Is sample content<br>just to check html',
'info_words' => 'This content Is sample content just to check html'
]);
$knpSnappyPdf->setOption('lowquality', false);
//
$knpSnappyPdf->setOption('no-outline', true);
$knpSnappyPdf->setOption('page-size','A4');
$knpSnappyPdf->setOption('encoding', 'UTF-8');
$knpSnappyPdf->setOption('margin-left', 5);
$knpSnappyPdf->setOption('margin-right', 5);
$footerHtml = $this->renderView('invoice/footer.html.twig', [
'admin_config' => $adminConfig,
'baseUrl' => $generalService->getBaseUrl($request),
'locale' => $objPayout->getSupplier()->getLanguage()->getSymbol(),
]);
$headerHtml = $this->renderView('invoice/header.html.twig', []);
$knpSnappyPdf->setOption('header-html', $headerHtml);
$knpSnappyPdf->setOption('footer-html', $footerHtml);
$knpSnappyPdf->setOption('footer-font-size', '7');
$fileName = $this->getParameter('app.root_web').$this->getParameter('app.invoice_directory').time().'.pdf';
$knpSnappyPdf->generateFromHtml($html, $fileName);
return $this->render('invoice/index.html.twig', [
'payout' => $objPayout,
'admin_config' => $adminConfig,
'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
'emailContent' => 'This content<br>Is sample content<br>just to check html'
]);
}
function initializeAnalytics()
{
// Creates and returns the Analytics Reporting service object.
// Use the developers console and download your service account
// credentials in JSON format. Place them in this directory or
// change the key file location if necessary.
$KEY_FILE_LOCATION = __DIR__ . '/service-account-credentials.json';
// Create and configure a new client object.
$client = new Google_Client();
$client->setApplicationName("Hello Analytics Reporting");
$client->setAuthConfig($KEY_FILE_LOCATION);
$client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']);
$analytics = new Google_Service_Analytics($client);
return $analytics;
}
function getFirstProfileId($analytics) {
// Get the user's first view (profile) ID.
// Get the list of accounts for the authorized user.
$accounts = $analytics->management_accounts->listManagementAccounts();
if (count($accounts->getItems()) > 0) {
$items = $accounts->getItems();
$firstAccountId = $items[0]->getId();
// Get the list of properties for the authorized user.
$properties = $analytics->management_webproperties
->listManagementWebproperties($firstAccountId);
if (count($properties->getItems()) > 0) {
$items = $properties->getItems();
$firstPropertyId = $items[0]->getId();
// Get the list of views (profiles) for the authorized user.
$profiles = $analytics->management_profiles
->listManagementProfiles($firstAccountId, $firstPropertyId);
if (count($profiles->getItems()) > 0) {
$items = $profiles->getItems();
// Return the first view (profile) ID.
return $items[0]->getId();
} else {
throw new Exception('No views (profiles) found for this user.');
}
} else {
throw new Exception('No properties found for this user.');
}
} else {
throw new Exception('No accounts found for this user.');
}
}
function getResults($analytics, $profileId) {
// Calls the Core Reporting API and queries for the number of sessions
// for the last seven days.
return $analytics->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions');
}
function printResults($results) {
// Parses the response from the Core Reporting API and prints
// the profile name and total sessions.
if (count($results->getRows()) > 0) {
// Get the profile name.
$profileName = $results->getProfileInfo()->getProfileName();
// Get the entry for the first entry in the first row.
$rows = $results->getRows();
$sessions = $rows[0][0];
// Print the results.
print "First view (profile) found: $profileName\n";
print "Total sessions: $sessions\n";
} else {
print "No results found.\n";
}
}
/**
* @Route("test1", name="test1", methods={"GET"})
*/
public function testAlphaAction(Request $request, Encryption $encryptionManager, WPGeneralService $generalServiceManager)
{
$entityManager = $this->getDoctrine()->getManager();
// $userObj = $entityManager->getRepository(User::class)->find(1);
// $orderDataArray = $this->getBookingDetailsForOrderId($userObj, '10000259', $entityManager, $generalServiceManager->getBaseUrl($request), $encryptionManager, $generalServiceManager);
//
// dump($orderDataArray);
// replace this example code with whatever you need
return $this->render('email-templates/basic_template.htm.twig', [
'infoWords' => 'This is test info words that are kept',
'bannerImage' => 'https://parkings.ddns.net/images/wp/email-templates/email/spot-validated.png',
'title' => 'Congratulation!! Spot Activated.',
'subTitle' => 'Your spot "Spot Title" is activated and is live.',
'showButton' => 0,
'buttonLink' => '#',
'buttonTitle' => 'Verify',
]);
}
// /**
// * @Route("html-test", name="html_test", methods={"GET"})
// */
// public function htmlAlphaAction(Request $request, Pdf $knpSnappyPdf)
// {
// $html = $this->renderView('email-templates/order_complete_email_template.htm.twig', array(
// 'full_name' => 'Darshit Shah',
// 'order_number' => '23323232',
// 'sub_total' => '$234',
// 'tax_price' => '$30',
// 'service_fee' => '$100',
// 'total_price' => '$105',
// 'user_details' => 'test',
// 'booking_date' => '12-10-2022',
// 'title' => 'Verify',
// 'sub_title' => 'Your Mobile Number',
// 'name' => 'Darshit Shah',
// 'message' => 'Enter the below 4 digit code to verify your mobile number.',
// 'code' => '4545',
// 'spot_address' => 'Test address this is'
// ));
//
// $knpSnappyPdf->setOption('lowquality', false);
//// $knpSnappyPdf->setOption('quality', 'highquality');
//// $knpSnappyPdf->setOption('no-outline', true);
//// $knpSnappyPdf->setOption('page-size','A4');
//// $knpSnappyPdf->setOption('encoding', 'UTF-8');
//// $knpSnappyPdf->setOption('print-media-type', true);
//
// $knpSnappyPdf->generateFromHtml($html, $this->getParameter('app.root_web').$this->getParameter('app.invoice_directory').'23323232.pdf');
//
//
// // replace this example code with whatever you need
// return $this->render('email-templates/order_complete_email_template.htm.twig', [
// 'full_name' => 'Darshit Shah',
// 'order_number' => '23323232',
// 'sub_total' => '$234',
// 'tax_price' => '$30',
// 'service_fee' => '$100',
// 'total_price' => '$105',
// 'user_details' => 'test',
// 'booking_date' => '12-10-2022',
// 'title' => 'Verify',
// 'sub_title' => 'Your Mobile Number',
// 'name' => 'Darshit Shah',
// 'message' => 'Enter the below 4 digit code to verify your mobile number.',
// 'code' => '4545',
// 'spot_address' => 'Test address this is'
// ]);
// }
/**
* @Route("test-payout", name="test-payout", methods={"GET"})
*/
public function testPayoutAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf)
{
// replace this example code with whatever you need
// dump($stripeClient->getChargeDetails());
$entityManager = $this->getDoctrine()->getManager();
// $userObj = $entityManager->getRepository(User::class)->find(1);
// $response = $parkingSupplierService->createChargeForSpotProvider($entityManager, $userObj, $stripeClient, $encryption, 1.0, 'chf', '0', $translator->trans('txt_manual_payout_fees', [], null, $languageCode), $languageCode, $translator);
// dump($response);
// $analytics = initializeAnalytics();
// $profile = getFirstProfileId($analytics);
// $results = getResults($analytics, $profile);
// printResults($results);
$payouts = $entityManager->getRepository(Orders_Suppliers_Transfers_Payout::class)->findAll();
$objPayout = $payouts[count($payouts) - 1];
$adminConfigArr = $entityManager->getRepository(AdminConfig::class)->findAll();
if (count($adminConfigArr) == 0) {
$adminConfig = new AdminConfig();
$entityManager->persist($adminConfig);
$entityManager->flush();
} else {
$adminConfig = $adminConfigArr[0];
}
//-------Uncomment this line to generate pdf
// $html = $this->renderView('invoice/index.html.twig', [
// 'payout' => $objPayout,
// 'admin_config' => $adminConfig,
// 'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
// 'baseUrl' => $generalService->getBaseUrl($request),
// 'supplierEmail' => $encryption->decryptData($objPayout->getSupplier()->getEmail()),
// 'supplierMobile' => $objPayout->getSupplier()->getCountryCode().' '.$encryption->decryptData($objPayout->getSupplier()->getMobile()),
// ]);
//
// $knpSnappyPdf->setOption('lowquality', false);
//
// $knpSnappyPdf->setOption('no-outline', true);
// $knpSnappyPdf->setOption('page-size','A4');
// $knpSnappyPdf->setOption('encoding', 'UTF-8');
// $knpSnappyPdf->setOption('margin-left', 5);
// $knpSnappyPdf->setOption('margin-right', 5);
//
// $footerHtml = $this->renderView('invoice/footer.html.twig', [
// 'admin_config' => $adminConfig,
// 'baseUrl' => $generalService->getBaseUrl($request),
// 'locale' => $objPayout->getSupplier()->getLanguage()->getSymbol(),
// ]);
// $headerHtml = $this->renderView('invoice/header.html.twig', []);
//
// $knpSnappyPdf->setOption('header-html', $headerHtml);
// $knpSnappyPdf->setOption('footer-html', $footerHtml);
// $knpSnappyPdf->setOption('footer-font-size', '7');
//
// $fileName = $this->getParameter('app.root_web').$this->getParameter('app.invoice_directory').time().'.pdf';
//
// $knpSnappyPdf->generateFromHtml($html, $fileName);
return $this->render('invoice/index.html.twig', [
'payout' => $objPayout,
'admin_config' => $adminConfig,
'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
'supplierEmail' => $encryption->decryptData($objPayout->getSupplier()->getEmail()),
'supplierMobile' => $objPayout->getSupplier()->getCountryCode().' '.$encryption->decryptData($objPayout->getSupplier()->getMobile()),
'baseUrl' => $generalService->getBaseUrl($request)
]);
}
/**
* @Route("test-customer", name="test-customer", methods={"GET"})
*/
public function testCustomerAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf)
{
// replace this example code with whatever you need
// dump($stripeClient->getChargeDetails());
$entityManager = $this->getDoctrine()->getManager();
// $userObj = $entityManager->getRepository(User::class)->find(1);
// $response = $parkingSupplierService->createChargeForSpotProvider($entityManager, $userObj, $stripeClient, $encryption, 1.0, 'chf', '0', $translator->trans('txt_manual_payout_fees', [], null, $languageCode), $languageCode, $translator);
// dump($response);
// $analytics = initializeAnalytics();
// $profile = getFirstProfileId($analytics);
// $results = getResults($analytics, $profile);
// printResults($results);
$orders = $entityManager->getRepository(Orders::class)->findAll();
$objOrder = $orders[count($orders) - 1];
$adminConfigArr = $entityManager->getRepository(AdminConfig::class)->findAll();
if (count($adminConfigArr) == 0) {
$adminConfig = new AdminConfig();
$entityManager->persist($adminConfig);
$entityManager->flush();
} else {
$adminConfig = $adminConfigArr[0];
}
//-------Uncomment this line to generate pdf
// $html = $this->renderView('invoice/customer/index.html.twig', [
// 'payout' => $objPayout,
// 'admin_config' => $adminConfig,
// 'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
// ]);
//
// $knpSnappyPdf->setOption('lowquality', false);
//
// $knpSnappyPdf->setOption('no-outline', true);
// $knpSnappyPdf->setOption('page-size','A4');
// $knpSnappyPdf->setOption('encoding', 'UTF-8');
// $knpSnappyPdf->setOption('margin-left', 5);
// $knpSnappyPdf->setOption('margin-right', 5);
//
// $footerHtml = $this->renderView('invoice/footer.html.twig', [
// 'admin_config' => $adminConfig,
// 'baseUrl' => $generalService->getBaseUrl($request),
// 'locale' => $objPayout->getSupplier()->getLanguage()->getSymbol(),
// ]);
// $headerHtml = $this->renderView('invoice/header.html.twig', []);
//
// $knpSnappyPdf->setOption('header-html', $headerHtml);
// $knpSnappyPdf->setOption('footer-html', $footerHtml);
// $knpSnappyPdf->setOption('footer-font-size', '7');
//
// $fileName = $this->getParameter('app.root_web').$this->getParameter('app.invoice_directory').time().'.pdf';
//
// $knpSnappyPdf->generateFromHtml($html, $fileName);
if ($objOrder->getBookingType() == BookingType::Monthly) {
$orderMonthlyPricing = $objOrder->getLatestMonthlyBookingPricingObj();
$cardType = $orderMonthlyPricing->getPayCardType();
$cardLast4 = $encryption->decryptData($orderMonthlyPricing->getPayLastFour());
$durationStr = '30 days';
} else {
$cardType = $objOrder->getPayCardType();
$cardLast4 = $encryption->decryptData($objOrder->getPayLastFour());
$dateStart = $objOrder->getStartTime();
$dateEnd = $objOrder->getEndTime();
$interval = $dateEnd->diff($dateStart);
$days = $interval->format('%D');
if ($days >= 1) {
$hours = $interval->format('%H');
$mins = $interval->format('%i');
if ($hours > 0) {
$durationStr = $interval->format('%D Day(s) %H Hrs');
} else if ($mins > 0) {
$durationStr = $interval->format('%D Day(s) %i Mins');
} else {
$durationStr = $interval->format('%D Day(s)');
}
} else {
$mins = $interval->format('%i');
if ($mins > 0) {
$durationStr = $interval->format('%H Hrs %i Mins');
} else {
$durationStr = $interval->format('%H Hrs');
}
}
}
return $this->render('invoice/customer/index.html.twig', [
'order' => $objOrder,
'admin_config' => $adminConfig,
'vat_rate' => GeneralConstant::VAT_PERCENTAGE_ON_COMMISSION,
'userEmail' => $encryption->decryptData($objOrder->getUser()->getEmail()),
'userMobile' => $objOrder->getUser()->getCountryCode().' '.$encryption->decryptData($objOrder->getUser()->getMobile()),
'baseUrl' => $generalService->getBaseUrl($request),
'card_type' => $cardType,
'card_last4' => $cardLast4,
'duration' => $durationStr
]);
}
/**
* @Route("test-stripe", methods={"GET", "POST"})
*/
public function testStripeAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf) {
$entityManager = $this->getDoctrine()->getManager();
$userObj = $entityManager->getRepository(User::class)->find(1);
if ($userObj instanceof User) {
$stripeCustomerId = $userObj->getStripeCustomerId();
$ephemeralKey = $stripeClient->createEphemeralKeyForCustomer($stripeCustomerId);
$paymentIntent = $stripeClient->createPaymentIntentForMonthlyBookingCustomer($stripeCustomerId, 2000, 'chf', 0, 'WP', 'darshit261991@gmail.com', '1', '1', '100', 5, 0);
$responseArr = [];
$responseArr['paymentIntent'] = $paymentIntent->client_secret;
$responseArr['ephemeralKey'] = $ephemeralKey->secret;
$responseArr['customer'] = $stripeCustomerId;
$responseArr['publishableKey'] = 'pk_test_51IExe2GvuHsXzhCxFYvalZTIMNiLbccXKU9ggANCJmQbOaTkPdyWtt85ylrPbhmo7qR7JLNaOKgT9q9IHsm4zgw200RoRnb09x';
dump($responseArr);
return new JsonResponse($responseArr);
}
}
/**
* @Route("test-stripe-order", methods={"GET", "POST"})
*/
public function testStripeOrderAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf) {
$entityManager = $this->getDoctrine()->getManager();
$userObj = $entityManager->getRepository(User::class)->find(1);
if ($userObj instanceof User) {
$stripeCustomerId = $userObj->getStripeCustomerId();
$paymentIntent = $stripeClient->retrivePaymentIntentForCustomer('pi_3KbHhCGvuHsXzhCx17pHlyxe');
dump($paymentIntent);
dump('Exp Month : '.$paymentIntent->charges->data[0]->payment_method_details->card->exp_month);
dump('Exp Year : '.$paymentIntent->charges->data[0]->payment_method_details->card->exp_year);
dump('Last4 : '.$paymentIntent->charges->data[0]->payment_method_details->card->last4);
dump('Name : '.$paymentIntent->charges->data[0]->billing_details->name);
dump('Brand : '.$paymentIntent->charges->data[0]->payment_method_details->card->brand);
if ($paymentIntent->charges->data[0]->payment_method_details->card->wallet != NULL) {
dump('Card Type : '. $paymentIntent->charges->data[0]->payment_method_details->card->wallet->type);
} else {
dump('Card Type : '.$paymentIntent->charges->data[0]->payment_method_details->card->type);
}
dump('Card Type : '. $paymentIntent->charges->data[0]->payment_method_details->card->funding);
dump('Customer : '. $paymentIntent->charges->data[0]->customer);
dump('Payment Intent Id : '.$paymentIntent->id);
dump('Charge Id : '. $paymentIntent->charges->data[0]->id);
dump('Balance Transaction : '. $paymentIntent->charges->data[0]->balance_transaction);
dump($stripeClient->getChargeDetailsForChargeId($paymentIntent->charges->data[0]->id));
dump($stripeClient->getStripeBalanceTransactionDetails($paymentIntent->charges->data[0]->balance_transaction));
$responseArr = [];
$responseArr['paymentIntent'] = $paymentIntent->client_secret;
$responseArr['customer'] = $stripeCustomerId;
$responseArr['publishableKey'] = 'pk_test_51IExe2GvuHsXzhCxFYvalZTIMNiLbccXKU9ggANCJmQbOaTkPdyWtt85ylrPbhmo7qR7JLNaOKgT9q9IHsm4zgw200RoRnb09x';
return new JsonResponse($responseArr);
}
}
/**
* @Route("check-test", methods={"GET", "POST"})
*/
public function checkTestAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf) {
$entityManager = $this->getDoctrine()->getManager();
$userObj = $entityManager->getRepository(User::class)->find(1);
if ($userObj instanceof User) {
$stripeCustomerId = $userObj->getStripeCustomerId();
dump($encryption->decryptData('LB54+mLcbANnjU0acoxzGQ=='));
$cardId = 'card_1KaylKGvuHsXzhCxmiPIAWph';//$encryption->decryptData('M/6gWKqXa1KmhPrs7drcXa6oWC+HmUYWNtIfKJ8qg8U=');
try {
$responsePaymentIntent = $stripeClient->createPaymentIntentForMonthlyRenewalCustomer("cus_J1TAhT1Jp0ysew", 3000, 'CHF', 'WP', 'darshit261991@gmail.com', '1', '1', '100', '5', $cardId);
dump($responsePaymentIntent);
} catch (ApiErrorException $aee) {
dump($aee);
} catch (\Exception $e) {
}
}
// replace this example code with whatever you need
return $this->render('index.html.twig', [
]);
}
/**
* @Route("database", methods={"GET", "POST"})
*/
public function databaseAction(Request $request, StripeClient $stripeClient, WPGeneralService $generalService, ParkingSupplierService $parkingSupplierService, Encryption $encryption, SendMail $sendMail, MailManager $mailManager, Pdf $knpSnappyPdf) {
$entityManager = $this->getDoctrine()->getManager();
$spotList = $entityManager->getRepository(PS_Add_Spot::class)->getSearchedSpotList('', 20);
dump($spotList);
foreach ($spotList as $index => $spot) {
if ($spot instanceof PS_Add_Spot) {
dump($spot->getPsAddSpotDefaultImage());
break;
}
}
// replace this example code with whatever you need
return $this->render('index.html.twig', [
]);
}
}