SantiagoInteractive / mobilpay-card-gateway-for-woocommerce

mobilPay Card Gateway for WooCommerce
GNU General Public License v2.0
19 stars 6 forks source link

Pending Payments #1

Closed barila26 closed 8 years ago

barila26 commented 8 years ago

Hi. Nice job. I use your plugin. Everything works perfect. But when i have made the first payment, mobilpay did not aprove the payment right away (they made a check on transaction that took 7 min). After the payment, it has return back to site with the message 'Payment failed'. Is that possible to do something for the pending payments? Eventually to add an message for pending payments? I'll buy you a coffe :)

JohnnyTMD commented 8 years ago

Same problem , after payment on the mobilpay site , it returns to checkout page and says that payment failed.

SantiagoInteractive commented 8 years ago

Hi @barila26 and @JohnnyTMD Are you using the sandbox testing option? If yes, you should use only the credit card payment details provided by MobiPay with it's documentation/contract. I think this would be the issue in your case.

This plugin communicates with MobilPay platform via IPN responses even if you closed the session, when you come back and finish the payment some response is pushed in your shop's order.

If this is not the case, please provide more details, like:

Cheers!

JohnnyTMD commented 8 years ago

Hi, thanks for reply, I use this credit cards> 9900004810225098 - card acceptat neinrolat CVV = 111 9900541631437790 - card expirat 9900518572831942 - fonduri insuficiente 9900827979991500 - CVV2/CCV incorect 9900576270414197 - tranzactie nepermisa (de ex, card neinrolat) 9900334791085173 - card cu grad de risc (de exemplu, card furat) 9900130597497640 - eroare la banca emitenta (nu poate fi stabilit un canal , especially the first one. The site is in development mode , here is url to the site , you can see/test the whole process> #

On Wed, Aug 17, 2016 at 6:09 PM, Santiago Interactive < notifications@github.com> wrote:

Hi @barila26 https://github.com/barila26 and @JohnnyTMD https://github.com/JohnnyTMD Are you using the sandbox testing option? If yes, you should use only the credit card payment details provided by MobiPay with it's documentation/contract. I think this would be the issue in your case.

This plugin communicates with MobilPay platform via IPN responses even if you closed the session, when you come back and finish the payment some response is pushed in your shop's order.

If this is not the case, please provide more details, like:

  • The link where your are redirected after purchase.
  • Screenshot with order details from the wp-admin (the notes from the right side of the order should tell you some stuff about what went wrong).

Cheers!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SantiagoInteractive/mobilpay-card-gateway-for-woocommerce/issues/1#issuecomment-240442737, or mute the thread https://github.com/notifications/unsubscribe-auth/AHE3hHQSb2IFVnMNGnL2jDDzhvu5iHIFks5qgyQ3gaJpZM4Ji5Jz .

JohnnyTMD commented 8 years ago

Transactions appears on the mobilpay admin panel , but after redirect my website can't see what happens with transaction.

On Wed, Aug 17, 2016 at 6:37 PM, Johnny TMD johnnytmd5@gmail.com wrote:

Hi, thanks for reply, I use this credit cards> 9900004810225098 - card acceptat neinrolat CVV = 111 9900541631437790 - card expirat 9900518572831942 - fonduri insuficiente 9900827979991500 - CVV2/CCV incorect 9900576270414197 - tranzactie nepermisa (de ex, card neinrolat) 9900334791085173 - card cu grad de risc (de exemplu, card furat) 9900130597497640 - eroare la banca emitenta (nu poate fi stabilit un canal , especially the first one. The site is in development mode , here is url to the site , you can see/test the whole process> http://dev.milav.ro/voldexon/home/

On Wed, Aug 17, 2016 at 6:09 PM, Santiago Interactive < notifications@github.com> wrote:

Hi @barila26 https://github.com/barila26 and @JohnnyTMD https://github.com/JohnnyTMD Are you using the sandbox testing option? If yes, you should use only the credit card payment details provided by MobiPay with it's documentation/contract. I think this would be the issue in your case.

This plugin communicates with MobilPay platform via IPN responses even if you closed the session, when you come back and finish the payment some response is pushed in your shop's order.

If this is not the case, please provide more details, like:

  • The link where your are redirected after purchase.
  • Screenshot with order details from the wp-admin (the notes from the right side of the order should tell you some stuff about what went wrong).

Cheers!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SantiagoInteractive/mobilpay-card-gateway-for-woocommerce/issues/1#issuecomment-240442737, or mute the thread https://github.com/notifications/unsubscribe-auth/AHE3hHQSb2IFVnMNGnL2jDDzhvu5iHIFks5qgyQ3gaJpZM4Ji5Jz .

JohnnyTMD commented 8 years ago

How can i set up this?

On Wed, Aug 17, 2016 at 6:39 PM, Johnny TMD johnnytmd5@gmail.com wrote:

Transactions appears on the mobilpay admin panel , but after redirect my website can't see what happens with transaction.

On Wed, Aug 17, 2016 at 6:37 PM, Johnny TMD johnnytmd5@gmail.com wrote:

Hi, thanks for reply, I use this credit cards> 9900004810225098 - card acceptat neinrolat CVV = 111 9900541631437790 - card expirat 9900518572831942 - fonduri insuficiente 9900827979991500 - CVV2/CCV incorect 9900576270414197 - tranzactie nepermisa (de ex, card neinrolat) 9900334791085173 - card cu grad de risc (de exemplu, card furat) 9900130597497640 - eroare la banca emitenta (nu poate fi stabilit un canal , especially the first one. The site is in development mode , here is url to the site , you can see/test the whole process> http://dev.milav.ro/voldexon/home/

On Wed, Aug 17, 2016 at 6:09 PM, Santiago Interactive < notifications@github.com> wrote:

Hi @barila26 https://github.com/barila26 and @JohnnyTMD https://github.com/JohnnyTMD Are you using the sandbox testing option? If yes, you should use only the credit card payment details provided by MobiPay with it's documentation/contract. I think this would be the issue in your case.

This plugin communicates with MobilPay platform via IPN responses even if you closed the session, when you come back and finish the payment some response is pushed in your shop's order.

If this is not the case, please provide more details, like:

  • The link where your are redirected after purchase.
  • Screenshot with order details from the wp-admin (the notes from the right side of the order should tell you some stuff about what went wrong).

Cheers!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SantiagoInteractive/mobilpay-card-gateway-for-woocommerce/issues/1#issuecomment-240442737, or mute the thread https://github.com/notifications/unsubscribe-auth/AHE3hHQSb2IFVnMNGnL2jDDzhvu5iHIFks5qgyQ3gaJpZM4Ji5Jz .

SantiagoInteractive commented 8 years ago

Hi @JohnnyTMD

Does your server provides cURL PHP support? What's your WP & WooCommerce versions you are using in there? Have you tried testing with another theme? Do you have something in your error_log on your server regarding this website?

Also, please check your IPN response at your MobilPay account and seek there for errors.

barila26 commented 8 years ago

Hi. When i made test in sandbox, everything works fine. But when i go live (i made some orders for some friends with my credit card), after i paid it return with payment failed. I tried to look in my mobilpay admin and i see that payment was put by mobilpay ON HOLD (for checking credit card for frauds). This operations took 7 min. Only after 7 min the payment was approved. In that case the plugin can't understand this response (ON HOLD) and it returns with Payment Failed. I repeat : in sandbox everything works fine because the transaction is approved right away. The only thing that is missing on your plugin (that i really like) is returning error for pending payments (ON HOLD ).

On Wed, Aug 17, 2016 at 5:09 PM, Santiago Interactive < notifications@github.com> wrote:

Hi @barila26 https://github.com/barila26 and @JohnnyTMD https://github.com/JohnnyTMD Are you using the sandbox testing option? If yes, you should use only the credit card payment details provided by MobiPay with it's documentation/contract. I think this would be the issue in your case.

This plugin communicates with MobilPay platform via IPN responses even if you closed the session, when you come back and finish the payment some response is pushed in your shop's order.

If this is not the case, please provide more details, like:

  • The link where your are redirected after purchase.
  • Screenshot with order details from the wp-admin (the notes from the right side of the order should tell you some stuff about what went wrong).

Cheers!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SantiagoInteractive/mobilpay-card-gateway-for-woocommerce/issues/1#issuecomment-240442737, or mute the thread https://github.com/notifications/unsubscribe-auth/AUA9Z3JeJTqaXr9tW2x3VFcSLmZtnsRmks5qgyQ3gaJpZM4Ji5Jz .

JohnnyTMD commented 8 years ago

@SantiagoInteractive 1) Yes , the server suport cURL 2) Wp Version: 4.5.3 and now i update it to the latest version 6 and same problem WC Version: 2.6.4 3) Yes , i'v tried with Twenty Fifteen, Sixteen themes. 4) No 5)" Also, please check your IPN response at your MobilPay account and seek there for errors." - how can i check that?

I believe that problem could be with this function :
line 144: // Check for valid mobilPay server callback function check_mobilpaycard_response() { ....... } because when he return from the mobilpay website , after transaction was made, plugin checks if check_mobilpaycard_response() function changed order status to processed else he display this error message line: 123 // Thank you page function mobilpay_thankyou_page( $order_id ) { $order = new WC_Order($order_id); if ( isset($_GET['orderId']) && $_GET['orderId']==$order_id && $order->status != 'processing' && $order->status != 'completed' ) { echo ...... Payment failed. To complete your order please make the payment.Pay for order

SantiagoInteractive commented 8 years ago

@barila26 Well, I don't know how exactly I can test your issue in sandbox but I will try. @JohnnyTMD 5). I mean on the MobilPay admin panel. There should be an XML response message.

I will do some extra checks and tests soon, when I will have some spare time. If in the meantime you figure it out, please share. Thanks!

JohnnyTMD commented 8 years ago

@SantiagoInteractive 5) There are some error even the status of transaction is set to (platita) payed screenshot from 2016-08-18 16-17-51

jabossu commented 8 years ago

Hello, i have the same issue than described over there : I pay, my woocommerce says there is an error, and few minutes after the payment is accepted. I did not find where to get this error log you're talking about. How can i provide you with informations that may help ?

SantiagoInteractive commented 8 years ago

Hi all,

Follow this section in your WP admin panel: WooCommerce > Settings > Inventory /wp-admin/admin.php?page=wc-settings&tab=products&section=inventory

And check if your Hold Stock (minutes) setting value is not blank or too low. Give it a value equal or higher than 60 minutes.

woo-inventory-settings

jabossu commented 8 years ago

Hello, thank you for your answer. I checked it out, but that value was already set on 60minutes. Please tell me if there are some more test i can run to give you leads. =) Cheers.

SantiagoInteractive commented 8 years ago

Well, then look after order notes on orders where you have this problem. There is only one status from MobilPay that cancels the orders:

case 'canceled':
$errorMessage = $objPmReq->objPmNotify->errorMessage;
$order->update_status( 'cancelled' ); // This line is canceling the order if MobilPay response is canceled

Try add $order->add_order_note( $errorMessage ); on every response case and see what you get on your order notes. This can be done into mobcard-woo-payment-gateway.php file.

Good luck!

jabossu commented 8 years ago

Hi again, I'm afraid i wasn't clear about my issue, so i will try to reformulate : here is what happens.

  1. fill my cart with stuff
  2. go to payment page and choose mobilpay
  3. get the secure form, fill it.
  4. get a success response from mobilpay and be redirected to my website
  5. Get and error message on my website telling the payment failed.
  6. wait few minutes
  7. mobilpay confirms the payment, and woocomerce accepts it. The notification mails are send, like they should be.

In conclusion, all works fine BUT the costumer gets an error message where there is none. I fear it may induce some costumers to try to pay several times. I apologize if my first post was misleading... Cheers.

SantiagoInteractive commented 8 years ago

If you get a success response from MobilPay why is the few minutes waiting and extra confirmation from them? This seems to me like transaction rejected by antifraud filters.

Try add those notes on every response case and see what really MobilPay responses the first time.

Also try change this piece of code:

case 'confirmed_pending':
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
break;

case 'paid_pending':
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
break;

With:

case 'confirmed_pending':
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
    $order->update_status( 'pending' );
break;

case 'paid_pending':
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
    $order->update_status( 'pending' );
break;
JohnnyTMD commented 8 years ago

@SantiagoInteractive Hi, if i get this message after payment >Payment failed. To complete your order please send payment. how to modify code that i be able to see what response give me mobilpay?

SantiagoInteractive commented 8 years ago

Try change into mobcard-woo-payment-gateway.php file:

if ( $objPmReq->objPmNotify->errorCode == 0 ) {
    switch ($objPmReq->objPmNotify->action) {
        case 'confirmed':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            if ( $order->status != 'processing' ) {
                // Mark order as paid
                $order->payment_complete();
                // Payment has been successful
                $order->add_order_note( $errorMessage );
                // Empty shopping cart
                $woocommerce->cart->empty_cart();
            }
            break;
        case 'confirmed_pending':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            break;
        case 'paid_pending':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            break;
        case 'paid':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            break;
        case 'canceled':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->update_status( 'cancelled' );
            break;
        case 'credit':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->update_status( 'refunded' );
            break;
        default:
            $errorType    = Mobilpay_Payment_Request_Abstract::CONFIRM_ERROR_TYPE_PERMANENT;
            $errorCode    = Mobilpay_Payment_Request_Abstract::ERROR_CONFIRM_INVALID_ACTION;
            $errorMessage = 'mobilPay refference action paramaters is invalid.';
        break;
    }
} else {
    // Rejected transaction error message
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
    $order->add_order_note( $errorMessage );
}

With:

if ( $objPmReq->objPmNotify->errorCode == 0 ) {
    switch ($objPmReq->objPmNotify->action) {
        case 'confirmed':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            if ( $order->status != 'processing' ) {
                // Mark order as paid
                $order->payment_complete();
                // Payment has been successful
                $order->add_order_note( $errorMessage );
                // Empty shopping cart
                $woocommerce->cart->empty_cart();
            }
            break;
        case 'confirmed_pending':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->add_order_note( $errorMessage ); // added for pushing MobilPay response into order notes
            break;
        case 'paid_pending':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->add_order_note( $errorMessage ); // added for pushing MobilPay response into order notes
            break;
        case 'paid':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->add_order_note( $errorMessage ); // added for pushing MobilPay response into order notes
            break;
        case 'canceled':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->add_order_note( $errorMessage ); // added for pushing MobilPay response into order notes
            $order->update_status( 'cancelled' );
            break;
        case 'credit':
            $errorMessage = $objPmReq->objPmNotify->errorMessage;
            $order->add_order_note( $errorMessage ); // added for pushing MobilPay response into order notes
            $order->update_status( 'refunded' );
            break;
        default:
            $errorType    = Mobilpay_Payment_Request_Abstract::CONFIRM_ERROR_TYPE_PERMANENT;
            $errorCode    = Mobilpay_Payment_Request_Abstract::ERROR_CONFIRM_INVALID_ACTION;
            $errorMessage = 'mobilPay refference action paramaters is invalid.';
        break;
    }
} else {
    // Rejected transaction error message
    $errorMessage = $objPmReq->objPmNotify->errorMessage;
    $order->add_order_note( $errorMessage );
    $order->update_status( 'pending' ); // added to keep rejected transations from MobilPay on Pending Payment status
}
JohnnyTMD commented 8 years ago

@SantiagoInteractive "There are no notes yet." I'm not sure that it reach executing the function check_mobilpaycard_response()because i put an alert function here and nothing was shown. This action it never been executed: add_action( 'woocommerce_api_wc_mobilpay_card', array( $this, 'check_mobilpaycard_response' ) ); I've change this for testing purposes to woocommerce_thankyou_mobilpaycard action and i get this message: Invalid request method for payment confirmation. This error is from an if: if ( strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0 ) { if ( isset($_POST['env_key']) && isset($_POST['data']) ) { I don't understand what this means, mobilpay is sending data back to my site via post method? Whats inside this if is never been executed in my case.

SantiagoInteractive commented 8 years ago

That function is not for displaying stuff on the page. That communicates with MobilPay to send/receive responses via WooCommerce API.

Don't mix that up. The plugin is working just fine as it is. Your problem seems to be something else, server side or something else regarding your website setup, theme, other plugins...

Please post your WooCommerce System Status and also test again on an WordPress + WooCommerce fresh install with default WP theme.

JohnnyTMD commented 8 years ago

screenshot from 2016-08-23 15-44-56 screenshot from 2016-08-23 15-44-37 screenshot from 2016-08-23 15-44-17 screenshot from 2016-08-23 15-44-01 screenshot from 2016-08-23 15-43-33

SantiagoInteractive commented 8 years ago

I have just made one order, ID: 958. Can you please check it's order notes?

JohnnyTMD commented 8 years ago

@SantiagoInteractive "There are no notes yet." I've tried many times with order notes ,none works. This is why i say that code execution don't reach this functioncheck_mobilpaycard_response() .

SantiagoInteractive commented 8 years ago

Test on fresh install without any other plugins, on WP default theme.

JohnnyTMD commented 8 years ago

Hi, I've tested on fresh wordpress instalation + woocommerce+ mobilpay , but it give me same error message > Payment failed. To complete your order please make the payment. Maybe the problem is in certificate files?

JohnnyTMD commented 8 years ago

Hi I've tryed again on another hosting,domain but i get the same error. @SantiagoInteractive can you send me an archive with your wordpress instalation and your plugin which work on your testing environment? Thank you.

SantiagoInteractive commented 8 years ago

The plugin is this from here and I haven't tested it yet on WP 4.6. I will test it again when I will have some time.

SantiagoInteractive commented 8 years ago

Hi @JohnnyTMD

I have just tested again the plugin on WordPress 4.6 with WooCommerce 2.6.4 - latest versions on both of them and it works just fine. If you have tested this on the same server but different account hosted in there, this is not relevant. Your problem is on server settings, bad certificates or mobilpay admin bad settings. I can't think of something else what could cause this problem you have.

You could also email me at desk@santiagointeractive.com your phpinfo() configuration to compare your active services with mine. Maybe is something missing in your case.

If you have figured this out please share, maybe will help others too. Thank you!