зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1509147 - Rename payer and paymentMethod on nsIPaymentDetails to payerErrors and paymentMethodErrors respectively r=baku
This commit is contained in:
Родитель
5232ecbc2e
Коммит
f1008b35ec
|
@ -412,12 +412,12 @@ export default class AddressForm extends PaymentStateSubscriberMixin(PaymentRequ
|
|||
return paymentDetails.shippingAddressErrors;
|
||||
}
|
||||
case "selectedPayerAddress": {
|
||||
return paymentDetails.payer;
|
||||
return paymentDetails.payerErrors;
|
||||
}
|
||||
case "basic-card-page|billingAddressGUID": {
|
||||
// `paymentMethod` can be null.
|
||||
return (paymentDetails.paymentMethod
|
||||
&& paymentDetails.paymentMethod.billingAddress) || {};
|
||||
return (paymentDetails.paymentMethodErrors
|
||||
&& paymentDetails.paymentMethodErrors.billingAddress) || {};
|
||||
}
|
||||
default: {
|
||||
throw new Error("Unknown selectedStateKey");
|
||||
|
|
|
@ -53,8 +53,8 @@ let REQUEST_1 = {
|
|||
},
|
||||
},
|
||||
],
|
||||
payer: {},
|
||||
paymentMethod: {},
|
||||
payerErrors: {},
|
||||
paymentMethodErrors: {},
|
||||
shippingAddressErrors: {},
|
||||
shippingOptions: [
|
||||
{
|
||||
|
@ -135,8 +135,8 @@ let REQUEST_2 = {
|
|||
},
|
||||
},
|
||||
],
|
||||
payer: {},
|
||||
paymentMethod: {},
|
||||
payerErrors: {},
|
||||
paymentMethoErrors: {},
|
||||
shippingAddressErrors: {},
|
||||
shippingOptions: [
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ let buttonActions = {
|
|||
setBasicCardErrors() {
|
||||
let request = Object.assign({}, requestStore.getState().request);
|
||||
request.paymentDetails = Object.assign({}, requestStore.getState().request.paymentDetails);
|
||||
request.paymentDetails.paymentMethod = {
|
||||
request.paymentDetails.paymentMethodErrors = {
|
||||
cardNumber: "",
|
||||
cardholderName: "",
|
||||
cardSecurityCode: "",
|
||||
|
@ -530,7 +530,7 @@ let buttonActions = {
|
|||
setPayerErrors() {
|
||||
let request = Object.assign({}, requestStore.getState().request);
|
||||
request.paymentDetails = Object.assign({}, requestStore.getState().request.paymentDetails);
|
||||
request.paymentDetails.payer = {
|
||||
request.paymentDetails.payerErrors = {
|
||||
email: "Only @mozilla.com emails are supported",
|
||||
name: "Payer name must start with M",
|
||||
phone: "Payer area codes must start with 1",
|
||||
|
|
|
@ -46,8 +46,8 @@ export let requestStore = new PaymentsStore({
|
|||
id: null,
|
||||
totalItem: {label: null, amount: {currency: null, value: 0}},
|
||||
displayItems: [],
|
||||
payer: {},
|
||||
paymentMethod: null,
|
||||
payerErrors: {},
|
||||
paymentMethodErrors: null,
|
||||
shippingAddressErrors: {},
|
||||
shippingOptions: [],
|
||||
modifiers: null,
|
||||
|
|
|
@ -708,7 +708,7 @@ add_task(async function test_customMerchantValidity_billingAddressForm() {
|
|||
await form.requestStore.setState({
|
||||
request: {
|
||||
paymentDetails: {
|
||||
paymentMethod: {
|
||||
paymentMethodErrors: {
|
||||
billingAddress: {
|
||||
addressLine: "Billing Street address needs to start with a D",
|
||||
city: "Billing City needs to start with a B",
|
||||
|
@ -753,7 +753,7 @@ add_task(async function test_merchantPayerAddressErrors() {
|
|||
},
|
||||
request: {
|
||||
paymentDetails: {
|
||||
payer: {
|
||||
payerErrors: {
|
||||
email: "Email must be @mozilla.org",
|
||||
name: "Name needs to start with a W",
|
||||
phone: "Telephone needs to start with a 1",
|
||||
|
@ -771,7 +771,7 @@ add_task(async function test_merchantPayerAddressErrors() {
|
|||
|
||||
function checkValidationMessage(selector, property) {
|
||||
is(form.form.querySelector(selector).validationMessage,
|
||||
state.request.paymentDetails.payer[property],
|
||||
state.request.paymentDetails.payerErrors[property],
|
||||
"Validation message should match for " + selector);
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,7 @@ add_task(async function test_merchantPayerAddressErrors() {
|
|||
await form.requestStore.setState({
|
||||
request: {
|
||||
paymentDetails: {
|
||||
payer: {},
|
||||
payerErrors: {},
|
||||
},
|
||||
paymentOptions: {},
|
||||
},
|
||||
|
|
|
@ -256,10 +256,10 @@ add_task(async function test_merchantError() {
|
|||
info("Set billing address and payer errors which aren't relevant to this picker");
|
||||
let requestWithNonShippingAddressErrors = deepClone(request);
|
||||
Object.assign(requestWithNonShippingAddressErrors.paymentDetails, {
|
||||
payer: {
|
||||
payerErrors: {
|
||||
name: "Your name is too short",
|
||||
},
|
||||
paymentMethod: {
|
||||
paymentMethodErrors: {
|
||||
billingAddress: {
|
||||
country: "Your billing country is not supported",
|
||||
},
|
||||
|
|
|
@ -63,9 +63,9 @@ interface nsIPaymentDetails : nsISupports
|
|||
[implicit_jscontext]
|
||||
readonly attribute jsval shippingAddressErrors;
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval payer;
|
||||
readonly attribute jsval payerErrors;
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval paymentMethod;
|
||||
readonly attribute jsval paymentMethodErrors;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(d53f9f20-138e-47cc-9fd5-db16a3f6d301)]
|
||||
|
|
|
@ -481,7 +481,7 @@ PaymentDetails::GetShippingAddressErrors(JSContext* aCx, JS::MutableHandleValue
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PaymentDetails::GetPayer(JSContext* aCx, JS::MutableHandleValue aErrors)
|
||||
PaymentDetails::GetPayerErrors(JSContext* aCx, JS::MutableHandleValue aErrors)
|
||||
{
|
||||
PayerErrors errors;
|
||||
errors.Init(mPayerErrors);
|
||||
|
@ -492,7 +492,7 @@ PaymentDetails::GetPayer(JSContext* aCx, JS::MutableHandleValue aErrors)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PaymentDetails::GetPaymentMethod(JSContext* aCx, JS::MutableHandleValue aErrors)
|
||||
PaymentDetails::GetPaymentMethodErrors(JSContext* aCx, JS::MutableHandleValue aErrors)
|
||||
{
|
||||
if (mPaymentMethodErrors.IsEmpty()) {
|
||||
aErrors.set(JS::NullValue());
|
||||
|
@ -558,8 +558,8 @@ PaymentDetails::Update(nsIPaymentDetails* aDetails, const bool aRequestShipping)
|
|||
PaymentDetails* rowDetails = static_cast<PaymentDetails*>(aDetails);
|
||||
MOZ_ASSERT(rowDetails);
|
||||
mShippingAddressErrors = rowDetails->GetShippingAddressErrors();
|
||||
mPayerErrors = rowDetails->GetPayer();
|
||||
mPaymentMethodErrors = rowDetails->GetPaymentMethod();
|
||||
mPayerErrors = rowDetails->GetPayerErrors();
|
||||
mPaymentMethodErrors = rowDetails->GetPaymentMethodErrors();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -572,13 +572,13 @@ PaymentDetails::GetShippingAddressErrors() const
|
|||
}
|
||||
|
||||
const nsString&
|
||||
PaymentDetails::GetPayer() const
|
||||
PaymentDetails::GetPayerErrors() const
|
||||
{
|
||||
return mPayerErrors;
|
||||
}
|
||||
|
||||
const nsString&
|
||||
PaymentDetails::GetPaymentMethod() const
|
||||
PaymentDetails::GetPaymentMethodErrors() const
|
||||
{
|
||||
return mPaymentMethodErrors;
|
||||
}
|
||||
|
|
|
@ -131,8 +131,8 @@ public:
|
|||
nsIPaymentDetails** aDetails);
|
||||
nsresult Update(nsIPaymentDetails* aDetails, const bool aRequestShipping);
|
||||
const nsString& GetShippingAddressErrors() const;
|
||||
const nsString& GetPayer() const;
|
||||
const nsString& GetPaymentMethod() const;
|
||||
const nsString& GetPayerErrors() const;
|
||||
const nsString& GetPaymentMethodErrors() const;
|
||||
nsresult UpdateErrors(const nsAString& aError,
|
||||
const nsAString& aPayerErrors,
|
||||
const nsAString& aPaymentMethodErrors,
|
||||
|
|
|
@ -99,7 +99,7 @@ const TestingUIService = {
|
|||
updatePayment(requestId) {
|
||||
// Let's echo what was sent in by the error...
|
||||
const request = paymentSrv.getPaymentRequestById(requestId);
|
||||
this.showPayment(requestId, request.paymentDetails.paymentMethod);
|
||||
this.showPayment(requestId, request.paymentDetails.paymentMethodErrors);
|
||||
},
|
||||
// Handles response.complete()
|
||||
completePayment(requestId) {
|
||||
|
|
|
@ -35,7 +35,7 @@ const TestingUIService = {
|
|||
updatePayment(requestId) {
|
||||
// Let's echo what was sent in by the error...
|
||||
const request = paymentSrv.getPaymentRequestById(requestId);
|
||||
const { name, email, phone } = request.paymentDetails.payer;
|
||||
const { name, email, phone } = request.paymentDetails.payerErrors;
|
||||
const { error } = request.paymentDetails;
|
||||
// Let's use the .error as the switch
|
||||
switch (error) {
|
||||
|
|
|
@ -112,7 +112,7 @@ function checkPayerErrors(testName, errors) {
|
|||
|
||||
function checkPaymentMethodErrors(testName, errors) {
|
||||
if (!errors) {
|
||||
emitTestFail(`${testName} :Expect non-null payerMethodErrors, but got null.`);
|
||||
emitTestFail(`${testName} :Expect non-null paymentMethodErrors, but got null.`);
|
||||
return;
|
||||
}
|
||||
for (const [key, msg] of Object.entries(errors)) {
|
||||
|
@ -148,8 +148,8 @@ const DummyUIService = {
|
|||
payment.paymentDetails.error + "'");
|
||||
}
|
||||
checkAddressErrors(this.testName, payment.paymentDetails.shippingAddressErrors)
|
||||
checkPayerErrors(this.testName, payment.paymentDetails.payer);
|
||||
checkPaymentMethodErrors(this.testName, payment.paymentDetails.paymentMethod);
|
||||
checkPayerErrors(this.testName, payment.paymentDetails.payerErrors);
|
||||
checkPaymentMethodErrors(this.testName, payment.paymentDetails.paymentMethodErrors);
|
||||
if (this.rejectRetry) {
|
||||
rejectPayment(requestId);
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче