baijianpeng VIP
Total posts: 239
13 Jun 2016 06:19

Thank God, after a lot lot of hard work, finally I got the license to use Alipay payment gateway on my website. Then, this is the first chance I got to really test with Alipay payment plugin of Emerald on my production website.

Well, then I made a test today and got following result ( I choose "direct pay by user" method when setting up the plan) :

The user can see Alipay button and he can smoothly finish the transaction after click on that button. When payment succeeded, Alipay gateway returned this user to his subscription history page on my website. Till now, it seems all good.

But, one thing is not good: on the subscription history page, it shows that the subscription was NOT activated yet.

I switch to Admin user account and checked the Emerald frontend dashboard, there shows this newly created subscription on the "wait for activation" list.

Apparently this is a bug. Because Alipay is an Online Payment gateway, when payment finished through this gateway, that means the vendor has got the money, and the buyer should be granted that subscription immediately and automatically.

Please improve this payment gateway plugin.

PS:

I also found several other things need to be improved on this plugin:

  1. There are two "demo mode" option;
  2. The payment method options are not in language file.
  3. Is it possible to bring the user to the download page where he had started the buying process? I think the user want to "let me download the file immediately after payment", instead of redirect him to the subscription history page. He can find the history page anytime when he hover his mouse on the "user menu", but he can not find the download page for that file easily if there are a lot of files and belong to different plans respectively.

Last Modified: 07 Dec 2016


Sergey
Total posts: 13,748
17 Jun 2016 16:11

baijianpeng The payment method options are not in language file.

Do you mean currencies?

baijianpeng Is it possible to bring the user to the download page where he had started the buying process? I think the user want to "let me download the file immediately after payment", instead of redirect him to the subscription history page. He can find the history page anytime when he hover his mouse on the "user menu", but he can not find the download page for that file easily if there are a lot of files and belong to different plans respectively.

Yes. For that you have to disable email confirmation in Joomla user manager, and allow RDS.

baijianpeng But, one thing is not good: on the subscription history page, it shows that the subscription was NOT activated yet.

Please update gateway to 9.36 and enable log in gateway, make purchase and then, tell me I'll look to /logs/alipay.txt and see. Most probably it does not path verification.


baijianpeng VIP
Total posts: 239
17 Jun 2016 18:24

Sergey Do you mean currencies?

No, I mean the options for payment method, such as "create_direct_trade_by_user", this is not easy to understand. I hope you put this string in the language file, so I can translate it into Chinese language. You know, Alipay is mainly used in China. So I hope it is language friendly to Chinese language speaker.

Sergey Yes. For that you have to disable email confirmation in Joomla user manager, and allow RDS.

When I making the test, the user account was already registered and activated in Joomla user manager. And I made the purchase in Emerald after I login in. I think it has nothing to do with email confirmation to bring the buyer to the initial page where he clicked the "download" button which subsequently triggered the subscription purchase process. Maybe you need to add a new feature to Emerald , to let it DETECT and REMEMBER on which page, the user had clicked the "download" buton and then go through the subscibing process.

BTW, what is "RDS"?

Sergey Please update gateway to 9.36 and enable log in gateway, make purchase and then, tell me I'll look to /logs/alipay.txt and see. Most probably it does not path verification.

I did a new test in this way as you mentioned. Updated Alipay plugin to 9.36 version, then make purchase. After successfully finishing of the payment, I was returned to Emerald "subscription history" page, and saw the newly created subscription NOT ACTIVATED. I did NOT find a file named alipay.txt in the folder /logs. Where should I look to find this file?

Thank you.


Sergey
Total posts: 13,748
21 Jun 2016 05:14

Please remind me access to your site.


baijianpeng VIP
Total posts: 239
21 Jun 2016 07:19

PS: I noticed that Hikashop component has already provided an Alipay payment plugin inside its installer package. I also had tested with that plugin, it can work perfectly with Alipay gateway, only on Hikashop component.

Maybe you can take a look into the code of that plugin to see what is different to your Alipay plugin?

You can download the free version of Hikashop Starter from: http://www.hikashop.com/ , it contains Alipay plugin inside.

Thank you.


Sergey
Total posts: 13,748
23 Jun 2016 03:31

Your site is extremely slow. It takes up to 5 minuts to open homepage. Yet most of the time I get 500 error.

I cannot also open administrator area and probably I have no access there.

What I need now is to see log file at /logs/alipay.txt. But this URL is unaccessible too. May be some sort of protection. Please find this file and send it to me here.


baijianpeng VIP
Total posts: 239
23 Jun 2016 14:02

Just like I had mentioned above, I can not find the file /logs/alipay.txt . I even tried the command "whereis alipay.txt" on my VPS SSH terminal, there is no such a file.

I also did not find any settings about this log file in Emerald configuration.

Maybe something is wrong so that my Emerald did not create that file?

Maybe it was created but saved to another different path?

Did you checked the Alipay payment plugin inside Hikashop component? That plugin works fine, it can successfully detect the "payment finished" response from Alipay.com server and change the status of order, that means, it can "automatically activate the user's permission" after payment finished.

During my test with Emerald and your Alipay plugin v9.36beta, it seems that your plugin can NOT detect such a "payment success" response and change the order status.

Thank you.


baijianpeng VIP
Total posts: 239
28 Jun 2016 06:46

Any progress on this issue?

I hope you will fix this plugin soon, because I bought Emerald because it can use Alipay gateway to perform on-line payment. My website heavyly count on this gateway to offer subscriptions.

Thank you.


Sergey
Total posts: 13,748
29 Jun 2016 04:11

baijianpeng I also did not find any settings about this log file in Emerald configuration.

this is in Alipay gateway parameters in the plan. Called Enable log in Developer section of parameters.

baijianpeng Maybe something is wrong so that my Emerald did not create that file? Maybe it was created but saved to another different path?

Check that folder logs have enough permission for file to be written. Also check that in global configuration this folder is indicated as log folder. Or simply look in configuration.php

baijianpeng During my test with Emerald and your Alipay plugin v9.36beta, it seems that your plugin can NOT detect such a "payment success" response and change the order status.

Without access to log I cannot move no futher. I was looking at Hikashop code, and that looks ok as well as mine. To understand the reason we need logging working.


baijianpeng VIP
Total posts: 239
29 Jun 2016 23:54

I checked the settings of Alipay gateway, the "Enable log" option was DISABLED by default. Since I did not change that setting, so it never created any log file.

Now I enabled it and performed a subscription purchasing process again. Yes, this time I got a log file named alipay.txt. I will submit this file to you via attachment in next private post.

Thank you.


baijianpeng VIP
Total posts: 239
05 Jul 2016 04:59

No one saw this topic updated? I had uploaded Alipay gateway log file here. Please fix this plugin ASAP.

Thank you.


Sergey
Total posts: 13,748
05 Jul 2016 07:59

That is what I thought. Verification fails.

Unfortunately I cannot finish tests. I need access to your site. I do have it but I cannot access Emerald as admin. I have to see gateway configuration.

Please provide me access. Use my skype to make it faster please. I believe you do have it.


baijianpeng VIP
Total posts: 239
06 Jul 2016 01:36

Well, Today I consulted the official online support staff at Alipay.com. He told me following :

报这个错误的大部分原因是因为服务器连接不上或者拒绝访问,检查服务器防火墙和服务器权限。端口是否开启或被占用,网络连接是否正常等。

Let me translate this to English:

Most likely the reason could be: 1. server can not connected 2. server reject to access 3. check your server firewall and permissions 4. server port open or not, or occupied 5. check if internet connection is proper

The support staff also give me a screeshot image about his testing:

alipay-gateway-testing

The words in the red box is meaning:

http status code: 0; return: null.

As he suggests, it seems that something is wrong with my server.

My server info: OS: CentOS 7 64bit web panel: Vesta CP ( http://www.vestacp.com ) PHP version: 5.6.23

I have no idea where should I check on my server to find the reason of this issue. I am planning to completely format the VPS harddrive and then re-install whole server. Do you think this will do some help?

If you know something about server configuration, please teach me how to de-bug this.

Thank you.


Sergey
Total posts: 13,748
06 Jul 2016 02:36

There is nothing wrong with your server. Tell support that your server receive notification. We have a log and we can see in the log that it receive notification. The problem is that we cannot validate sign.

$test = Array
(
    'option'              => 'com_emerald',
    'task'                => 'plans.create',
    'Itemid'              => '1',
    'processor'           => 'alipay',
    'em_id'               => '782',
    'discount'            => '0.00',
    'payment_type'        => '1',
    'subject'             => '购买会员资格: 支付宝接口测试 在 技术支持',
    'trade_no'            => '2016063021001004470203636669',
    'buyer_email'         => 'baijianying @ gmail.com',
    'gmt_create'          => '2016-06-30 07:55:58',
    'notify_type'         => 'trade_status_sync',
    'quantity'            => '1',
    'out_trade_no'        => '782',
    'seller_id'           => '2088221775408758',
    'notify_time'         => '2016-06-30 07:56:14',
    'body'                => '购买会员资格: 支付宝接口测试 在 技术支持',
    'trade_status'        => 'TRADE_SUCCESS',
    'is_total_fee_adjust' => 'N',
    'total_fee'           => '1.00',
    'gmt_payment'         => '2016-06-30 07:56:14',
    'seller_email'        => 'joomlagate @ gmail.com',
    'price'               => '1.00',
    'buyer_id'            => '2088802935981474',
    'notify_id'           => '1b10453331558fe748c56b1ad6b2f9djmm',
    'use_coupon'          => 'N',
    'sign_type'           => 'MD5',
    'sign'                => '91c252ac7a0928fc86d72df7dbf7ba84'
);

Remove whitesapeses around @ when testing. I added them because Joomla try to convert email addresss.

Give him this and say that this is what we receive. Ask him to test to generate sign that would match to 91c252ac7a0928fc86d72df7dbf7ba84

This is the problem. I cannot generate signature.

$tmp_array = array();
foreach($test as $key => $value) {
    if($value != '' && $key != 'sign' && $key != 'sign_type') {
        $tmp_array[$key] = $value;
    }
}
ksort($tmp_array);
reset($tmp_array);

foreach($tmp_array as $key => $value) {
    if($params_str == '') {
        $params_str = "$key=$value";
    } else {
        $params_str .= "&$key=$value";
    }
}
$result = md5($params_str . $this->_security_code);

But $result never match $test['sign'].


baijianpeng VIP
Total posts: 239
06 Jul 2016 03:23

Well, 10 minutes ago I consulted the Alipay online support again, another staff of course. I told him your opinion and also asked he read this topic, especially your last reply post. He read it.

I even asked him to test the purchsing process on my website, because I had already created a username for him. He did it, and he see the problem. Then I returned his payment to his Alipay account.

After all these tests, he told me that (he can read your post but he can not write in English):

看到您参数这边,有部分自定义参数,我这里判断您是因为传了自定义参数,最后做签名验证部分的时候,导致方法调用不成功。即时到账接口有一个公共回传参数,extra_common_param,您如果有自定义参数全部放在这个里面。或者是接收到参数以后,先去掉这部分自定义参数,然后调用验签方法验证,最后才根据内容来处理。

Let me translate for you:

There are some "custom parameters" (in your code) , I think it is because your (Emerald) software transmitted some custom parameters, then caused "mothod calling" failed when validating signature. Alipay gateway has already offered a public returning parameter named "extra_common_param" for the "direct payment" mode, if you want to transmitte some custom parameter, you can put them inside this public parameter. Or, you can try to remove those custom parameters after received parameter, and then do the signature validation, and then finally process custom parameters based on content.

Sorry maybe my translation can not exactly describe the precise coding terms. Maybe you can understand it? It seems that "custom parameter" is the point.

Hope you will work out a solution to it.

Thank you.


Sergey
Total posts: 13,748
12 Jul 2016 05:36

This is what I was thinking too. And I did removed them from array before test. But none one the combinations of the parameters works. I left only parameters that are suppose to иму sent by Alipay but it still does not work. I'll run some more tests and report here later.


Sergey
Total posts: 13,748
12 Jul 2016 06:21

I have 2 questions.

  1. If returned parameter for example 'discount' => '0.00' should it be part of the signature? it is there but it is 0?
  2. If parameter is 1.00 in the string that is encoded it should be &total_fee=1.00 or &total_fee=1?

baijianpeng VIP
Total posts: 239
12 Jul 2016 07:26

Sorry I do not know PHP programming, nor the Alipay API.

I searched, found following infomation, they may provide some help:

  1. Alipay official documentation: How to use Custom Parameters

https://help.alipay.com/support/help_detail.htm?help_id=397393

  1. 3rd party tutorial: How to use custom parameter in return URL of Alipay:

http://www.solagirl.net/use-custom-para-in-alipay-return-url.html

  1. Someone had mentioned "maybe it is because curl_exec was disabled on server" in this article:

http://www.programgo.com/article/1317682026/ ;jsessionid=A79B3F27E31B1F46F2293C9C0031366B

Those are articles in Chinese language, hope Google Translate will help you to read them smoothly.

Hope you will sovle this issue soon.

Thank you.


baijianpeng VIP
Total posts: 239
20 Jul 2016 03:39

Again one week passed after my last post on this topic. Is there any progress?


Sergey
Total posts: 13,748
24 Jul 2016 06:01

I am sorry I was in the mountains where there were not intenet connection and we coudl not get out for 3 days. We had stack there.

I looked all your links. And I understand code perfectly. This is exactly like I have it.

The problem is with some parameters. To solve it I need you to ask Alipay support those 2 questions I asked you erlier. Please ask them and give me their response.


baijianpeng VIP
Total posts: 239
11 Sep 2016 00:21

Recently I completely re-installed my whole server to make sure I did not make mistakes on server environments.

Then I tested with Emerald and its Alipay payment gateway plugin, the same thing happened: though I finished payment but the subscription in Emerald was not activated automatically.

I am afraid I can not depend on Alipay support team to solve this problem, because they know NOTHING about Joomla, they know NOTHING about Emerald. And, helping to debug a 3rd party payment plugin is beyond their service.

I think maybe you can contact with the developer of Hikashop component? Because: 1. they know Joomla very well; 2. Hikashop works fine with the Alipay payment plugin developed by the same team.

If you discuss with the author of Hikashop, maybe this issue will be solved soon.

Thank you.

Powered by Cobalt