2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2017-05-25 20:50:32 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2018-05-17 14:59:16 +03:00
|
|
|
#include "mozilla/dom/PaymentRequestBinding.h"
|
2017-05-25 20:50:32 +03:00
|
|
|
#include "nsArrayUtils.h"
|
|
|
|
#include "nsIMutableArray.h"
|
|
|
|
#include "nsISupportsPrimitives.h"
|
2017-09-06 09:36:24 +03:00
|
|
|
#include "nsUnicharUtils.h"
|
2017-05-25 20:50:32 +03:00
|
|
|
#include "PaymentRequestData.h"
|
|
|
|
#include "PaymentRequestUtils.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace payments {
|
|
|
|
|
|
|
|
/* PaymentMethodData */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentMethodData,
|
|
|
|
nsIPaymentMethodData)
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
PaymentMethodData::PaymentMethodData(const nsAString& aSupportedMethods,
|
2017-05-25 20:50:32 +03:00
|
|
|
const nsAString& aData)
|
|
|
|
: mSupportedMethods(aSupportedMethods)
|
|
|
|
, mData(aData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentMethodData::Create(const IPCPaymentMethodData& aIPCMethodData,
|
|
|
|
nsIPaymentMethodData** aMethodData)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aMethodData);
|
|
|
|
nsCOMPtr<nsIPaymentMethodData> methodData =
|
2017-06-30 20:17:12 +03:00
|
|
|
new PaymentMethodData(aIPCMethodData.supportedMethods(), aIPCMethodData.data());
|
2017-05-25 20:50:32 +03:00
|
|
|
methodData.forget(aMethodData);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-06-30 20:17:12 +03:00
|
|
|
PaymentMethodData::GetSupportedMethods(nsAString& aSupportedMethods)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
2017-06-30 20:17:12 +03:00
|
|
|
aSupportedMethods = mSupportedMethods;
|
2017-05-25 20:50:32 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-07-26 11:07:07 +03:00
|
|
|
PaymentMethodData::GetData(JSContext* aCx, JS::MutableHandleValue aData)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
2017-07-26 11:07:07 +03:00
|
|
|
if (mData.IsEmpty()) {
|
|
|
|
aData.set(JS::NullValue());
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsresult rv = DeserializeToJSValue(mData, aCx ,aData);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2017-05-25 20:50:32 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PaymentCurrencyAmount */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentCurrencyAmount,
|
|
|
|
nsIPaymentCurrencyAmount)
|
|
|
|
|
|
|
|
PaymentCurrencyAmount::PaymentCurrencyAmount(const nsAString& aCurrency,
|
|
|
|
const nsAString& aValue)
|
2017-09-06 09:36:24 +03:00
|
|
|
: mValue(aValue)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
2017-09-06 09:36:24 +03:00
|
|
|
/*
|
|
|
|
* According to the spec
|
|
|
|
* https://w3c.github.io/payment-request/#validity-checkers
|
|
|
|
* Set amount.currency to the result of ASCII uppercasing amount.currency.
|
|
|
|
*/
|
|
|
|
ToUpperCase(aCurrency, mCurrency);
|
2017-05-25 20:50:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentCurrencyAmount::Create(const IPCPaymentCurrencyAmount& aIPCAmount,
|
|
|
|
nsIPaymentCurrencyAmount** aAmount)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aAmount);
|
|
|
|
nsCOMPtr<nsIPaymentCurrencyAmount> amount =
|
|
|
|
new PaymentCurrencyAmount(aIPCAmount.currency(), aIPCAmount.value());
|
|
|
|
amount.forget(aAmount);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentCurrencyAmount::GetCurrency(nsAString& aCurrency)
|
|
|
|
{
|
|
|
|
aCurrency = mCurrency;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentCurrencyAmount::GetValue(nsAString& aValue)
|
|
|
|
{
|
|
|
|
aValue = mValue;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PaymentItem */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentItem,
|
|
|
|
nsIPaymentItem)
|
|
|
|
|
|
|
|
PaymentItem::PaymentItem(const nsAString& aLabel,
|
|
|
|
nsIPaymentCurrencyAmount* aAmount,
|
2018-02-28 16:00:05 +03:00
|
|
|
const bool aPending,
|
|
|
|
const nsAString& aType)
|
2017-05-25 20:50:32 +03:00
|
|
|
: mLabel(aLabel)
|
|
|
|
, mAmount(aAmount)
|
|
|
|
, mPending(aPending)
|
2018-02-28 16:00:05 +03:00
|
|
|
, mType(aType)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentItem::Create(const IPCPaymentItem& aIPCItem, nsIPaymentItem** aItem)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aItem);
|
|
|
|
nsCOMPtr<nsIPaymentCurrencyAmount> amount;
|
|
|
|
nsresult rv = PaymentCurrencyAmount::Create(aIPCItem.amount(),
|
|
|
|
getter_AddRefs(amount));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIPaymentItem> item =
|
2018-02-28 16:00:05 +03:00
|
|
|
new PaymentItem(aIPCItem.label(), amount, aIPCItem.pending(), aIPCItem.type());
|
2017-05-25 20:50:32 +03:00
|
|
|
item.forget(aItem);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentItem::GetLabel(nsAString& aLabel)
|
|
|
|
{
|
|
|
|
aLabel = mLabel;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentItem::GetAmount(nsIPaymentCurrencyAmount** aAmount)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aAmount);
|
|
|
|
MOZ_ASSERT(mAmount);
|
|
|
|
nsCOMPtr<nsIPaymentCurrencyAmount> amount = mAmount;
|
|
|
|
amount.forget(aAmount);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentItem::GetPending(bool* aPending)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aPending);
|
|
|
|
*aPending = mPending;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-02-28 16:00:05 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentItem::GetType(nsAString& aType)
|
|
|
|
{
|
|
|
|
aType = mType;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
/* PaymentDetailsModifier */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentDetailsModifier,
|
|
|
|
nsIPaymentDetailsModifier)
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
PaymentDetailsModifier::PaymentDetailsModifier(const nsAString& aSupportedMethods,
|
2017-05-25 20:50:32 +03:00
|
|
|
nsIPaymentItem* aTotal,
|
|
|
|
nsIArray* aAdditionalDisplayItems,
|
|
|
|
const nsAString& aData)
|
|
|
|
: mSupportedMethods(aSupportedMethods)
|
|
|
|
, mTotal(aTotal)
|
|
|
|
, mAdditionalDisplayItems(aAdditionalDisplayItems)
|
|
|
|
, mData(aData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentDetailsModifier::Create(const IPCPaymentDetailsModifier& aIPCModifier,
|
|
|
|
nsIPaymentDetailsModifier** aModifier)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aModifier);
|
|
|
|
nsCOMPtr<nsIPaymentItem> total;
|
|
|
|
nsresult rv = PaymentItem::Create(aIPCModifier.total(), getter_AddRefs(total));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> displayItems;
|
|
|
|
if (aIPCModifier.additionalDisplayItemsPassed()) {
|
|
|
|
nsCOMPtr<nsIMutableArray> items = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
|
|
|
MOZ_ASSERT(items);
|
|
|
|
for (const IPCPaymentItem& item : aIPCModifier.additionalDisplayItems()) {
|
|
|
|
nsCOMPtr<nsIPaymentItem> additionalItem;
|
|
|
|
rv = PaymentItem::Create(item, getter_AddRefs(additionalItem));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2017-10-21 17:53:02 +03:00
|
|
|
rv = items->AppendElement(additionalItem);
|
2017-05-25 20:50:32 +03:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
displayItems = items.forget();
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIPaymentDetailsModifier> modifier =
|
2017-06-30 20:17:12 +03:00
|
|
|
new PaymentDetailsModifier(aIPCModifier.supportedMethods(),
|
|
|
|
total,
|
|
|
|
displayItems,
|
|
|
|
aIPCModifier.data());
|
2017-05-25 20:50:32 +03:00
|
|
|
modifier.forget(aModifier);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-06-30 20:17:12 +03:00
|
|
|
PaymentDetailsModifier::GetSupportedMethods(nsAString& aSupportedMethods)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
2017-06-30 20:17:12 +03:00
|
|
|
aSupportedMethods = mSupportedMethods;
|
2017-05-25 20:50:32 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetailsModifier::GetTotal(nsIPaymentItem** aTotal)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aTotal);
|
|
|
|
MOZ_ASSERT(mTotal);
|
|
|
|
nsCOMPtr<nsIPaymentItem> total = mTotal;
|
|
|
|
total.forget(aTotal);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetailsModifier::GetAdditionalDisplayItems(nsIArray** aAdditionalDisplayItems)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aAdditionalDisplayItems);
|
|
|
|
nsCOMPtr<nsIArray> additionalItems = mAdditionalDisplayItems;
|
|
|
|
additionalItems.forget(aAdditionalDisplayItems);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-07-26 11:07:07 +03:00
|
|
|
PaymentDetailsModifier::GetData(JSContext* aCx, JS::MutableHandleValue aData)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
2017-07-26 11:07:07 +03:00
|
|
|
if (mData.IsEmpty()) {
|
|
|
|
aData.set(JS::NullValue());
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsresult rv = DeserializeToJSValue(mData, aCx ,aData);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2017-05-25 20:50:32 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PaymentShippingOption */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentShippingOption,
|
|
|
|
nsIPaymentShippingOption)
|
|
|
|
|
|
|
|
PaymentShippingOption::PaymentShippingOption(const nsAString& aId,
|
|
|
|
const nsAString& aLabel,
|
|
|
|
nsIPaymentCurrencyAmount* aAmount,
|
|
|
|
const bool aSelected)
|
|
|
|
: mId(aId)
|
|
|
|
, mLabel(aLabel)
|
|
|
|
, mAmount(aAmount)
|
|
|
|
, mSelected(aSelected)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentShippingOption::Create(const IPCPaymentShippingOption& aIPCOption,
|
|
|
|
nsIPaymentShippingOption** aOption)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aOption);
|
|
|
|
nsCOMPtr<nsIPaymentCurrencyAmount> amount;
|
|
|
|
nsresult rv = PaymentCurrencyAmount::Create(aIPCOption.amount(), getter_AddRefs(amount));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIPaymentShippingOption> option =
|
|
|
|
new PaymentShippingOption(aIPCOption.id(), aIPCOption.label(), amount, aIPCOption.selected());
|
|
|
|
option.forget(aOption);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentShippingOption::GetId(nsAString& aId)
|
|
|
|
{
|
|
|
|
aId = mId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentShippingOption::GetLabel(nsAString& aLabel)
|
|
|
|
{
|
|
|
|
aLabel = mLabel;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentShippingOption::GetAmount(nsIPaymentCurrencyAmount** aAmount)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aAmount);
|
|
|
|
MOZ_ASSERT(mAmount);
|
|
|
|
nsCOMPtr<nsIPaymentCurrencyAmount> amount = mAmount;
|
|
|
|
amount.forget(aAmount);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentShippingOption::GetSelected(bool* aSelected)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aSelected);
|
|
|
|
*aSelected = mSelected;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentShippingOption::SetSelected(bool aSelected)
|
|
|
|
{
|
|
|
|
mSelected = aSelected;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PaymentDetails */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentDetails,
|
|
|
|
nsIPaymentDetails)
|
|
|
|
|
|
|
|
PaymentDetails::PaymentDetails(const nsAString& aId,
|
|
|
|
nsIPaymentItem* aTotalItem,
|
|
|
|
nsIArray* aDisplayItems,
|
|
|
|
nsIArray* aShippingOptions,
|
|
|
|
nsIArray* aModifiers,
|
2018-05-17 14:59:16 +03:00
|
|
|
const nsAString& aError,
|
2018-09-04 17:00:33 +03:00
|
|
|
const nsAString& aShippingAddressErrors,
|
|
|
|
const nsAString& aPayerErrors,
|
|
|
|
const nsAString& aPaymentMethodErrors)
|
2017-05-25 20:50:32 +03:00
|
|
|
: mId(aId)
|
|
|
|
, mTotalItem(aTotalItem)
|
|
|
|
, mDisplayItems(aDisplayItems)
|
|
|
|
, mShippingOptions(aShippingOptions)
|
|
|
|
, mModifiers(aModifiers)
|
|
|
|
, mError(aError)
|
2018-05-17 14:59:16 +03:00
|
|
|
, mShippingAddressErrors(aShippingAddressErrors)
|
2018-09-04 17:00:33 +03:00
|
|
|
, mPayerErrors(aPayerErrors)
|
|
|
|
, mPaymentMethodErrors(aPaymentMethodErrors)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentDetails::Create(const IPCPaymentDetails& aIPCDetails,
|
|
|
|
nsIPaymentDetails** aDetails)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aDetails);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPaymentItem> total;
|
|
|
|
nsresult rv = PaymentItem::Create(aIPCDetails.total(), getter_AddRefs(total));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> displayItems;
|
2018-08-19 19:11:00 +03:00
|
|
|
nsCOMPtr<nsIMutableArray> items = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
|
|
|
MOZ_ASSERT(items);
|
|
|
|
for (const IPCPaymentItem& displayItem : aIPCDetails.displayItems()) {
|
|
|
|
nsCOMPtr<nsIPaymentItem> item;
|
|
|
|
rv = PaymentItem::Create(displayItem, getter_AddRefs(item));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
rv = items->AppendElement(item);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
2017-05-25 20:50:32 +03:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 19:11:00 +03:00
|
|
|
displayItems = items.forget();
|
2017-05-25 20:50:32 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> shippingOptions;
|
2018-08-19 19:11:00 +03:00
|
|
|
nsCOMPtr<nsIMutableArray> options = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
|
|
|
MOZ_ASSERT(options);
|
|
|
|
for (const IPCPaymentShippingOption& shippingOption : aIPCDetails.shippingOptions()) {
|
|
|
|
nsCOMPtr<nsIPaymentShippingOption> option;
|
|
|
|
rv = PaymentShippingOption::Create(shippingOption, getter_AddRefs(option));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
rv = options->AppendElement(option);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
2017-05-25 20:50:32 +03:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 19:11:00 +03:00
|
|
|
shippingOptions = options.forget();
|
2017-05-25 20:50:32 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> modifiers;
|
2018-08-19 19:11:00 +03:00
|
|
|
nsCOMPtr<nsIMutableArray> detailsModifiers = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
|
|
|
MOZ_ASSERT(detailsModifiers);
|
|
|
|
for (const IPCPaymentDetailsModifier& modifier : aIPCDetails.modifiers()) {
|
|
|
|
nsCOMPtr<nsIPaymentDetailsModifier> detailsModifier;
|
|
|
|
rv = PaymentDetailsModifier::Create(modifier, getter_AddRefs(detailsModifier));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
rv = detailsModifiers->AppendElement(detailsModifier);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
2017-05-25 20:50:32 +03:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 19:11:00 +03:00
|
|
|
modifiers = detailsModifiers.forget();
|
2017-05-25 20:50:32 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPaymentDetails> details =
|
|
|
|
new PaymentDetails(aIPCDetails.id(), total, displayItems, shippingOptions,
|
2018-05-17 14:59:16 +03:00
|
|
|
modifiers, aIPCDetails.error(),
|
2018-09-04 17:00:33 +03:00
|
|
|
aIPCDetails.shippingAddressErrors(),
|
|
|
|
aIPCDetails.payerErrors(),
|
|
|
|
aIPCDetails.paymentMethodErrors());
|
2017-05-25 20:50:32 +03:00
|
|
|
|
|
|
|
details.forget(aDetails);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetId(nsAString& aId)
|
|
|
|
{
|
|
|
|
aId = mId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetTotalItem(nsIPaymentItem** aTotalItem)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aTotalItem);
|
|
|
|
MOZ_ASSERT(mTotalItem);
|
|
|
|
nsCOMPtr<nsIPaymentItem> total = mTotalItem;
|
|
|
|
total.forget(aTotalItem);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetDisplayItems(nsIArray** aDisplayItems)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aDisplayItems);
|
|
|
|
nsCOMPtr<nsIArray> displayItems = mDisplayItems;
|
|
|
|
displayItems.forget(aDisplayItems);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetShippingOptions(nsIArray** aShippingOptions)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aShippingOptions);
|
|
|
|
nsCOMPtr<nsIArray> options = mShippingOptions;
|
|
|
|
options.forget(aShippingOptions);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetModifiers(nsIArray** aModifiers)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aModifiers);
|
|
|
|
nsCOMPtr<nsIArray> modifiers = mModifiers;
|
|
|
|
modifiers.forget(aModifiers);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetError(nsAString& aError)
|
|
|
|
{
|
|
|
|
aError = mError;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-05-17 14:59:16 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetShippingAddressErrors(JSContext* aCx, JS::MutableHandleValue aErrors)
|
|
|
|
{
|
|
|
|
AddressErrors errors;
|
|
|
|
errors.Init(mShippingAddressErrors);
|
|
|
|
if (!ToJSValue(aCx, errors, aErrors)) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-09-04 13:28:40 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetPayer(JSContext* aCx, JS::MutableHandleValue aErrors)
|
|
|
|
{
|
2018-10-01 10:44:00 +03:00
|
|
|
PayerErrors errors;
|
2018-09-04 13:28:40 +03:00
|
|
|
errors.Init(mPayerErrors);
|
|
|
|
if (!ToJSValue(aCx, errors, aErrors)) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentDetails::GetPaymentMethod(JSContext* aCx, JS::MutableHandleValue aErrors)
|
|
|
|
{
|
|
|
|
if (mPaymentMethodErrors.IsEmpty()) {
|
|
|
|
aErrors.set(JS::NullValue());
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsresult rv = DeserializeToJSValue(mPaymentMethodErrors, aCx ,aErrors);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-08-30 15:13:33 +03:00
|
|
|
nsresult
|
2018-03-29 18:09:52 +03:00
|
|
|
PaymentDetails::Update(nsIPaymentDetails* aDetails, const bool aRequestShipping)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aDetails);
|
|
|
|
/*
|
|
|
|
* According to the spec [1], update the attributes if they present in new
|
|
|
|
* details (i.e., PaymentDetailsUpdate); otherwise, keep original value.
|
|
|
|
* Note |id| comes only from initial details (i.e., PaymentDetailsInit) and
|
|
|
|
* |error| only from new details.
|
|
|
|
*
|
|
|
|
* [1] https://www.w3.org/TR/payment-request/#updatewith-method
|
|
|
|
*/
|
|
|
|
|
|
|
|
nsresult rv = aDetails->GetTotalItem(getter_AddRefs(mTotalItem));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> displayItems;
|
|
|
|
rv = aDetails->GetDisplayItems(getter_AddRefs(displayItems));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
if (displayItems) {
|
|
|
|
mDisplayItems = displayItems;
|
|
|
|
}
|
|
|
|
|
2018-03-29 18:09:52 +03:00
|
|
|
if (aRequestShipping) {
|
|
|
|
nsCOMPtr<nsIArray> shippingOptions;
|
|
|
|
rv = aDetails->GetShippingOptions(getter_AddRefs(shippingOptions));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2017-05-25 20:50:32 +03:00
|
|
|
mShippingOptions = shippingOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIArray> modifiers;
|
|
|
|
rv = aDetails->GetModifiers(getter_AddRefs(modifiers));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
if (modifiers) {
|
|
|
|
mModifiers = modifiers;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = aDetails->GetError(mError);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2018-05-17 14:59:16 +03:00
|
|
|
|
2018-08-30 15:13:33 +03:00
|
|
|
PaymentDetails* rowDetails = static_cast<PaymentDetails*>(aDetails);
|
|
|
|
MOZ_ASSERT(rowDetails);
|
|
|
|
mShippingAddressErrors = rowDetails->GetShippingAddressErrors();
|
2018-09-04 17:00:33 +03:00
|
|
|
mPayerErrors = rowDetails->GetPayer();
|
|
|
|
mPaymentMethodErrors = rowDetails->GetPaymentMethod();
|
2018-08-30 15:13:33 +03:00
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
}
|
2018-08-30 15:13:33 +03:00
|
|
|
|
2018-09-04 17:00:33 +03:00
|
|
|
const nsString&
|
2018-08-30 15:13:33 +03:00
|
|
|
PaymentDetails::GetShippingAddressErrors() const
|
2018-05-17 14:59:16 +03:00
|
|
|
{
|
2018-08-30 15:13:33 +03:00
|
|
|
return mShippingAddressErrors;
|
2018-05-17 14:59:16 +03:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:00:33 +03:00
|
|
|
const nsString&
|
|
|
|
PaymentDetails::GetPayer() const
|
|
|
|
{
|
|
|
|
return mPayerErrors;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsString&
|
|
|
|
PaymentDetails::GetPaymentMethod() const
|
|
|
|
{
|
|
|
|
return mPaymentMethodErrors;
|
|
|
|
}
|
|
|
|
|
2018-09-04 13:28:40 +03:00
|
|
|
nsresult
|
|
|
|
PaymentDetails::UpdateErrors(const nsAString& aError,
|
|
|
|
const nsAString& aPayerErrors,
|
|
|
|
const nsAString& aPaymentMethodErrors,
|
|
|
|
const nsAString& aShippingAddressErrors)
|
|
|
|
{
|
|
|
|
mError = aError;
|
|
|
|
mPayerErrors = aPayerErrors;
|
|
|
|
mPaymentMethodErrors = aPaymentMethodErrors;
|
|
|
|
mShippingAddressErrors = aShippingAddressErrors;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
/* PaymentOptions */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentOptions,
|
|
|
|
nsIPaymentOptions)
|
|
|
|
|
|
|
|
PaymentOptions::PaymentOptions(const bool aRequestPayerName,
|
|
|
|
const bool aRequestPayerEmail,
|
|
|
|
const bool aRequestPayerPhone,
|
|
|
|
const bool aRequestShipping,
|
|
|
|
const nsAString& aShippingType)
|
|
|
|
: mRequestPayerName(aRequestPayerName)
|
|
|
|
, mRequestPayerEmail(aRequestPayerEmail)
|
|
|
|
, mRequestPayerPhone(aRequestPayerPhone)
|
|
|
|
, mRequestShipping(aRequestShipping)
|
|
|
|
, mShippingType(aShippingType)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
PaymentOptions::Create(const IPCPaymentOptions& aIPCOptions,
|
|
|
|
nsIPaymentOptions** aOptions)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aOptions);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPaymentOptions> options =
|
|
|
|
new PaymentOptions(aIPCOptions.requestPayerName(),
|
|
|
|
aIPCOptions.requestPayerEmail(),
|
|
|
|
aIPCOptions.requestPayerPhone(),
|
|
|
|
aIPCOptions.requestShipping(),
|
|
|
|
aIPCOptions.shippingType());
|
|
|
|
options.forget(aOptions);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentOptions::GetRequestPayerName(bool* aRequestPayerName)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRequestPayerName);
|
|
|
|
*aRequestPayerName = mRequestPayerName;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentOptions::GetRequestPayerEmail(bool* aRequestPayerEmail)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRequestPayerEmail);
|
|
|
|
*aRequestPayerEmail = mRequestPayerEmail;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentOptions::GetRequestPayerPhone(bool* aRequestPayerPhone)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRequestPayerPhone);
|
|
|
|
*aRequestPayerPhone = mRequestPayerPhone;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentOptions::GetRequestShipping(bool* aRequestShipping)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRequestShipping);
|
|
|
|
*aRequestShipping = mRequestShipping;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentOptions::GetShippingType(nsAString& aShippingType)
|
|
|
|
{
|
|
|
|
aShippingType = mShippingType;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PaymentReqeust */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentRequest,
|
|
|
|
nsIPaymentRequest)
|
|
|
|
|
|
|
|
PaymentRequest::PaymentRequest(const uint64_t aTabId,
|
|
|
|
const nsAString& aRequestId,
|
2017-08-23 09:26:51 +03:00
|
|
|
nsIPrincipal* aTopLevelPrincipal,
|
2017-05-25 20:50:32 +03:00
|
|
|
nsIArray* aPaymentMethods,
|
|
|
|
nsIPaymentDetails* aPaymentDetails,
|
2018-04-14 04:47:20 +03:00
|
|
|
nsIPaymentOptions* aPaymentOptions,
|
2018-05-31 00:13:07 +03:00
|
|
|
const nsAString& aShippingOption)
|
2017-05-25 20:50:32 +03:00
|
|
|
: mTabId(aTabId)
|
|
|
|
, mRequestId(aRequestId)
|
2017-08-23 09:26:51 +03:00
|
|
|
, mTopLevelPrincipal(aTopLevelPrincipal)
|
2017-05-25 20:50:32 +03:00
|
|
|
, mPaymentMethods(aPaymentMethods)
|
|
|
|
, mPaymentDetails(aPaymentDetails)
|
|
|
|
, mPaymentOptions(aPaymentOptions)
|
2018-04-14 04:47:20 +03:00
|
|
|
, mShippingOption(aShippingOption)
|
2018-09-13 16:40:18 +03:00
|
|
|
, mState(eCreated)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetTabId(uint64_t* aTabId)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aTabId);
|
|
|
|
*aTabId = mTabId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-08-23 09:26:51 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetTopLevelPrincipal(nsIPrincipal** aTopLevelPrincipal)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aTopLevelPrincipal);
|
|
|
|
MOZ_ASSERT(mTopLevelPrincipal);
|
|
|
|
nsCOMPtr<nsIPrincipal> principal = mTopLevelPrincipal;
|
|
|
|
principal.forget(aTopLevelPrincipal);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetRequestId(nsAString& aRequestId)
|
|
|
|
{
|
|
|
|
aRequestId = mRequestId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetPaymentMethods(nsIArray** aPaymentMethods)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aPaymentMethods);
|
|
|
|
MOZ_ASSERT(mPaymentMethods);
|
|
|
|
nsCOMPtr<nsIArray> methods = mPaymentMethods;
|
|
|
|
methods.forget(aPaymentMethods);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetPaymentDetails(nsIPaymentDetails** aPaymentDetails)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aPaymentDetails);
|
|
|
|
MOZ_ASSERT(mPaymentDetails);
|
|
|
|
nsCOMPtr<nsIPaymentDetails> details = mPaymentDetails;
|
|
|
|
details.forget(aPaymentDetails);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetPaymentOptions(nsIPaymentOptions** aPaymentOptions)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aPaymentOptions);
|
|
|
|
MOZ_ASSERT(mPaymentOptions);
|
|
|
|
nsCOMPtr<nsIPaymentOptions> options = mPaymentOptions;
|
|
|
|
options.forget(aPaymentOptions);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2018-04-14 04:47:20 +03:00
|
|
|
PaymentRequest::GetShippingOption(nsAString& aShippingOption)
|
|
|
|
{
|
|
|
|
aShippingOption = mShippingOption;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-08-30 15:13:33 +03:00
|
|
|
nsresult
|
2018-04-14 04:47:20 +03:00
|
|
|
PaymentRequest::UpdatePaymentDetails(nsIPaymentDetails* aPaymentDetails,
|
|
|
|
const nsAString& aShippingOption)
|
2017-05-25 20:50:32 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aPaymentDetails);
|
2018-03-29 18:09:52 +03:00
|
|
|
bool requestShipping;
|
|
|
|
nsresult rv = mPaymentOptions->GetRequestShipping(&requestShipping);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2018-04-14 04:47:20 +03:00
|
|
|
mShippingOption = aShippingOption;
|
2018-08-30 15:13:33 +03:00
|
|
|
|
|
|
|
PaymentDetails* rowDetails = static_cast<PaymentDetails*>(mPaymentDetails.get());
|
|
|
|
MOZ_ASSERT(rowDetails);
|
|
|
|
return rowDetails->Update(aPaymentDetails, requestShipping);
|
2017-05-25 20:50:32 +03:00
|
|
|
}
|
|
|
|
|
2018-08-30 15:13:33 +03:00
|
|
|
void
|
2018-03-13 17:30:08 +03:00
|
|
|
PaymentRequest::SetCompleteStatus(const nsAString& aCompleteStatus)
|
|
|
|
{
|
|
|
|
mCompleteStatus = aCompleteStatus;
|
|
|
|
}
|
|
|
|
|
2018-09-04 13:28:40 +03:00
|
|
|
nsresult
|
|
|
|
PaymentRequest::UpdateErrors(const nsAString& aError,
|
|
|
|
const nsAString& aPayerErrors,
|
|
|
|
const nsAString& aPaymentMethodErrors,
|
|
|
|
const nsAString& aShippingAddressErrors)
|
|
|
|
{
|
|
|
|
PaymentDetails* rowDetails = static_cast<PaymentDetails*>(mPaymentDetails.get());
|
|
|
|
MOZ_ASSERT(rowDetails);
|
|
|
|
return rowDetails->UpdateErrors(aError,
|
|
|
|
aPayerErrors,
|
|
|
|
aPaymentMethodErrors,
|
|
|
|
aShippingAddressErrors);
|
|
|
|
}
|
|
|
|
|
2018-03-13 17:30:08 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentRequest::GetCompleteStatus(nsAString& aCompleteStatus)
|
|
|
|
{
|
|
|
|
aCompleteStatus = mCompleteStatus;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-23 12:15:51 +03:00
|
|
|
/* PaymentAddress */
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(PaymentAddress, nsIPaymentAddress)
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::Init(const nsAString& aCountry,
|
|
|
|
nsIArray* aAddressLine,
|
|
|
|
const nsAString& aRegion,
|
2018-09-28 13:21:59 +03:00
|
|
|
const nsAString& aRegionCode,
|
2017-06-23 12:15:51 +03:00
|
|
|
const nsAString& aCity,
|
|
|
|
const nsAString& aDependentLocality,
|
|
|
|
const nsAString& aPostalCode,
|
|
|
|
const nsAString& aSortingCode,
|
|
|
|
const nsAString& aOrganization,
|
|
|
|
const nsAString& aRecipient,
|
|
|
|
const nsAString& aPhone)
|
|
|
|
{
|
|
|
|
mCountry = aCountry;
|
|
|
|
mAddressLine = aAddressLine;
|
|
|
|
mRegion = aRegion;
|
2018-09-28 13:21:59 +03:00
|
|
|
mRegionCode = aRegionCode;
|
2017-06-23 12:15:51 +03:00
|
|
|
mCity = aCity;
|
|
|
|
mDependentLocality = aDependentLocality;
|
|
|
|
mPostalCode = aPostalCode;
|
|
|
|
mSortingCode = aSortingCode;
|
|
|
|
mOrganization = aOrganization;
|
|
|
|
mRecipient = aRecipient;
|
|
|
|
mPhone = aPhone;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetCountry(nsAString& aCountry)
|
|
|
|
{
|
|
|
|
aCountry = mCountry;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetAddressLine(nsIArray** aAddressLine)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aAddressLine);
|
|
|
|
nsCOMPtr<nsIArray> addressLine = mAddressLine;
|
|
|
|
addressLine.forget(aAddressLine);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetRegion(nsAString& aRegion)
|
|
|
|
{
|
|
|
|
aRegion = mRegion;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-09-28 13:21:59 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
PaymentAddress::GetRegionCode(nsAString& aRegionCode)
|
|
|
|
{
|
|
|
|
aRegionCode = mRegionCode;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetCity(nsAString& aCity)
|
|
|
|
{
|
|
|
|
aCity = mCity;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetDependentLocality(nsAString& aDependentLocality)
|
|
|
|
{
|
|
|
|
aDependentLocality = mDependentLocality;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetPostalCode(nsAString& aPostalCode)
|
|
|
|
{
|
|
|
|
aPostalCode = mPostalCode;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetSortingCode(nsAString& aSortingCode)
|
|
|
|
{
|
|
|
|
aSortingCode = mSortingCode;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetOrganization(nsAString& aOrganization)
|
|
|
|
{
|
|
|
|
aOrganization = mOrganization;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetRecipient(nsAString& aRecipient)
|
|
|
|
{
|
|
|
|
aRecipient = mRecipient;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-06-30 20:17:12 +03:00
|
|
|
NS_IMETHODIMP
|
2017-06-23 12:15:51 +03:00
|
|
|
PaymentAddress::GetPhone(nsAString& aPhone)
|
|
|
|
{
|
|
|
|
aPhone = mPhone;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
} // end of namespace payment
|
|
|
|
} // end of namespace dom
|
|
|
|
} // end of namespace mozilla
|