Hi!
I moved the logic to send an email through Uniform from the controller building the form, to another controller. I’m waiting for a banking transaction to succeed before creating the order as a subpage (as of now working fine) and send out an email.
I’m worried if the email does not trigger anymore is because it’s not part of the controller with the form? I saved the form with the data in a session, which I then am able to correctly call up.
I called the uniform plugin as usual at the top of the page, but before that I’m calling another plugin
Ideas?
<?php
require_once 'vendor/autoload.php';
use \GingerPayments\Payment\Ginger;
use Uniform\Form;
return function($site, $pages, $page) {
foreach($order->transactions() as $transaction) {
if($transaction->status() == 'completed') {
try {
$new_order = page('shop/orders')->children()->create('order-' . time(), 'order', $rules);
} catch(Exception $e) {
echo $e->getMessage();
}
try {
$userform->emailAction([
'to' => 'andre@andrefincato.info',
'from' => 'work@andrefincato.info',
'subject' => 'Sandberg Series order',
'snippet' => 'email',
'service' => 'phpmailer'
]);
} catch(Exception $e) {
echo $e->getMessage();
}
};
};
return compact('order', 'userform');
};
One more thing, upon redirect from the external payment page to the kirby website, at the end of the controller, I added these two to delete the cookies holding the order + user infos. I am able to use the cookies before in the controller and retrieve data, but wondering if they cause any problem at the end of the controller?
//++ destroy everything
s::destroy('o_ing');
s::destroy('user-form');
thanks,
af