Bug 1441752 - Adding an new attribute regionCode in PaymentAddress. r=baku

--HG--
extra : histedit_source : d71b94a611ff5cd3f5b556de9157ff46a5cfeda6
This commit is contained in:
Eden Chuang 2018-09-28 12:21:59 +02:00
Родитель bf5942616e
Коммит 05093acbf4
13 изменённых файлов: 49 добавлений и 5 удалений

Просмотреть файл

@ -267,6 +267,7 @@ var paymentDialogWrapper = {
country = "",
addressLines = [],
region = "",
regionCode = "",
city = "",
dependentLocality = "",
postalCode = "",
@ -286,6 +287,7 @@ var paymentDialogWrapper = {
paymentAddress.init(country,
addressLine,
region,
regionCode,
city,
dependentLocality,
postalCode,

Просмотреть файл

@ -13,6 +13,7 @@ interface nsIPaymentAddress : nsISupports
readonly attribute AString country;
readonly attribute nsIArray addressLine;
readonly attribute AString region;
readonly attribute AString regionCode;
readonly attribute AString city;
readonly attribute AString dependentLocality;
readonly attribute AString postalCode;
@ -24,6 +25,7 @@ interface nsIPaymentAddress : nsISupports
void init(in AString aCountry,
in nsIArray aAddressLine,
in AString aRegion,
in AString aRegionCode,
in AString aCity,
in AString aDependentLocality,
in AString aPostalCode,

Просмотреть файл

@ -36,6 +36,7 @@ namespace dom {
#define Country NS_LITERAL_STRING("country")
#define AddressLine NS_LITERAL_STRING("addressLine")
#define Region NS_LITERAL_STRING("region")
#define RegionCode NS_LITERAL_STRING("regionCode")
#define City NS_LITERAL_STRING("city")
#define DependentLocality NS_LITERAL_STRING("dependentLocality")
#define PostalCode NS_LITERAL_STRING("postalCode")
@ -114,6 +115,7 @@ bool IsAddressKey(const nsAString& aKey)
return Country.Equals(aKey) ||
AddressLine.Equals(aKey) ||
Region.Equals(aKey) ||
RegionCode.Equals(aKey) ||
City.Equals(aKey) ||
DependentLocality.Equals(aKey) ||
PostalCode.Equals(aKey) ||
@ -258,6 +260,7 @@ BasicCardService::EncodeBasicCardData(const nsAString& aCardholderName,
}
EncodeBasicCardProperty(AddressLine ,addressLineString , aResult);
EncodeAddressProperty(aBillingAddress, Region, aResult);
EncodeAddressProperty(aBillingAddress, RegionCode, aResult);
EncodeAddressProperty(aBillingAddress, City, aResult);
EncodeAddressProperty(aBillingAddress, DependentLocality, aResult);
EncodeAddressProperty(aBillingAddress, PostalCode, aResult);
@ -278,6 +281,7 @@ BasicCardService::DecodeBasicCardData(const nsAString& aData,
nsTArray<nsString> addressLine;
nsAutoString country;
nsAutoString region;
nsAutoString regionCode;
nsAutoString city;
nsAutoString dependentLocality;
nsAutoString postalCode;
@ -311,6 +315,7 @@ BasicCardService::DecodeBasicCardData(const nsAString& aData,
DecodeAddressProperty(key, value, Country, country);
DecodeAddressProperty(key, value, Region, region);
DecodeAddressProperty(key, value, RegionCode, regionCode);
DecodeAddressProperty(key, value, City, city);
DecodeAddressProperty(key, value, DependentLocality, dependentLocality);
DecodeAddressProperty(key, value, PostalCode, postalCode);
@ -332,6 +337,7 @@ BasicCardService::DecodeBasicCardData(const nsAString& aData,
country,
addressLine,
region,
regionCode,
city,
dependentLocality,
postalCode,
@ -379,6 +385,7 @@ BasicCardService::IsValidBasicCardErrors(JSContext* aCx,
#undef Country
#undef AddressLine
#undef Region
#undef RegionCode
#undef City
#undef DependentLocality
#undef PostalCode

Просмотреть файл

@ -24,6 +24,7 @@ PaymentAddress::PaymentAddress(nsPIDOMWindowInner* aWindow,
const nsAString& aCountry,
const nsTArray<nsString>& aAddressLine,
const nsAString& aRegion,
const nsAString& aRegionCode,
const nsAString& aCity,
const nsAString& aDependentLocality,
const nsAString& aPostalCode,
@ -34,6 +35,7 @@ PaymentAddress::PaymentAddress(nsPIDOMWindowInner* aWindow,
: mCountry(aCountry)
, mAddressLine(aAddressLine)
, mRegion(aRegion)
, mRegionCode(aRegionCode)
, mCity(aCity)
, mDependentLocality(aDependentLocality)
, mPostalCode(aPostalCode)
@ -63,6 +65,12 @@ PaymentAddress::GetRegion(nsAString& aRetVal) const
aRetVal = mRegion;
}
void
PaymentAddress::GetRegionCode(nsAString& aRetVal) const
{
aRetVal = mRegionCode;
}
void
PaymentAddress::GetCity(nsAString& aRetVal) const
{

Просмотреть файл

@ -24,6 +24,7 @@ public:
const nsAString& aCountry,
const nsTArray<nsString>& aAddressLine,
const nsAString& aRegion,
const nsAString& aRegionCode,
const nsAString& aCity,
const nsAString& aDependentLocality,
const nsAString& aPostalCode,
@ -47,6 +48,8 @@ public:
void GetRegion(nsAString& aRetVal) const;
void GetRegionCode(nsAString& aRetVal) const;
void GetCity(nsAString& aRetVal) const;
void GetDependentLocality(nsAString& aRetVal) const;
@ -67,6 +70,7 @@ private:
nsString mCountry;
nsTArray<nsString> mAddressLine;
nsString mRegion;
nsString mRegionCode;
nsString mCity;
nsString mDependentLocality;
nsString mPostalCode;

Просмотреть файл

@ -1040,6 +1040,7 @@ nsresult
PaymentRequest::UpdateShippingAddress(const nsAString& aCountry,
const nsTArray<nsString>& aAddressLine,
const nsAString& aRegion,
const nsAString& aRegionCode,
const nsAString& aCity,
const nsAString& aDependentLocality,
const nsAString& aPostalCode,
@ -1050,11 +1051,13 @@ PaymentRequest::UpdateShippingAddress(const nsAString& aCountry,
{
nsTArray<nsString> emptyArray;
mShippingAddress = new PaymentAddress(GetOwner(), aCountry, emptyArray,
aRegion, aCity, aDependentLocality,
aPostalCode, aSortingCode,
EmptyString(), EmptyString(), EmptyString());
aRegion, aRegionCode, aCity,
aDependentLocality, aPostalCode,
aSortingCode, EmptyString(),
EmptyString(), EmptyString());
mFullShippingAddress = new PaymentAddress(GetOwner(), aCountry, aAddressLine,
aRegion, aCity, aDependentLocality,
aRegion, aRegionCode, aCity,
aDependentLocality,
aPostalCode, aSortingCode,
aOrganization, aRecipient, aPhone);
// Fire shippingaddresschange event

Просмотреть файл

@ -126,6 +126,7 @@ public:
nsresult UpdateShippingAddress(const nsAString& aCountry,
const nsTArray<nsString>& aAddressLine,
const nsAString& aRegion,
const nsAString& aRegionCode,
const nsAString& aCity,
const nsAString& aDependentLocality,
const nsAString& aPostalCode,

Просмотреть файл

@ -815,6 +815,7 @@ NS_IMETHODIMP
PaymentAddress::Init(const nsAString& aCountry,
nsIArray* aAddressLine,
const nsAString& aRegion,
const nsAString& aRegionCode,
const nsAString& aCity,
const nsAString& aDependentLocality,
const nsAString& aPostalCode,
@ -826,6 +827,7 @@ PaymentAddress::Init(const nsAString& aCountry,
mCountry = aCountry;
mAddressLine = aAddressLine;
mRegion = aRegion;
mRegionCode = aRegionCode;
mCity = aCity;
mDependentLocality = aDependentLocality;
mPostalCode = aPostalCode;
@ -859,6 +861,13 @@ PaymentAddress::GetRegion(nsAString& aRegion)
return NS_OK;
}
NS_IMETHODIMP
PaymentAddress::GetRegionCode(nsAString& aRegionCode)
{
aRegionCode = mRegionCode;
return NS_OK;
}
NS_IMETHODIMP
PaymentAddress::GetCity(nsAString& aCity)
{

Просмотреть файл

@ -287,6 +287,7 @@ private:
nsString mCountry;
nsCOMPtr<nsIArray> mAddressLine;
nsString mRegion;
nsString mRegionCode;
nsString mCity;
nsString mDependentLocality;
nsString mPostalCode;

Просмотреть файл

@ -652,6 +652,7 @@ PaymentRequestManager::ChangeShippingAddress(PaymentRequest* aRequest,
return aRequest->UpdateShippingAddress(aAddress.country(),
aAddress.addressLine(),
aAddress.region(),
aAddress.regionCode(),
aAddress.city(),
aAddress.dependentLocality(),
aAddress.postalCode(),

Просмотреть файл

@ -175,6 +175,7 @@ struct IPCPaymentAddress
nsString country;
nsString[] addressLine;
nsString region;
nsString regionCode;
nsString city;
nsString dependentLocality;
nsString postalCode;

Просмотреть файл

@ -221,6 +221,10 @@ PaymentRequestParent::ChangeShippingAddress(const nsAString& aRequestId,
rv = aAddress->GetRegion(region);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString regionCode;
rv = aAddress->GetRegionCode(regionCode);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString city;
rv = aAddress->GetCity(city);
NS_ENSURE_SUCCESS(rv, rv);
@ -262,7 +266,7 @@ PaymentRequestParent::ChangeShippingAddress(const nsAString& aRequestId,
addressLine.AppendElement(address);
}
IPCPaymentAddress ipcAddress(country, addressLine, region, city,
IPCPaymentAddress ipcAddress(country, addressLine, region, regionCode, city,
dependentLocality, postalCode, sortingCode,
organization, recipient, phone);

Просмотреть файл

@ -21,6 +21,7 @@ interface PaymentAddress {
[Frozen, Cached, Pure]
readonly attribute sequence<DOMString> addressLine;
readonly attribute DOMString region;
readonly attribute DOMString regionCode;
readonly attribute DOMString city;
readonly attribute DOMString dependentLocality;
readonly attribute DOMString postalCode;