Forums

send 2 emails in stead of 1

tvdgreft 10 Jan, 2016
Is there a solution for topic:

http://www.chronoengine.com/forums/posts/f2/t97711/send-to-emails-instead-of-just-one.html?hilit=mollie

Theo
GreyHead 11 Jan, 2016
Hi tvdgreft,

Not that I know of - but the problem wasn't reported by anyone else as far as I remember.

Are you using CFv4 or CFv5?

Bob
tvdgreft 11 Jan, 2016
Hi Bob,

The problem is, that the success mail is always sent, and in case of a failure the falure message is sent. In case of success a second success mail is sent.
I am using mollie in CFv4, but if you have a working version in CFv5 I prefer to use that and test if the problems is solved in this version.

Theo
GreyHead 11 Jan, 2016
Hi Theo,

I've PM'd you a link for the CFv5 version to test.

Bob
tvdgreft 11 Jan, 2016
Hi Bob,

In the cfv5 version I got exactly the same problem.

My setup is:



When I click on payment aborted in mollie I get the failed message but also a paid message.

BUT.... in the content of the paid message, the value of the form fields (amount, description) are empty!!
and The paid message is sent BEFORE the failed message. It looks like if the paid message is sent before the mollie transaction.
GreyHead 12 Jan, 2016
Hi Theo,

Very odd - it looks as if the ShowStopper only stops the current event and not the whole form. I managed to find a workaround though.

In the On Fail event add a Custom Code action with this code
<?php
$form->data['mollie_status'] = 'fail';
?>

After the Gateway Mollie Submit action add an Event Switcher, set the Events list to just fail and add this code
<?php
if ( !empty($form->data['mollie_status']) ) {
  return $form->data['mollie_status'];
}
?>
Then drag a second Show Stopper into the On Fail event of the Event Switcher. That one does seem to stop the later actions from running.

Bob
tvdgreft 12 Jan, 2016
Hi Bob,

That does not work either.
What I think is that the problem comes from Mollie. Because the success part is always started first, with the form fields empty. And after that, the fail or success part is started (depending whether I choose), with the correct mollie form fields.
What I did now is: I added an event switcher after the mollie submit action with the following code:
<?php
$cf_id=$form->data['mollie']['cf_id'];
if ( empty($cf_id) ) {
      return ("fail");
}
?>

and a Show Stopper in the in fail event of the event switcher,
to avoid the unnecessary call (from Mollie???????)
and that worked.

But I have another problem in the cfv5 version.
After payment at Mollie, I need the contents of the form fields for my database.
But all formfields are empty after the mollie submit, except the fields $form-data['mollie'][]
In the cfv4 version all form fields are well filled after the mollie submit

Greetings,
Theo
GreyHead 12 Jan, 2016
Hi Theo,

I don't know why my code isn't working for you, it seems OK when I test.

I'm not sure what form data you need? All the data returned from Mollie is available in $form->data['mollie']. If there is other data that you need then you need to Save to a database table before transferring the user to the bank, then read the data back again when they are returned. (Saving to the session might work but I'm not certain that the session is preserved when they leave the site.)

Bob
tvdgreft 12 Jan, 2016
Hi Bob,

Beside amount and description I added some extra fields, which I need in the mail I send after payment.
In the cfv4 version I could print for example $form->data['amount'], $form->data['description'] and other fields I added to the form. But in the cfv5 version those fields are empty after mollie submit.
I can understand that the content is lost after the bank transfer, but how could that work in cfv4 then?
By the way , what do you mean with "saving the session"?

Greetings,
Theo
GreyHead 12 Jan, 2016
Hi Theo,

Please try $form->data['mollie']['amount'] and $form->data['mollie']['description']

Here is what I see in the DeBugger (after a failed transaction)
$form->data Array
(
    [option] => com_chronoforms5
    [chronoform] => test_mollie_gh
    [event] => submit
    [transaction_id] => 0dcd0423f190a95d954846e8a9991f06
    [mollie] => Array
        (
            [cf_id] => 356
            [uid] => 
            [recordtime] => 2016-01-12 10:02:48
            [paidtime] => 0000-00-00 00:00:00
            [unixpaidtime] => 2016-01-12 02:02:53
            [ipaddress] => 
            [cf_user_id] => 0
            [amount] => 10000
            [transaction_id] => 0dcd0423f190a95d954846e8a9991f06
            [bank_id] => 9999
            [params] => {"enabled":"on","partner_id":"792237","profile_key":"4e42106a","amount_name":"amount","description_name":"description","test_mode":"on","logging":false}
            [description] => sxdfsfds
            [key] => RZ5182S
            [paid] => 0
            [status] => Cancelled
            [message] => "Payment of 100.00 failed with code 0 and message: "
            [amount_paid] => 100.00
            [consumer_info] => 
            [currency] => EUR
            [user_id] => 0
            [name] => 
            [company] => 
            [address1] => 
            [locality] => 
            [pcode] => 
            [country] => 
            [email] => 
            [coupon] => 
            [artnb] => 
        )

    [mollie_status] => fail
    [ip_address] => 2.10.185.36
)
Array
(
)


Joomla saves 'session' data to keep track of users as they move around the site. You can add data to and read data from the session store. This is preserved while the user is active on the site and for a specified time later - that defaults to 15m.
tvdgreft 12 Jan, 2016
Hi Bob,

In my form I have 3 fields: cursus, amount and description.
After the Mollie submit I have a custom code with:

<?php
$cursus=$form->data['cursus'];
$amount=$form->data['amount'];
$description=$form->data['description'];
echo "paid<br>cursus=$cursus<br>description=$description<br>amount=$amount<br>";
?>

The form in cfv4 prints:

paid
cursus=basiscursus
description=cursusgeld
amount=125

But the form in cfv5 prints:

paid
cursus=
description=
amount=

How can this be explained
tvdgreft 15 Jan, 2016
Hi Bob,

In order to find out what the problem could be with the double emails, I replaced the emails by a customcode which writes a log to a file.
I placed a log before the Mollie Submit, after on fail, and after the mollie submit.
The content of the customcode looks like:

<?php
$cf_id=$form->data['mollie']['cf_id'];
$transaction_id=$form->data['transaction_id'];
$amount=$form->data['amount'];
$description=$form->data['description'];
$date = date('Y-m-d H:i:s');
$path=JPATH_SITE;
$logfile = fopen($path . '/lilypond/mollie.txt', "a");
fwrite($logfile,"$date: before mollie submit: cf_id=$cf_id transaction_id=$transaction_id description=$description amount=$amount\n");
fclose($logfile);
?>

The setup of the form looks like:



What happens after a submit of the form looks interesting and might help you to locate the problem.
Next log is after a successfull payment

2016-01-15 09:40:42: before mollie submit: cf_id= transaction_id= description=testcursus amount=100
2016-01-15 09:40:54: before mollie submit: cf_id= transaction_id=2feeb293483f447b72fda56ea2e166a7 description= amount=
2016-01-15 09:40:54: on paid: cf_id= description= amount=
2016-01-15 09:40:55: before mollie submit: cf_id= transaction_id=2feeb293483f447b72fda56ea2e166a7 description= amount=
2016-01-15 09:40:55: on paid: cf_id=441 description=testcursus amount=100


And next log after a cancelled payment:

2016-01-15 09:41:19: before mollie submit: cf_id= transaction_id= description=testcursus amount=100
2016-01-15 09:41:22: before mollie submit: cf_id= transaction_id=c5de3c6f0caee52a5b4d06d4318944d0 description= amount=
2016-01-15 09:41:23: on paid: cf_id= description= amount=
2016-01-15 09:41:24: before mollie submit: cf_id= transaction_id=c5de3c6f0caee52a5b4d06d4318944d0 description= amount=
2016-01-15 09:41:24: on fail: cf_id=442 description=testcursus amount=100

You will see, that after a payment the submit part is called twice.

Greetings,
Theo
This topic is locked and no more replies can be posted.