§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}. Whenanyis true, print a form:action = $profile['reveal_action']; whenopen, a "Hide" button (name="hide" value="1"); otherwise (whenneeds_passwordis 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 namedpassword_field(@error). While open,national_idandtaxon the cards arrive with the full value.- An older template (a form that posts
profileper card) gets a validation error because it sends no password; update your theme. - My account › Profile (
clientprofile.wcp): theform_htmlcore 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}.amountis the amount to be taken from the balance;restis the remaining amount due (nullwhen none). Send the hiddenrequest_keyfield withkeyin the form (a double click does not apply it twice). Whenrestis 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.