Skip to content

Commit

Permalink
Fix for payment buttons in HTML emails
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Nov 29, 2016
1 parent bbbf123 commit 0731165
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/Services/TemplateService.php
Expand Up @@ -4,6 +4,7 @@
use HTML;
use Utils;
use App\Models\Gateway;
use App\Models\GatewayType;

class TemplateService
{
Expand Down Expand Up @@ -69,7 +70,10 @@ public function processVariables($template, array $data)

// Add variables for available payment types
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}Button"] = Form::emailPaymentButton($invitation->getLink('payment') . "/{$type}");
}
Expand Down
10 changes: 6 additions & 4 deletions resources/views/accounts/templates_and_reminders.blade.php
Expand Up @@ -299,11 +299,13 @@ function processVariables(str) {
// Add any available payment method links
@foreach (\App\Models\Gateway::$gatewayTypes as $type)
{!! "keys.push('" . Utils::toCamelCase($type).'Link' . "');" !!}
{!! "vals.push('" . URL::to('/payment/...') . "');" !!}
@if ($type != GATEWAY_TYPE_TOKEN)
{!! "keys.push('" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)).'Link' . "');" !!}
{!! "vals.push('" . URL::to('/payment/...') . "');" !!}
{!! "keys.push('" . Utils::toCamelCase($type).'Button' . "');" !!}
{!! "vals.push('" . Form::flatButton('pay_now', '#36c157') . "');" !!}
{!! "keys.push('" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)).'Button' . "');" !!}
{!! "vals.push('" . Form::flatButton('pay_now', '#36c157') . "');" !!}
@endif
@endforeach
var includesPasswordPlaceholder = str.indexOf('$password') != -1;
Expand Down

0 comments on commit 0731165

Please sign in to comment.