Set "I will pay for payment gateway fee" to "Yes"

  • Gurdip
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 11 months ago - 11 years 11 months ago #15408 by Gurdip
Hi,

At the moment, if the donor has the option to bear the payment gateway fees/charges, he sees the "I will pay for payment gateway fee?" option (which is set to "No" by default).

I would like to set this to "Yes" by default, but am unable to figure out where the code for that is. So if the donor does not wish to pay the charges, he sets it to No. Otherwise he pays the charges.


Viewing the source, I need to know where the input lines are coming from (can't locate them):

<input type="radio" name="pay_payment_gateway_fee" id="pay_payment_gateway_fee0" value="0" class="inputbox" />
<label for="pay_payment_gateway_fee0" id="pay_payment_gateway_fee0-lbl" class="radiobtn">No</label>

<input type="radio" name="pay_payment_gateway_fee" id="pay_payment_gateway_fee1" value="1" checked="checked" class="inputbox" />
<label for="pay_payment_gateway_fee1" id="pay_payment_gateway_fee1-lbl" class="radiobtn">Yes</label>



Can you point me to the correct file / line so that i can make the hack?

Thanks
Last edit: 11 years 11 months ago by Gurdip.

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #15439 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Set "I will pay for payment gateway fee" to "Yes"
Hi

You can open the file components/com_jdonation/views/donation/view.html.php, find the code below :
Code:
$lists['pay_payment_gateway_fee'] = JHTML::_('select.booleanlist', 'pay_payment_gateway_fee', ' class="inputbox" ', JRequest::getInt('pay_payment_gateway_fee', 0)) ;

Change it to :
Code:
$lists['pay_payment_gateway_fee'] = JHTML::_('select.booleanlist', 'pay_payment_gateway_fee', ' class="inputbox" ', JRequest::getInt('pay_payment_gateway_fee', 1)) ;

After that, it will work as expected .

Tuan

Please Log in or Create an account to join the conversation.

  • Gurdip
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 11 months ago - 11 years 11 months ago #15446 by Gurdip
Thank you, Tuan. That works well.


But it raises another related question. Please consider the following:
Because Paypal charges a percentage AND a fixed amount, the payment shown in the Paypal account is different.

For example, for my country, the Paypal fee is 3.4% and fixed charge is $0.50. If a donor pays $10, with the charges it becomes $10.84. But in the Paypal account, Paypal uses $10.84 -3.4% - $0.50 = $9.97. Not $10 received.

For Joomdonation to work perfectly, the Paypal account should show exactly $10. I would appreciate it very much if you can fix this as all charities must report actual figures for tax purposes by law. Firstly, admin should be able to set the fixed amount. Secondly, the system should calculate the correct amount such that after Paypal deductions, the amount received equals the amount the donor entered. In my above example this is $10.

Reverse Paypal formula is here: blogs.planetcloud.co.uk/mygreatdiscovery...culator-formula.aspx . Just need to code it into Joomdonation!

Hope to hear from you.

Thanks
Gurdip
Last edit: 11 years 11 months ago by Gurdip.

Please Log in or Create an account to join the conversation.

  • Gurdip
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 11 months ago - 11 years 11 months ago #15447 by Gurdip
Solved my issue of reversing all charges to the donor:

In components/com_jdonation/models/jdonation.php (around lines 80 and 214), I have done this:

Looked for : $data = round($row->amount*(1 + $config->convenience_fee/100),2);

and replaced with:
$data = round(($row->amount + 0.50) / (1 - $config->convenience_fee/100),2);


ALSO,
In components/com_jdonation/views/confirmation/tmpl/default.php:

Changed line 234 to read as:
echo $this->config->currency_symbol.number_format(($this->showedAmount + 0.5) / (1 - $this->config->convenience_fee/100), 2).JText::sprintf('JD_COMMISION_FEE', $this->config->convenience_fee);


Did a live donation and it all looks fine.
Last edit: 11 years 11 months ago by Gurdip.

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #15464 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Set "I will pay for payment gateway fee" to "Yes"
Great . Thanks for sharing the solution . I will check it and might add support for it in future release .

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Gurdip
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 11 months ago #15468 by Gurdip
You are welcome. It's a good system you've developed.

Tested the system several times and it works perfectly as intended. If you find any problems with it, do let me know. If it works fine, all it probably needs is

a) for the fixed transaction cost setting to be included in the backend,
b) show also the total amount in the backend (ie inclusive of the charges).

This will probably make it complete. Do let me know when you release the updated version. Thanks.

Regards
Gurdip

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamDũng Nguyễn Việt