Blog posts tagged with 'PD-GettingStarted'

RSS
Payment Director - Various Expressions- Friday, July 18, 2014

Here's a bunch of expressions you can try.  Be sure that you activate any Payment Method that you want to use.  

  1. Boolean $Debug true  - this will log trace messages in the System > Log.  Be sure to remove it (or make inactive) in production.
  2. Check Or Money Order - shows custom localized text
  3. Cash On Delivery - only visible if postal code starts with 888
  4. Manual Credit Card - only visible when an admin is impersonating.  Note the " use POS " hint added to the freindly name
  5. Manual and Authorize.ney - calculate the fee based on selected card
  6. Purchase Order - only visible for specific role
  7. Pay In Store - visible always, but can only be selected if shipping method selected in In-Store Pickup
  8. PayPay - only visible for store # 1 when selected shipping is FedEx

In order to utilize the features to have disabled payment methods, and to change the name of payment methods that the customer sees, replace your checkout views (.cshtml files) with the ones provided in the \Views\Checkout sub folder from the evaluation zip file you downloaded.

Type

Name

Expression

FeeExpression

FriendlyNameExpression

Boolean

$Debug

true

 

 

String

CheckOrMoneyLocalized

GetLocaleString("your.custom.text")

 

 

Option

Payments.CheckMoneyOrder

true

 

[CheckOrMoneyLocalized] + " (test)"

Option

Payments.CashOnDelivery

Customer.ShippingAddress.ZipPostalCode.StartsWith("888")

 

 

Option

Payments.Manual

OriginalCustomerIfImpersonated != null

CreditCardType = null ? 0.00 : CreditCardType = "Visa" ? OrderTotalWithoutPaymentFee * 0.02 : 1.00

FriendlyName + " (use POS)"

Option

Payments.AuthorizeNet

OriginalCustomerIfImpersonated = null

CreditCardType = null ? 0.00 : CreditCardType = "Visa" ? OrderTotalWithoutPaymentFee * 0.02 : 1.00

FriendlyName + " (fee varies)"

Option

Payments.PurchaseOrder

Customer.IsInCustomerRole("Dealer Pricing")

 

 

Option

Payments.PayInStore

ShippingOptionName = "In-Store Pickup" ? Show : Disabled

 

ShippingOptionName = "In-Store Pickup" ? "" : FriendlyName + "(Available only for In-Store Pickup)"

Option

Payments.PayPalStandard

CurrentStoreId = 1 and ShippingOptionName.StartsWith("FedEx")

 

 

You can download the configuration import file by clicking on this link PaymentDirector (Various Expressions).txt

Also, if you're using the Test button in the PD configure page, if any expression uses OrderTotalWithoutPaymentFee, then be sure you've used the public store to put an item in the cart, and if using ShippingOptionName, go through the checkout process just past selecting a shipping method.  (PD will warn you otherwise)

Comments (0)
Payment Director - Conditional payment methods- Friday, January 4, 2013

Payment Director allows a store owner to conditionally determine which payment methods to show the customer and to calculate additional payment fees.  Let’s start with the basics…

By default, all Payment Methods that are marked Active in admin > Configuration > Payment Methods are available to your customers.   Then, you set up Payment Director Option records as needed to hide options and calculate fees.   Each option’s Expression field is evaluated, and if ‘true’ (or ‘Show’) then the option will be presented to the customer.  If ‘false’ (or ‘Hide’), then the payment option is removed.  You can include an Option record for all your active payment methods, but if only some are conditional, then it’s easiest to just have Option records for those;  if an active payment method is not included in payment director, then it will automatically be shown to the customer.

Here are some example scenarios for offering payment methods, and their Option records/expressions:

Offer 'payment in store' method only when "In-Store Pickup" shipping method selected:

  Option  Payments.PayInStore         ShippingOptionName = "In-Store Pickup"

Local Deliveries can include CashOnDelivery:

  Option  Payments.CashOnDelivery Customer.ShippingAddress.ZipPostalCode.StartsWith("100")

Customers in role "Members" can include PurchaseOrder  (use the role's System Name):

  Option  Payments.PurchaseOrder      Customer.IsInCustomerRole("Members")

If an admin is impersonating a Customer, then use Manual Credit Card, otherwise the customer enters a credit card that Authorize.Net will process:

  Option  Payments.Manual             OriginalCustomerIfImpersonated != null

  Option  Payments.AuthorizeNet       OriginalCustomerIfImpersonated = null

Only offer Paypal if a FedEx shipping method was selected (a method that has tracking :)

  Option  Payments.PayPalStandard     ShippingOptionName.StartsWith("FedEx")

When entering records in the Add new 'Payment Director' record dialog, select Option in the Type  field drop down, and then the Payment Name field will present a drop down with only active payment methods.    


Then, enter an expression that evaluates to a Boolean (true or false) using one or more or more of the following operands:

  • Customer  (also has function IsInRole("systemname") )
  • ShippingAddress
  • ShippingOption  (.ShippingRateComputationMethodSystemName, .Rate, .Name, .Description)
  • ShippingOptionName
  • Items  (shopping cart items collection)
  • OriginalCustomerIfImpersonated (if != null then you are impersonating)
  • WorkingLanguage  (.Name, and .LanguageCulture)
  • WorkingCurrency (.Name, .CurrencyCode, .Rate, and .DisplayLocale)
  • TaxDisplayType  (IncludingTax = 0, ExcludingTax = 10)
  • CreditCardType  (e.g. for Authorize.NET :  "Visa", "MasterCard", "Discover", "Amex")
  • PurchaseOrderNumber
  • OrderTotalWithoutPaymentFee
  • FriendlyName

   (UPDATE: Here are more operands added added from 3.60 and on)

  • CurrentStoreId
  • CurrentStoreName
  • IsImpersonating (Boolean)
  • CustomValues  
    • (The nopC PaymentInfoCustomValues is a Dictionary of Key/Values set by other payment plugins.  This variable converts that dictionary to a string of "key:value|key:value|...".  You can use CustomValues.StringBetween("key:","|") to get a value.

Here are some examples:

WorkingLanguage.Name = "English"

WorkingLanguage.LanguageCulture = "en-US"

We'll introduce more features in the next blog :)


Comments (4)