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 = "", country = "",
addressLines = [], addressLines = [],
region = "", region = "",
regionCode = "",
city = "", city = "",
dependentLocality = "", dependentLocality = "",
postalCode = "", postalCode = "",
@ -286,6 +287,7 @@ var paymentDialogWrapper = {
paymentAddress.init(country, paymentAddress.init(country,
addressLine, addressLine,
region, region,
regionCode,
city, city,
dependentLocality, dependentLocality,
postalCode, postalCode,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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