Closed ChR1sMC closed 1 year ago
The actual communication with the maib payments gateway is performed by the official library used by this plugin - here's how the response is parsed: https://github.com/maibank/maibapi/blob/main/src/MaibApi/MaibClient.php#L79
Can you please provide the full logs (plugin and guzzle) to be able to properly diagnose the issue?
I've been doing some changes in how we log to debug the problem, but I can confim that logs that I've sent you are generating if to initiate a transaction and complete the payment, first is guzzle and second one is plugin
Here is the guzzle log from yesterday when I've tried multiple transactions: _[2023-05-25T06:38:35.180897+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 113 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=v&amount=60000¤cy=498&client_ip_addr=89.28.57.80&description=Order+%232361&language=en&msg_type=SMS <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 06:38:19 GMT Transfer-Encoding: chunked TRANSACTION_ID: wL3CVT3jPuo7FecKqkgfVJiX9r4= -------- NULL [] [] [2023-05-25T06:39:29.553339+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 76 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=c&trans_id=wL3CVT3jPuo7FecKqkgfVJiX9r4%3D&client_ip_addr=89.28.57.80 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 06:39:13 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 000 RRN: 314506338183 APPROVAL_CODE: 162263 CARD_NUMBER: 510218**1124 -------- NULL [] [] [2023-05-25T06:39:44.931032+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 113 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=v&amount=60000¤cy=498&client_ip_addr=89.28.57.80&description=Order+%232361&language=en&msg_type=SMS <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 06:39:28 GMT Transfer-Encoding: chunked TRANSACTION_ID: 7ms1j4zyutEXMOqfL3qMmPtjmCU= -------- NULL [] [] [2023-05-25T06:40:43.600053+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 76 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=c&trans_id=7ms1j4zyutEXMOqfL3qMmPtjmCU%3D&client_ip_addr=89.28.57.80 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 06:40:27 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 000 RRN: 314506338188 APPROVAL_CODE: 344236 CARD_NUMBER: 510218**1124 -------- NULL [] [] [2023-05-25T07:23:17.558073+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 113 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=v&amount=83000¤cy=498&client_ip_addr=89.28.57.80&description=Order+%232362&language=en&msg_type=SMS <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 07:23:01 GMT Transfer-Encoding: chunked TRANSACTION_ID: ZP5Iuy6Co2rg3FStuEQcydVDzm4= -------- NULL [] [] [2023-05-25T07:23:45.016768+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 76 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=c&trans_id=ZP5Iuy6Co2rg3FStuEQcydVDzm4%3D&client_ip_addr=89.28.57.80 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 07:23:28 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 000 RRN: 314507338286 APPROVAL_CODE: 421433 CARD_NUMBER: 510218**1124 -------- NULL [] [] [2023-05-25T13:16:22.050551+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 62 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=r&trans_id=ZP5Iuy6Co2rg3FStuEQcydVDzm4%3D&amount=83000 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 13:16:05 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 400 -------- NULL [] [] [2023-05-25T14:36:33.559514+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 113 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=v&amount=83000¤cy=498&client_ip_addr=89.28.57.80&description=Order+%232365&language=en&msg_type=SMS <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 14:36:17 GMT Transfer-Encoding: chunked TRANSACTION_ID: fvDER8NImm4xtxdB6DRXjr3epwQ= -------- NULL [] [] [2023-05-25T14:37:01.090460+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 76 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=c&trans_id=fvDER8NImm4xtxdB6DRXjr3epwQ%3D&client_ip_addr=89.28.57.80 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 14:36:44 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 000 RRN: 314514339578 APPROVAL_CODE: 456746 CARDNUMBER: 510218**1124 -------- NULL [] []
And here is the plugin log from yesterday: _2023-05-25T06:38:35+00:00 INFO TEST: Payment initiated via maib Moldova Agroindbank: TRANSACTION_ID=wL3CVT3jPuo7FecKqkgfVJiX9r4%3D 2023-05-25T06:39:29+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T06:39:29+00:00 ERROR TEST: Payment failed via maib Moldova Agroindbank: RESULT=OK%0ARESULT_CODE 2023-05-25T06:39:44+00:00 DEBUG Array ( [TRANSACTION_ID] => 7ms1j4zyutEXMOqfL3qMmPtjmCU= )
2023-05-25T06:39:44+00:00 INFO TEST: Payment initiated via maib Moldova Agroindbank: TRANSACTION_ID=7ms1j4zyutEXMOqfL3qMmPtjmCU%3D 2023-05-25T06:40:43+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T06:40:43+00:00 ERROR TEST: Payment failed via maib Moldova Agroindbank: RESULT=OK%0ARESULT_CODE 2023-05-25T07:23:17+00:00 DEBUG Array ( [TRANSACTION_ID] => ZP5Iuy6Co2rg3FStuEQcydVDzm4= )
2023-05-25T07:23:17+00:00 INFO TEST: Payment initiated via maib Moldova Agroindbank: TRANSACTION_ID=ZP5Iuy6Co2rg3FStuEQcydVDzm4%3D 2023-05-25T07:23:45+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T07:23:45+00:00 ERROR TEST: Payment failed via maib Moldova Agroindbank: RESULT=OK%0ARESULT_CODE 2023-05-25T13:16:22+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T13:16:22+00:00 ERROR TEST: Refund of 830.00 MDL via maib Moldova Agroindbank failed: RESULT=OK%0ARESULT_CODE 2023-05-25T14:36:33+00:00 DEBUG Array ( [TRANSACTION_ID] => fvDER8NImm4xtxdB6DRXjr3epwQ= )
2023-05-25T14:36:33+00:00 INFO TEST: Payment initiated via maib Moldova Agroindbank: TRANSACTION_ID=fvDER8NImm4xtxdB6DRXjr3epwQ%3D 2023-05-25T14:37:01+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T14:37:01+00:00 ERROR TEST: Payment failed via maib Moldova Agroindbank: RESULT=OK%0ARESULTCODE
Opened issue here https://github.com/maibank/maibapi/issues/3
I attempted to connect with maib using this plugin recently. Our WP version is 6.2.2, and we are running PHP version 8.2.1. However, I encountered an issue where the transaction is successful, but the value of the result code is "OK%0ARESULT_CODE" instead of just "OK." As a result, the responses are being treated as failures.
Here are the logs:
_[2023-05-25T06:40:43.600053+00:00] maib_guzzle_request.INFO: >>>>>>>> POST /ecomm/MerchantHandler HTTP/1.1 Content-Length: 76 User-Agent: GuzzleHttp/6.5.5 curl/7.85.0 PHP/8.2.1 Host: maib.ecommerce.md:21440 Content-Type: application/x-www-form-urlencoded; charset=utf-8 command=c&trans_id=7ms1j4zyutEXMOqfL3qMmPtjmCU%3D&client_ip_addr=89.28.57.80 <<<<<<<< HTTP/1.1 200 OK Content-Type: text/html;charset=utf-8 Date: Thu, 25 May 2023 06:40:27 GMT Transfer-Encoding: chunked RESULT: OK RESULT_CODE: 000 RRN: 314506338188 APPROVAL_CODE: 344236 CARDNUMBER: 510218**1124 -------- NULL [] []
_2023-05-25T06:39:44+00:00 DEBUG Array ( [TRANSACTION_ID] => 7ms1j4zyutEXMOqfL3qMmPtjmCU= )
2023-05-25T06:39:44+00:00 INFO TEST: Payment initiated via maib Moldova Agroindbank: TRANSACTION_ID=7ms1j4zyutEXMOqfL3qMmPtjmCU%3D 2023-05-25T06:40:43+00:00 DEBUG Array ( [RESULT] => OK RESULT_CODE )
2023-05-25T06:40:43+00:00 ERROR TEST: Payment failed via maib Moldova Agroindbank: RESULT=OK%0ARESULTCODE
What have we tried, we changed line 843 from wc-moldovaagroindbank.php: This
if($result === self::MAIB_RESULT_OK)
Was changed in this
if(str_starts_with($result, self::MAIB_RESULT_OK))
And now the response is treating like a success. This is a workaround we did, but the main question is why the result value are parsed wrong, is it something related to our WP and PHP versions ?