gecko-dev/dom/payments/BasicCardPayment.h
Eden Chuang 74e578d048 Bug 1497215 - Refactor the IPC structure for PaymentResponse.details r=baku
In original design, payment method response data is passed between processes
    through a simple nsString. It means a special encoder/decoder is needed for
    special response data, ex. BasicCardResponse, to serialize/deserialize
    into/from the nsString. However, when a token spliter, ':', ';' and '@', is
    used in response data, it makes the encoder/decoder can not work normally.
    It is hard to define a suitable token spliter set for encoder/decoder.
    So instead of using an error-prone encoder/decoder, this patch defining a new
    IPC structure for response data.

--HG--
extra : rebase_source : 4972033516bc861ea3f975a27b7688fc6eb89a94
2018-10-29 13:56:32 +01:00

39 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_BasicCardPayment_h
#define mozilla_dom_BasicCardPayment_h
#include "mozilla/dom/BasicCardPaymentBinding.h"
#include "nsPIDOMWindow.h"
#include "nsIPaymentAddress.h"
#include "nsTArray.h"
namespace mozilla {
namespace dom {
class BasicCardService final
{
public:
NS_INLINE_DECL_REFCOUNTING(BasicCardService)
static already_AddRefed<BasicCardService> GetService();
bool IsBasicCardPayment(const nsAString& aSupportedMethods);
bool IsValidBasicCardRequest(JSContext* aCx, JSObject* aData, nsAString& aErrorMsg);
bool IsValidBasicCardErrors(JSContext* aCx, JSObject* aData);
bool IsValidExpiryMonth(const nsAString& aExpiryMonth);
bool IsValidExpiryYear(const nsAString& aExpiryYear);
private:
BasicCardService() = default;
~BasicCardService() = default;
};
} // end of namespace dom
} // end of namespace mozilla
#endif