Fix for payment buttons in HTML emails

This commit is contained in:
Hillel Coren 2016-11-29 20:21:17 +02:00
parent bbbf1237c5
commit 0731165d8f
2 changed files with 11 additions and 5 deletions

View File

@ -4,6 +4,7 @@ use Form;
use HTML; use HTML;
use Utils; use Utils;
use App\Models\Gateway; use App\Models\Gateway;
use App\Models\GatewayType;
class TemplateService class TemplateService
{ {
@ -69,7 +70,10 @@ class TemplateService
// Add variables for available payment types // Add variables for available payment types
foreach (Gateway::$gatewayTypes as $type) { foreach (Gateway::$gatewayTypes as $type) {
$camelType = Utils::toCamelCase($type); if ($type == GATEWAY_TYPE_TOKEN) {
continue;
}
$camelType = Utils::toCamelCase(GatewayType::getAliasFromId($type));
$variables["\${$camelType}Link"] = $invitation->getLink('payment') . "/{$type}"; $variables["\${$camelType}Link"] = $invitation->getLink('payment') . "/{$type}";
$variables["\${$camelType}Button"] = Form::emailPaymentButton($invitation->getLink('payment') . "/{$type}"); $variables["\${$camelType}Button"] = Form::emailPaymentButton($invitation->getLink('payment') . "/{$type}");
} }

View File

@ -299,11 +299,13 @@
// Add any available payment method links // Add any available payment method links
@foreach (\App\Models\Gateway::$gatewayTypes as $type) @foreach (\App\Models\Gateway::$gatewayTypes as $type)
{!! "keys.push('" . Utils::toCamelCase($type).'Link' . "');" !!} @if ($type != GATEWAY_TYPE_TOKEN)
{!! "vals.push('" . URL::to('/payment/...') . "');" !!} {!! "keys.push('" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)).'Link' . "');" !!}
{!! "vals.push('" . URL::to('/payment/...') . "');" !!}
{!! "keys.push('" . Utils::toCamelCase($type).'Button' . "');" !!} {!! "keys.push('" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)).'Button' . "');" !!}
{!! "vals.push('" . Form::flatButton('pay_now', '#36c157') . "');" !!} {!! "vals.push('" . Form::flatButton('pay_now', '#36c157') . "');" !!}
@endif
@endforeach @endforeach
var includesPasswordPlaceholder = str.indexOf('$password') != -1; var includesPasswordPlaceholder = str.indexOf('$password') != -1;