Mail Service Dynamic Expressions with tokens

I am trying to do some dynamic expressions in my email templates. I am using the mail service to send a user an order confirmation. This is working out great except one small issue. If the user pays with credit card I want to show cc info else show another form of payment info. Right now i have this in my email template

Payment Information


Payment Method: @paymentmethod@ Amount: @amount@
Cardholder's Name: @cc_name@
Card Type: @cc_type@
Account: @cc_account@
Exp Date: @cc_expdate@
CVV: @cc_cvv@

But how can I do some evaluation of a variable here? Its not like I can do this.

<cfif @paymentMethod@ EQ “creditcard”>

thoughts on how I can accomplish this?

Started a new thread? I just replied to the other thread...

No don't think that's possible. Mail/body tokens are parsed (replaced)
when sending a mail.
So do the "logic" outside the mail template and store value in new body token.
You can also create an additional template which depends on in your
example "paymentMethod".

Yes. I figured this may come up for others so I decided to start a new thread. That is what I ended up doing, was just wondering if there was another way to do it.

var creditcard = order.getCreditCard();

if( !isNull(creditcard) ) {
template = ‘new_order_creditcard’;
}

Ok Dan, let's see if someone else has a better solution...

What about passing any required data as an argument. I believe that was enabled for views and layouts in 3.0?

Nolan Dubeau

Load *.*,8,1

that data is sent to the interceptor method as an argument but I don’t believe you have access to it in the view

What do you mean?

Nevermind… you answered this in another thread… for those curious you can do the following…

Also, remember this cool feature.

If you do renderView() for the body, you can pass into the view additional arguments just for that rendering.

renderView(view=“templates/email”, args={myArg=val, myArg2=val2} )

Then in your views you can use it:

These are view arguments.