You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some items that will be one time payments and others that will recurring, I'm wanting to know how to have these in the same cart. One idea I had was that I could send them to the payment gateway to pay for the one time items and then redirect them back after the payment was successful or at least attempted and have them attempt to pay for the rest (The recurring payment items) But I don't know that this is the best way, is there a way I can specify both in the same cart?
In this, pay_for_county is the item type that would be a recurring payment and any other would be one time. Looking at this page at L_BILLINGTYPEn I'm lost on a couplethings, one of which, what does n or m indicate? Also, MerchantInitiatedBilling looks like the right option as I need to specify per-transaction billing agreements but how would I set this and then how would I specify which items were one-item and which were recurring?
/**
* @Route("/account/county/add/{id}", name="county_add", requirements={"id": "\d+"})
* @ParamConverter("County", class="DirectoryPlatform\AppBundle\Entity\County")
*/
public function countyAction(Request $request, County $county)
{
// if ($this->getUser() !== $listing->getUser()) {
// throw $this->createAccessDeniedException('You are not allowed to access this page.');
// }
$payments = $this->getParameter('app.payments');
if ($payments['pay_for_county']['enabled']) {
$session = $request->getSession();
if ($session->get('products')) {
foreach ($session->get('products') as $product) {
if ($product['type'] == 'pay_for_county' && $product['county_id'] == $county->getId()) {
$this->addFlash('danger', $this->get('translator')->trans('Product is already in cart.'));
return $this->redirectToRoute('user_counties', [
'stateId' => $county->getStateId()
]);
}
}
}
$product = [
'type' => 'pay_for_county',
'county_id' => $county->getId(),
'price' => $payments['pay_for_county']['price'],
'duration' => $payments['pay_for_county']['duration'],
];
if ($session->has('products')) {
$products = $session->get('products');
array_push($products, $product);
$session->set('products', $products);
} else {
$session->set('products', [$product]);
}
$this->addFlash('success', $this->get('translator')->trans('Request for advertising county has been added into cart.'));
} else {
$profile = $this->getUser()->getProfile();
$county->setProfiles($profile);
try {
$em = $this->getDoctrine()->getManager();
$em->persist($county);
$em->flush();
$this->addFlash('success', $this->get('translator')->trans('Listing has been successfully marked as featured.'));
} catch (\Exception $e) {
$this->addFlash('danger', $this->get('translator')->trans('An error occurred when saving listing object.'));
}
}
return $this->redirectToRoute('user_counties', [
'stateId' => $county->getStateId()
]);
}
Here I'm adding the products to the final order, could I possibly do it here? And even though it's a thing I'll have to figure out AFTER I fix this, how would I go about pinging the payment gateway to ensure the recurring payment had been successful? Since there are several items that are recurring payments, I don't know that I could have a way of figuring out which had been successful.
The text was updated successfully, but these errors were encountered:
I have some items that will be one time payments and others that will recurring, I'm wanting to know how to have these in the same cart. One idea I had was that I could send them to the payment gateway to pay for the one time items and then redirect them back after the payment was successful or at least attempted and have them attempt to pay for the rest (The recurring payment items) But I don't know that this is the best way, is there a way I can specify both in the same cart?
In this,
pay_for_county
is the item type that would be a recurring payment and any other would be one time. Looking at this page atL_BILLINGTYPEn
I'm lost on a couplethings, one of which, what doesn
orm
indicate? Also,MerchantInitiatedBilling
looks like the right option as I need to specify per-transaction billing agreements but how would I set this and then how would I specify which items were one-item and which were recurring?Here I'm adding the products to the final order, could I possibly do it here? And even though it's a thing I'll have to figure out AFTER I fix this, how would I go about pinging the payment gateway to ensure the recurring payment had been successful? Since there are several items that are recurring payments, I don't know that I could have a way of figuring out which had been successful.
The text was updated successfully, but these errors were encountered: