Restrict Default Payment Option Populated in Sales Order

Scenarios

  1. Setting a default credit card via Web will mark the Default checkbox under the customer record’s Financial tab > Payment Instruments sub tab.
  2. In the same way, marking the Default checkbox under the customer record’s Financial tab > Payment Instruments sub tab will set it as a default credit card in the Web store.

Solution Designed

Step 1:

  1. Add a field in Customer record “HAS WEBSITE DEFAULT CARD” under “Financial” Subtab.
  2. Set Display Type – Disabled.
  3. Deploy a script in the Payment Card Token and Payment Card record (payment instruments) which flags(marks true) the “HAS WEBSITE DEFAULT CARD” field in customer record whenever the Website trigger makes the “DEFAULT” Value Checked in the Payment Card Token/Payment Card record.
  4. Through any other trigger say UI, that causes the changes in “DEFAULT” value in the Payment Card Token record, thus unset “HAS WEBSITE DEFAULT CARD” field value.

Step 2:

  1. Then simply trace the value in the “HAS WEBSITE DEFAULT CARD” field from Sales order.
  2. When User creates a new Sales Order in UI we have to set the field PAYMENT OPTION empty.

Risks

  • In step-1 the only option to distinguish the trigger from Website, is to check the system notes. But we cannot access the system notes of the payment instruments. So we should utilise the context filtering in script.
  • For implementing step-2 we should use client script, so keep in mind to consolidate the logic with any of the existing client scripts deployed in Sales Order, because we can only deploy maximum 10 client script in a record; if one more script added it will not run.

Leave a comment

Your email address will not be published. Required fields are marked *