[TH] Credits [Deleted]

My users get this error when they purchase credits. The credit purchase still goes through and they are assigned their credits though.

error_purchase-forum-credits.webp

Also it doesn't seem like my income graph is working correctly? I've had two donations for credits, but nothing shows in the graph or to the right "income". They do show in "Recent Credit Purchases" though.

Screen Shot 2015-05-20 at 6.29.58 PM.webp
 
My users get this error when they purchase credits. The credit purchase still goes through and they are assigned their credits though.

View attachment 106567

Also it doesn't seem like my income graph is working correctly? I've had two donations for credits, but nothing shows in the graph or to the right "income". They do show in "Recent Credit Purchases" though.

View attachment 106568

Do you get any errors in your error log, and are the users getting the credits they purchased?
 
This Add-on has been moved to the Audentio Design shop, and it can be purchased automatically with no wait :)

Our other Add-ons will be moving over the next couple days as well.
 
I am getting this server error. How can errors like that be avoided?

Code:
Zend_Exception: No entry is registered for key 'adcredit_last_media_category_id' - library/XenForo/Application.php:1007


#0 /var/www/clients/client0/web3/web/library/Audentio/Credit/Core/ControllerPublic/Media.php(15): XenForo_Application::get('adcredit_last_m...')
#1 /var/www/clients/client0/web3/web/library/XenForo/FrontController.php(347): Audentio_Credit_Core_ControllerPublic_Media->actionSaveMedia()
#2 /var/www/clients/client0/web3/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#3 /var/www/clients/client0/web3/web/index.php(13): XenForo_FrontController->run()
#4 {main}


array(3) {
  ["url"] => string(37) "http://www.domain.com/media/save-media"
  ["_GET"] => array(1) {
    ["/media/save-media"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["type"] => string(5) "album"
    ["album_id"] => string(20) "3538.Privates Zeug^^"
    ["image_url"] => string(0) ""
    ["media_title_all"] => string(0) ""
    ["media_description_all"] => string(0) ""
    ["image_upload_hash"] => string(32) "a9ee9a8bf34c95b60914714f96115668"
    ["container_type"] => string(5) "album"
    ["container_id"] => string(4) "3538"
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(24) "/media/add?album_id=3538"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
I am getting this server error. How can errors like that be avoided?

Code:
Zend_Exception: No entry is registered for key 'adcredit_last_media_category_id' - library/XenForo/Application.php:1007


#0 /var/www/clients/client0/web3/web/library/Audentio/Credit/Core/ControllerPublic/Media.php(15): XenForo_Application::get('adcredit_last_m...')
#1 /var/www/clients/client0/web3/web/library/XenForo/FrontController.php(347): Audentio_Credit_Core_ControllerPublic_Media->actionSaveMedia()
#2 /var/www/clients/client0/web3/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#3 /var/www/clients/client0/web3/web/index.php(13): XenForo_FrontController->run()
#4 {main}


array(3) {
  ["url"] => string(37) "http://www.domain.com/media/save-media"
  ["_GET"] => array(1) {
    ["/media/save-media"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["type"] => string(5) "album"
    ["album_id"] => string(20) "3538.Privates Zeug^^"
    ["image_url"] => string(0) ""
    ["media_title_all"] => string(0) ""
    ["media_description_all"] => string(0) ""
    ["image_upload_hash"] => string(32) "a9ee9a8bf34c95b60914714f96115668"
    ["container_type"] => string(5) "album"
    ["container_id"] => string(4) "3538"
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(24) "/media/add?album_id=3538"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Hi there,

This has been fixed for the next release. Sorry for the delay, thought I replied already :)

Jake
 
Hi there,

Whilst I know that XF 1.5 is in Beta, I have my trophy system disabled and was adding trophies and it triggered them when this add-on issued our currency for triggering an award. Just pointing it out as it might be an issue for when 1.5 is officially released and the trophy system is disabled.

XF 1.5 - Disabling Trophies
 
Hi there,

Whilst I know that XF 1.5 is in Beta, I have my trophy system disabled and was adding trophies and it triggered them when this add-on issued our currency for triggering an award. Just pointing it out as it might be an issue for when 1.5 is officially released and the trophy system is disabled.

XF 1.5 - Disabling Trophies

If that's the case xenforo is still awarding the trophy as this uses the same method xenforo uses for awarding trophies.
 
I was just reporting it here based on Jeremy's reply. I have no log so cannot see what caused it but this was the only alerts showing, cheers.
 
I was just reporting it here based on Jeremy's reply. I have no log so cannot see what caused it but this was the only alerts showing, cheers.

I'll look into it to make sure it isn't something on our end, but I doubt that it would be
 
Upon trying to use the Purchase system all my packages received the following error upon trying to follow the navigation to the Paypal portal:
f22737e4d7.png


Turns out the issue was due to float precision on the "amount" post parameter:
710e1f29f0.png


Found the problematic line in the adcredit_packages template:
a3554d421a.png


Fixed it by replacing it with:
Code:
<input type="hidden" name="amount" value="{xen:helper currency, $package.price, 0}" />
Hopefully this fix can be implemented (or improved on) for the official build. Would save me the hassle of having to modify it each upgrade. :p

Here's another revision I had to make for my use case.

class Audentio_Credit_Core_DataWriter_Transaction

Old:
Code:
protected function _preSave()
{
if ($this->get('credits') < 1)
{
$this->error(new XenForo_Phrase('adcredit_invalid_amount'), 'amount');
}
$currencyModel = $this->getModelFromCache('Audentio_Credit_Core_Model_Currency');
$currency = $currencyModel->getCurrencyById($this->get('currency_id'));
$sender = $this->getOption('sender');
if ($sender)
{
if ($this->get('credits') > $sender[$currency['currency_id']] && !$currency['allow_negative'])
{
$this->error(new XenForo_Phrase('adcredit_not_enough_X_you_need_Y',array('creditName' => $currency['name'], 'amount'=>Audentio_Credit_Core_Template_Helper_Credit::formatCredit($this->get('credits'), $this->get('currency_id')))), 'amount');
}
}
}
New:
Code:
protected function _preSave()
{
$currencyModel = $this->getModelFromCache('Audentio_Credit_Core_Model_Currency');
$currency = $currencyModel->getCurrencyById($this->get('currency_id'));

$min = 1 / pow(10, $currency['decimal_points']) - 1 / pow(10, $currency['decimal_points'] + 1);
if ($this->get('credits') <= $min)
{
$this->error(new XenForo_Phrase('adcredit_invalid_amount'), 'amount');
}

$sender = $this->getOption('sender');
if ($sender && $this->isInsert() && $this->get('credits') > $sender[$currency['currency_id']] && !$currency['allow_negative'])
{
$this->error(new XenForo_Phrase('adcredit_not_enough_X_you_need_Y',array('creditName' => $currency['name'], 'amount'=>Audentio_Credit_Core_Template_Helper_Credit::formatCredit($this->get('credits'), $this->get('currency_id')))), 'amount');
}
}
The first notable change are that it now supports transfers of the smallest precision allowed by the currency (as configured). Apologies for the second hacky part of calculating the min, but it was necessary because I believe there is some precision loss going through the AJAX layer and I'm sure you can come up with a more elegant fix. The second is the addition of "$this->isInsert()" condition to the insufficient funds error, because for my use, and presumably anyone building on top of this, there may be a need to edit transactions after it is created and that error state makes no sense then.

Edit x2:

Couple more notes.

1) I would like to have a space between the end of my currency and the suffix. I managed to do this by manually modifying the currency table, but trying to do some through admincp trims the leading space.
2) I want only one currency withdrawable and the other not. I tried to turn off "Can Withdraw" through the Currency page in admincp:
b9fe8daf988a21c5da46004029559251.png

However, the currency still shows up in the Withdraw template and refreshing the admincp page shows that the option has been checked again.
0940e8aad25dea5e8ba3e368b3eb5580.png

I'm assuming this is undesired behavior. I also didn't notice a can_withdraw flag in the MySQL table, so I'm not sure how the setting is retained.

Edit x3:

Fixed* #2 above by replacing the following line in template adcredit_withdraw
Code:
<xen:if is="{$currency.withdraw_conversion_rate}">
with
Code:
<xen:if is="{$currency.withdraw_conversion_rate} > 0">
* While this fixes the front-end I fear that the back-end will still allow a withdrawal to be made on a currency that has withdrawal disabled (or conversion_rate == 0).

Additionally found three new bugs.

1) In AdminCP under the Credits tab my "Income This Week" is completely blank even though there have been multiple credit package purchases (as seen in #2).

f65e497cec.png

2) In AdminCP under the Credits tab my "Recent Credits Purchase" only show the first five transactions made, as opposed to the five most recent transactions. I'm assuming the order just needs to be flipped.

2a01ed7d10.png

These blockers were reported over four months ago, and to my disappointment after attempting to upgrade to the latest version today they are still not fixed. I've grown to appreciate and expect high quality from Audentio from my previous purchases and this one is grossly disappointing me. I just spent the last two hours re-implementing the fixes I could, and need some reassurance from the developer(s) that these will be resolved in the next version so I don't have to waste even more time re-evaluating the decision to use this.
 
All of these issues were fixed in the last release. Are you sure you downloaded the latest version?

Jake
 
Top Bottom