Support

Home Forums Event Espresso Premium MIGS payment Error

MIGS payment Error

Posted: December 24, 2017 at 6:26 am


Mrakor

December 24, 2017 at 6:26 am

hi there, when i going to make payment using MIGS plugin i have error

An error has occurred:
Transaction not processed – system error.
EE_SPCO_Reg_Step_Payment_Options – _process_payment_status – 2505

is this propblem with EE payment system or what?


Josh

  • Support Staff

December 26, 2017 at 2:56 pm

Hi there,

That may be a problem related to the current version of the MIGS plugin. Would you like to try the release candidate? If so you can download a copy here:

https://www.dropbox.com/s/9ju8ouvu3viudkr/eea-migs-payment-method.zip?dl=0


Mrakor

December 26, 2017 at 10:24 pm

nice, it worked, i still in TEST mode with bank, so i must get back to them to say its fully worked, i have a last question, but it about (offsite/offilne) payment
we have payment gateway called (Fawry) its working online payment and offline payment methods(POS points) so, so when the user select pay with them they will get him #number to pay it from a (pos) point, then there server will send to us its (PAID)
* how to get #FAWERY-Number from URL Back to show it to user again and register it on my system, and is $returnURL will be the same they will send that Payment succeed ?


Mrakor

December 26, 2017 at 10:25 pm

anthor about MIGS, i need to save (vpc_TxnResponseCode) in my Gateway


Josh

  • Support Staff

December 27, 2017 at 9:08 am

Hi Mrakor,

When it comes to custom gateway development related questions what I can do is point you to the gateway development documentation:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/L–Payment-Methods-and-Gateways


Mrakor

December 27, 2017 at 9:24 am

i used all things and codes, As try to make payment with (MIGS 3.0 Party”OFFSITE”).
its not going to update the ticket status after payment done and completed


Josh

  • Support Staff

December 27, 2017 at 9:49 am

You wouldn’t actually use “all things and codes” since it’s apparently an offsite gateway. Instead, you use the offsite gateway class:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/L–Payment-Methods-and-Gateways/gateway-classes.md#ee_offsite_gateway


Mrakor

December 28, 2017 at 7:23 am

this is my code


<?php

if (!defined('EVENT_ESPRESSO_VERSION')) {
exit('No direct script access allowed');
}

/**
*
* EEG_Mock_Onsite
*
* Just approves payments where billing_info[ 'credit_card' ] == 1.
* If $billing_info[ 'credit_card' ] == '2' then its pending.
* All others get refused
*
* @package Event Espresso
* @subpackage
* @author Mike Nelson
*
*/

class EEG_New_Payment_Method_Offsite extends EE_Offsite_Gateway{

/**
* This gateway supports all currencies by default. To limit it to
* only certain currencies, specify them here
* @var array
*/
protected $_currencies_supported = EE_Gateway::all_currencies_supported;

/**
* Example of site's login ID
* @var string
*/
protected $_login_id = null;

/**
* Whether we have configured the gateway integration object to use a separate IPN or not
* @var boolean
*/
protected $_override_use_separate_IPN = null;

/**
* @return EEG_New_Payment_Method_Offsite
*/
public function __construct() {
//if the gateway you are integrating with sends a separate instant-payment-notification request
//(instead of sending payment information along with the user)
//set this to TRUE
$this->set_uses_separate_IPN_request( false ) ;
parent::__construct();
}

/**
* Override's parent so this gateway integration class can act like one that uses
* a separate IPN or not, depending on what is set in the payment methods settings form
* @return boolean
*/
public function uses_separate_IPN_request() {
if( $this->_override_use_separate_IPN_request !== null ) {
$this->set_uses_separate_IPN_request( $this->_override_use_separate_IPN_request );
}
return parent::uses_separate_IPN_request();
}

/**
*
* @param arrat $update_info {
* @type string $gateway_txn_id
* @type string status an EEMI_Payment status
* }
* @param type $transaction
* @return EEI_Payment
*/
public function handle_payment_update($update_info, $transaction) {
if( ! isset( $update_info[ 'vpc_TxnResponseCode' ] ) !== false ){
return NULL;
}
$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['vpc_TransactionNo'] );
if($payment instanceof EEI_Payment && isset( $update_info[ 'vpc_TxnResponseCode' ] ) !== false ){
if( $update_info[ 'vpc_AcqResponseCode' ] === '0' ){
$payment->set_status( $this->_pay_model->approved_status() );
$payment->set_gateway_response( str_replace( '+', ' ', $update_info['vpc_Message'] ) );
$payment->set_amount( floatval( $update_info['vpc_Amount'] / 100 ) );
}elseif( $update_info[ 'vpc_AcqResponseCode' ] === array('B', 'U', 'E', '2')){
$payment->set_status( $this->_pay_model->declined_status() );
$payment->set_gateway_response( $vpc_Message );
}else{
$payment->set_status( $this->_pay_model->failed_status() );
$payment->set_gateway_response( $vpc_Message );
}
}
return $payment;
}

/**
*a
* @param EEI_Payment $payment
* @param type $billing_info
* @param type $return_url
* @param type $cancel_url
*/
private function _log_clean_response( $response, $payment ) {
$cleaned_response_data = $response;
unset($cleaned_response_data['vpc_CSCResultCode']);
unset($cleaned_response_data['vpc_CSCRequestCode']);
$this->log( array('MIGS Response' => $cleaned_response_data), $payment );
}
public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) {

global $auto_made_thing_seed;
if( empty( $auto_made_thing_seed ) ) {
$auto_made_thing_seed = rand(1,1000000);
}
$payment->set_txn_id_chq_nmbr( $auto_made_thing_seed++ );

$transaction = $payment->transaction();
$primary_registrant = $transaction->primary_registration();

$secretHash="7E5C2F4D270600C61F5386167ECB8DA6";
$accessCode='77426638';
$merchantId='TESTEGPTEST';

$data = array(
"vpc_AccessCode" => $accessCode,
'vpc_Amount' => str_replace( array(',', '.'), '', number_format( $payment->amount(), 2) ),
"vpc_Command" => 'pay',
"vpc_Locale" => 'en',
'vpc_MerchTxnRef' => substr( $primary_registrant->reg_code(). date( 'YmdHis' ) . '-' . rand( 0, 99999 ), 0, 40 ),
"vpc_Merchant" => $merchantId,
"vpc_Currency" => 'EGP',
'vpc_OrderInfo' => substr( sprintf( __('Payment of %2$s for %2$s', 'event_espresso'), $payment->amount(), $primary_registrant->reg_code() ), 0, 34 ),
"vpc_ReturnURL" => $return_url,
"vpc_Version" => '1',
'vpc_SecureHashType' => 'SHA256' ,
'amount' => $payment->amount(),
'gateway_txn_id' => $payment->txn_id_chq_nmbr(),
'return_url' => $return_url,
'uses_separate_IPN_request' => $this->uses_separate_IPN_request(),
'ipn_url' => $notify_url,
);

ksort($data);
$hash = null;
foreach ($data as $k => $v) {
if (in_array($k, array('vpc_SecureHash', 'vpc_SecureHashType'))) {
continue;
}
if ((strlen($v) > 0) && ((substr($k, 0, 4)=="vpc_") || (substr($k, 0, 5) =="user_"))) {
$hash .= $k . "=" . $v . "&";
}
}
$hash = rtrim($hash, "&");

$secureHash = strtoupper(hash_hmac('SHA256', $hash, pack('H*', $secretHash)));
$paraFinale = array_merge($data, array('vpc_SecureHash' => $secureHash));
$payment->set_redirect_url( 'https://migs.mastercard.com.au/vpcpay?' . http_build_query($paraFinale));

return $payment;

}

}

// End of file EEG_Mock_Onsite.php


Tony

  • Support Staff

December 28, 2017 at 9:12 am

Please don’t post large sections of code on the forums as the formatting makes it difficult to read, instead, use a service such as Pastebin or create a gist and post the link for either here.

So your being directed to MIGS, making a payment and then being directed back to the thank you page, only the payment has not updated to complete?

Have you checked that the handle_payment_update method is actually being called?

Does MIGS post the user back to the site with the payment details or does it use an ‘IPN’ type system where it sends the details on a separate request from directing the user back to your site?


Mrakor

December 28, 2017 at 9:21 am

i checked handle_payment_update code twice, but i added now wp_mail function @ front and end to handle_payment_update function, i didn’t any $_RQUSET or any details in log sended in email

Array
(
    [uts] => 1514476972
    [step] => payment_options
    [action] => process_gateway_response
    [selected_method_of_payment] => new_payment_method_offsite
    [spco_txn] => 139
    [post_id] =>
    [post_name] => ee-pages/registration-checkout
    [post_type] =>
    [is_espresso_page] => 1
)

this is my full code on github
https://gist.github.com/mafam1024/56e6b6685e378261ae11ea959fba32a4


Tony

  • Support Staff

December 28, 2017 at 9:51 am

Does MIGS post the user back to the site with the payment details or does it use an ‘IPN’ type system where it sends the details on a separate request from directing the user back to your site?


Mrakor

December 28, 2017 at 9:22 pm

the test version that i have from bank, it send POST payment details in URL
that’s the version bank send
nileticket.com/wp-content/plugins/new-payment-method/payment_methods/New_Payment_Method_Offsite/test1/PHP_VPC_3Party_Order.html

code : https://gist.github.com/mafam1024/aef07fed3fa9a43c77ec8593e83e7480


Mrakor

December 28, 2017 at 9:25 pm

TEST VISA ACCOUNT
Visa 4987654321098769 05/21 100


Tony

  • Support Staff

December 29, 2017 at 5:50 am

I’m not sure what the above is trying to show me?

If the MIGS Offsite payment method uses an IPN type request and sends the details on a seprate request to the one user to direct the user back to the site, then you need to override the set_uses_separate_IPN_request method and set the value to true.

If not you need to investigate how MIGS are directing the user back to the site. It sounds like MIGS is directing the user back to the site without the payment details which would hint that they use an IPN type setup, but again you will need to investigate that further as this isn’t a payment method integration we support.


Mrakor

December 29, 2017 at 6:11 am

i turned set_uses_separate_IPN_request to true and its not effect, .
MIGS send user back to my site but, $update_info didn’t get values from MIGS.
where can i find and control $update_info so $return_url didn’t show any response from Migs


Tony

  • Support Staff

December 29, 2017 at 6:31 am

Why did you enable the above? Do MIGS use IPNs?

Have you checked how the integration actually works with MIGS?


Mrakor

December 30, 2017 at 8:58 am

no MIGS didn’t use ipns, it just used HASH to check if request coming from them is true or not.
now i turned IPN’s to true, and get function called _process_response_url from your code for (paypal Standard) but it seem that $update_info didn’t get values from MIGS back url

this is the values i get from $print_r for $update_info

Array
(
[uts] => 1514648909
[step] => payment_options
[action] => process_gateway_response
[selected_method_of_payment] => new_payment_method_offsite
[spco_txn] => 153
[post_id] =>
[post_name] => ee-pages/registration-checkout
[post_type] =>
[is_espresso_page] => 1
)


Tony

  • Support Staff

January 3, 2018 at 10:37 am

no MIGS didn’t use ipns, it just used HASH to check if request coming from them is true or not.

Have you checked this? The hash check can also be used on the IPN request.

You need to know if MIGS post the user back to the user with the payment details in that request… or they direct the user back to the site and send the payment details on a separate request.

Can you link me to the documentation for the MIGS integration you are using? Theres so many conflicting variables in the code your using (I’m guessing that’s from you attempting to get it working) that I can’t tell whats requires by MIGs and what isn’t.

now i turned IPN’s to true, and get function called _process_response_url from your code for (paypal Standard) but it seem that $update_info didn’t get values from MIGS back url

How you pull the details depends on how MIGS directs the user back to the site which is why I keep asking the same question above.


Mrakor

January 3, 2018 at 11:00 pm

at first this is link to MIGS Doc
https://drive.google.com/open?id=1qgXw_4Kv5Aw8FvjWHE45WZ1_a0WTxsdS
second: i uploaded the test php code, that bank send to me, on this URL:
https://nileticket.com/wp-content/plugins/new-payment-method/payment_methods/New_Payment_Method_Offsite/test1/PHP_VPC_3Party_Order.html
you can complete process to it via this TEST VISA Numbers
CARD”VISA”:4987654321098769 EXP:05/21 cv2: 100
you will find that MIGS send user back to site with payment parameters in URL


Mrakor

January 7, 2018 at 7:14 am

is there any solution ?


Mrakor

January 8, 2018 at 7:39 am

i fixed and payment now is going to succeeded
but when i open then Transaction records i didn’t find in “Billing Information” Transaction information may i need like Card type, vpc_AuthorizeId, vpc_AVSRequestCode and other information may i need to be in contact with bank if their any Fraud actions

last thing,
every transaction is recored in log for 3 times as this photo
https://drive.google.com/file/d/1E3Z4ycsDNvMIETgN8-nZtpHuEktcbXQO/view?usp=sharing

thanks


Tony

  • Support Staff

January 8, 2018 at 3:02 pm

i fixed and payment now is going to succeeded…

I’m curious as to what the problem was in the end, can you provide details of what you changed?

but when i open then Transaction records i didn’t find in “Billing Information” Transaction information may i need like Card type, vpc_AuthorizeId, vpc_AVSRequestCode and other information may i need to be in contact with bank if their any Fraud actions

The ‘Billing information’ section stores the details entered into the payment method billing form, as your using an off site payment method it doesn’t have a billing form (the payment processor will have one, but EE does not).

You can add your own details to that section, however, you’ll then also need to write your own function to pull the data as currently, EE expects the payment method to have a billing for in order to display details there.

last thing,
every transaction is recored in log for 3 times as this photo
https://drive.google.com/file/d/1E3Z4ycsDNvMIETgN8-nZtpHuEktcbXQO/view?usp=sharing

Those are not identical logs though correct? You should have an entry when attempting to create the payment object, another when sending the request to your payment method and another when the details are returned.

The support post ‘MIGS payment Error’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 1 year, 7 months ago ago

Topic Tags

Tagged: ,

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!