- From: Marcos Cáceres <notifications@github.com>
- Date: Thu, 14 Jun 2018 15:27:30 -0700
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 14 June 2018 22:27:54 UTC
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