Re: [w3c/payment-request] Add PaymentResponse.onpayerdetailchange (#724)

so, this how one would handle 

```JS
let {
  payerName: oldPayerName,
  payerEmail: oldPayerEmail,
  payerPhone: oldPayerPhone,
} = response;
response.onpayerdetailchange = async ev => {
  const errors = {};
  const { payerName, payerEmail, payerPhone } = response;
  if (oldPayerName !== payerName) {
    Object.assign(errors, await validateName(payerName));
    oldPayerName = payerName;
  }
  if (oldPayerEmail !== payerEmail) {
    Object.assign(errors, await validateEmail(payerEmail));
    oldPayerEmail = payerEmail;
  }
  if (oldPayerPhone !== payerPhone) {
    Object.assign(errors, await validatePhone(payerPhone));
    oldPayerPhone = payerPhone;
  }
  if (Object.getOwnPropertyNames(errors).length) {
    await response.retry(errors);
  }
};
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/pull/724#issuecomment-397457318

Received on Thursday, 14 June 2018 22:27:54 UTC