clare75
Forum Replies Created
-
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayHi Franky,
This is a message from Pradeep, the software developer I work with who has been helping to sort this out and tested the update…
Thanks for the changes, it seems to work until SagePay sends the success message. I can see from the URL that the transaction was successful but because the $crypt query parameter is not handled properly in the code it fails on the client side with an empty page.
The result I get from the URL is:
eme_pmt_result=succes&eme_pmt_rndid=5a71bc92e31c2_aed43932af7b7c896fac7fbe926ab6e6&eme_eventAction=sagepay_notification&crypt=@7c94b33dbe…………..
I think the $crypt variable needs to be added to following files to address this issue:
eme_payments line 1271
function eme_sagepay_notification($crypt) {<——Please add $crypt here
$sagepay_demo = get_option(’eme_sagepay_demo’);
if ($sagepay_demo == 1) {
$sagepay_pwd = get_option(’eme_sagepay_test_pwd’);
} else {
$sagepay_pwd = get_option(’eme_sagepay_live_pwd’);
}require_once ‘payment_gateways/sagepay/eme-sagepay-util.php’;
$decrypt = SagepayUtil::decryptAes($crypt, $sagepay_pwd); <——This fails with null error SagepayUtil::decryptAes(NULL, ‘zb97CafWqq…’)
$decryptArr = SagepayUtil::queryStringToArray($decrypt);
if ($decrypt && !empty($decryptArr)) {
if ($decryptArr[‘Status’]==’OK’) {
$payment_id=$decryptArr[‘VendorTxCode’];
eme_update_payment_paid($payment_id);
}
}
}eme_actions.php line 188
================
if (isset($_GET[’eme_eventAction’]) && $_GET[’eme_eventAction’]==”sagepay_notification”) {
eme_sagepay_notification($_GET[‘crypt’]);<——Please add $_GET[‘crypt’] here to pass the result from SagePay to above function
// sagepay doesn’t use a notification url, but sends the status along as part of the return url, so we just check
// the status and set paid or not, but then we continue regular flow of events
}Also when we send the event the even name is surrounded with 039; like 039;Test039;
I think it is because of the single quotes surrounding %s on the below lines:
me_payments line 641
if ($payment[‘member_id’]>0) {
$success_link = eme_payment_return_url($payment,1);
$fail_link = eme_payment_return_url($payment,2);
$name = eme_esc_html(sprintf(__(“Member signup for ‘%s'”,’events-made-easy’),$line[‘name’]));
} elseif ($multi_booking) {
$success_link = eme_payment_return_url($payment,1);
$fail_link = eme_payment_return_url($payment,2);
$name = __(“Multiple booking request”,’events-made-easy’);
} else {
$success_link = eme_payment_return_url($payment,1,$line);
$fail_link = eme_payment_return_url($payment,2,$line);
$name = eme_esc_html(sprintf(__(“Booking for ‘%s'”,’events-made-easy’),$line[‘event_name’]));Can you please add these two changes to the relevant files? I will check them and confirm to you once that’s done.
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayThanks for the link Franky.
We will download and give you feedback soon.
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayI will be very happy to test the latest dev version on our system.
“In the rsvp section and people/members, these dropdowns are now enforced for countries/states (using the detected locale).”
Can you please show me a sample tag on how to implement this. I also hope that this is a dropdown and stores the country value to people table. Where do I download the dev version to test?
Thanks
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayI found the this link with the country codes as sagepay likes them. I think implementing them in a database table could be a solution.
State information is only mandatory for America. For the rest of the world it is not important. This link gives you the Sagepay mandatory field information.
I will email you the unified diff soon.
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayHi Franky,
I have included the changes we made with file names and line numbers below:
eme_payments.php => line 677
Old code:
$query = array(
‘VendorTxCode’ => $payment_id,
‘Amount’ => number_format($price, 2, ‘.’, ”),
‘Currency’ => $cur,
‘Description’ => $name,
‘SuccessURL’ => $success_link,
‘FailureURL’ => $fail_link
);New code:
$booking_ids = eme_get_payment_booking_ids($payment_id);
$booking_id = $booking_ids[0];
$booking = eme_get_booking($booking_id);
$person_id = $booking[‘person_id’];
$person = eme_get_person($person_id);$query = array(
‘VendorTxCode’ => $payment_id,
‘Amount’ => number_format($price, 2, ‘.’, ”),
‘Currency’ => $cur,
‘Description’ => $name,
‘BillingSurname’ => $person[‘lastname’],
‘BillingFirstnames’ => $person[‘firstname’],
‘BillingAddress1’ => $person[‘address1’],
‘BillingCity’ => $person[‘city’],
‘BillingPostCode’ => $person[‘zip’],
‘BillingCountry’ => $person[‘country’],
‘DeliverySurname’ => $person[‘lastname’],
‘DeliveryFirstnames’ => $person[‘firstname’],
‘DeliveryAddress1’ => $person[‘address1’],
‘DeliveryCity’ => $person[‘city’],
‘DeliveryPostCode’ => $person[‘zip’],
‘DeliveryCountry’ => $person[‘country’],
‘SuccessURL’ => $success_link,
‘FailureURL’ => $fail_link
);eme_payments.php = > line 1242
Here $crypt variable needs to be passed as a parameter to the function.
Old code:
function eme_sagepay_notification()New code:
function eme_sagepay_notification($crypt)eme_actions.php => line 184
Old code:
eme_sagepay_notification();New code:
eme_sagepay_notification($_GET[‘crypt’]);We have created the form format in the RSVP tab of the setting as below:
<table class=’eme-rsvp-form’>
<tr><th scope=’row’>First Name*:</th><td>#REQ_FIRSTNAME</td></tr>
<tr><th scope=’row’>Last Name*:</th><td>#REQ_LASTNAME</td></tr>
<tr><th scope=’row’>E-Mail*:</th><td>#REQ_EMAIL</td></tr>
<tr><th scope=’row’>Phone number:</th><td>#_PHONE</td></tr>
<tr><th scope=’row’>Seats*:</th><td>#_SPACES</td></tr>
<tr><th scope=’row’>Address*:</th><td>#REQ_ADDRESS1</td></tr>
<tr><th scope=’row’>City*:</th><td>#REQ_CITY</td></tr>
<tr><th scope=’row’>Postcode*:</th><td>#REQ_ZIP</td></tr>
<tr><th scope=’row’>Country*:</th><td>#REQ_CNTRYLIST</td></tr>
<tr><th scope=’row’>Comment:</th><td>#_COMMENT</td></tr>
#_CAPTCHAHTML{<tr><th scope=’row’>Please fill in the code displayed here:</th><td>#_CAPTCHA</td></tr>}
</table>
#_SUBMITWe created a custom #_CNTRYLIST field to capture the county in the format Sagepay needs. It is just a hack and only works for United Kingdom. Perhaps we can have a field named #_SAGEPAYCOUNTRY or something similar?
The code of that is below, please correct us if we have made any mistakes here.
eme_formfields.php => line 1425
elseif (preg_match(‘/#_CNTRYLIST/’, $result)) {
$postfield_name=”${var_prefix}cntrylist${var_postfix}”;
if ($editing_booking_from_backend && isset($bookerCountry))
$entered_val=$bookerCountry;
elseif ($eme_multibooking && isset($_POST[‘bookings’][$event_id]) && isset($_POST[‘bookings’][$event_id][‘cntrylist’]))
$entered_val = $_POST[‘bookings’][$event_id][‘cntrylist’];
elseif (isset($_POST[‘cntrylist’]))
$entered_val = $_POST[‘cntrylist’];
else
$entered_val=’GB’;$cntry_arr = array (“GB” => “United Kingdom”);
$replacement = eme_ui_select($entered_val,$postfield_name,$cntry_arr,”,$required);
}eme_people.php => line 1597
function eme_person_from_rsvp($person_id,$lastname=”, $firstname=”, $email=”, $wp_id=0) {
$person = array();
if (isset($_POST[‘address1’])) $person[‘address1’] = eme_strip_tags($_POST[‘address1’]);
if (isset($_POST[‘address2’])) $person[‘address2’] = eme_strip_tags($_POST[‘address2’]);
if (isset($_POST[‘city’])) $person[‘city’] = eme_strip_tags($_POST[‘city’]);
if (isset($_POST[‘state’])) $person[‘state’] = eme_strip_tags($_POST[‘state’]);
if (isset($_POST[‘zip’])) $person[‘zip’] = eme_strip_tags($_POST[‘zip’]);
if (isset($_POST[‘country’])) $person[‘country’] = eme_strip_tags($_POST[‘country’]);
if (isset($_POST[‘cntrylist’])) $person[‘country’] = eme_strip_tags($_POST[‘cntrylist’]);
if (isset($_POST[‘phone’])) $person[‘phone’] = eme_strip_tags($_POST[‘phone’]);eme_rsvp.php => line 666
elseif (preg_match (“/(ADDRESS1|ADDRESS2|CITY|STATE|ZIP|COUNTRY|CNTRYLIST)/”,$required_field, $matches)) {
$fieldname=strtolower($matches[1]);
$fieldname_ucfirst=ucfirst($fieldname);
if (!isset($_POST[$fieldname])) array_push($missing_required_fields, __($fieldname_ucfirst,’events-made-easy’));
}With these changes it works for now. We need a better solution to show country dropdown for sagepay. We have only implemented UK in this dropdown. If USA is selected then the state needs to be sent as well. Some javascript to show the state field if USA is selected might be an option. We also need to then include that in the JSON send the sagepay. Any ideas how this can be done?
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayHi Franky,
Thanks for looking into this. Have you been able to find a fix?
The software developer I work with has had a look at the plugin code and has been able to edit it and get it working again, as a temporary fix, although I have not tested it my self yet to see if the payment will go through to Sage Pay. Would you like a copy of this if it helps?
Forum: Plugins
In reply to: [Events Made Easy] Sending Billing location to Sage PayHaving looked at the plug in code it appears that it is trying to send a lot of information to Sagepay and there is no way to add this information in the plugin settings. Such as Billing address, Delivery address etc. More info below from Sagepay Invalid resource transaction error…
vpsprotocol=3.00 txtype=PAYMENT paymenttype=PAYMENT vendor=southeastlondon vendorname= accounttype= username= website= vendordata= vendortxcode=8 amount=5.00 currency=GBP description=Booking for 039;Test Event039; vspterminal= address= postcode= billingpostcode= billingaddress= deliveryaddress= deliverypostcode= contactnumber= contactfax= customeremail= basket= allowgiftaid=0 applyavscv2= billingsurname= billingfirstnames= billingaddress1= billingaddress2= billingcity= billingcountry= billingstate= billingphone= deliverysurname= deliveryfirstnames= deliveryaddress1= deliveryaddress2= deliverycity= deliverycountry= deliverystate= deliveryphone= referrerid= billingagreement= token= storetoken= basketxml= customerxml= surchargexml= firecipientacctnumber= firecipientdob= firecipientpostcode= firecipientsurname= successurl=http://selondonchamber.org/events-2/?eme_pmt_result=succes&eme_pmt_rndid=5a536a3696cd2_cc574f83d940055ee6f236227a1062da&eme_eventAction=sagepay_notificationA failureurl=http://selondonchamber.org/events-2/?eme_pmt_result=fail&eme_pmt_rndid=5a536a3696cd2_cc574f83d940055ee6f236227a1062da&eme_eventAction=sagepay_notificationA vendoremail= emailmessage= crypt=
Has anyone else been able to get it working with Sagepay?
Forum: Plugins
In reply to: [Events Made Easy] Sage Pay Set Up ProblemThanks for the reply Franky, I have sorted this out.