WIACPSite theme 0.2.0-alpha.92
Türkçe

§5.21

Showing ID numbers with a password and partial balance

  • Phase 12.6
  • theme 1.22.0

ID / tax number (D5). Turkish ID and tax numbers are stored encrypted in the database and always arrive masked in the theme (123•••••789). Showing them in full takes the client's password and lasts 5 minutes; the value is not kept in the session.

  • checkout.wcp, profile step: the per-card "Show" button was removed. Instead there is one control for all profiles: $profile['reveal'] = {open, any, needs_password, password_field, minutes}. When any is true, print a form: action = $profile['reveal_action']; when open, a "Hide" button (name="hide" value="1"); otherwise (when needs_password is true) a password field (name = $profile['reveal']['password_field'], autocomplete="current-password") and a submit button. The error is the validation error of the field named password_field (@error). While open, national_id and tax on the cards arrive with the full value.
  • An older template (a form that posts profile per card) gets a validation error because it sends no password; update your theme.
  • My account › Profile (clientprofile.wcp): the form_html core block brings the numbers masked and prints the password reveal control itself; the theme adds nothing.

Partial balance. The balance can be used even when it does not cover the whole invoice: the smaller of the balance and the amount due is applied to the invoice, and the rest is paid with the other methods.

  • ordercomplete.wcp: $methods['wallet'] is now {balance, amount, rest, key}. amount is the amount to be taken from the balance; rest is the remaining amount due (null when none). Send the hidden request_key field with key in the form (a double click does not apply it twice). When rest is set, show the remaining amount to the user (__('checkout.complete.wallet_rest', ['rest' => …])).
  • viewinvoice.wcp: $blocks['wallet_html'] (core) contains the "Use my balance" form; no theme change is needed. New fields in $pay['wallet']: use, rest, action, key, offered.